Skip to content

Commit 0e0345b

Browse files
Alexey Dobriyanmasahir0y
authored andcommitted
kbuild: redo fake deps at include/config/*.h
Make include/config/foo/bar.h fake deps files generation simpler. * delete .h suffix those aren't header files, shorten filenames, * delete tolower() Linux filesystems can deal with both upper and lowercase filenames very well, * put everything in 1 directory Presumably 'mkdir -p' split is from dark times when filesystems handled huge directories badly, disks were round adding to seek times. x86_64 allmodconfig lists 12364 files in include/config. ../obj/include/config/ ├── 104_QUAD_8 ├── 60XX_WDT ├── 64BIT ... ├── ZSWAP_DEFAULT_ON ├── ZSWAP_ZPOOL_DEFAULT └── ZSWAP_ZPOOL_DEFAULT_ZBUD 0 directories, 12364 files Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent e345605 commit 0e0345b

File tree

6 files changed

+16
-52
lines changed

6 files changed

+16
-52
lines changed

include/linux/compiler-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
* This header exists to force full rebuild when the compiler is upgraded.
1010
*
1111
* When fixdep scans this, it will find this string "CONFIG_CC_VERSION_TEXT"
12-
* and add dependency on include/config/cc/version/text.h, which is touched
12+
* and add dependency on include/config/CC_VERSION_TEXT, which is touched
1313
* by Kconfig when the version string from the compiler changes.
1414
*/

init/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ config CC_VERSION_TEXT
2121

2222
- Ensure full rebuild when the compiler is updated
2323
include/linux/compiler-version.h contains this option in the comment
24-
line so fixdep adds include/config/cc/version/text.h into the
24+
line so fixdep adds include/config/CC_VERSION_TEXT into the
2525
auto-generated dependency. When the compiler is updated, syncconfig
2626
will touch it and then every file will be rebuilt.
2727

kernel/gen_kheaders.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ all_dirs="$all_dirs $dir_list"
3636
#
3737
# When Kconfig regenerates include/generated/autoconf.h, its timestamp is
3838
# updated, but the contents might be still the same. When any CONFIG option is
39-
# changed, Kconfig touches the corresponding timestamp file include/config/*.h.
39+
# changed, Kconfig touches the corresponding timestamp file include/config/*.
4040
# Hence, the md5sum detects the configuration change anyway. We do not need to
4141
# check include/generated/autoconf.h explicitly.
4242
#

scripts/Makefile.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ endif # CONFIG_STACK_VALIDATION
239239

240240
# Rebuild all objects when objtool changes, or is enabled/disabled.
241241
objtool_dep = $(objtool_obj) \
242-
$(wildcard include/config/orc/unwinder.h \
243-
include/config/stack/validation.h)
242+
$(wildcard include/config/ORC_UNWINDER \
243+
include/config/STACK_VALIDATION)
244244

245245
ifdef CONFIG_TRIM_UNUSED_KSYMS
246246
cmd_gen_ksymdeps = \

scripts/basic/fixdep.c

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* the config symbols are rebuilt.
3535
*
3636
* So if the user changes his CONFIG_HIS_DRIVER option, only the objects
37-
* which depend on "include/config/his/driver.h" will be rebuilt,
37+
* which depend on "include/config/HIS_DRIVER" will be rebuilt,
3838
* so most likely only his driver ;-)
3939
*
4040
* The idea above dates, by the way, back to Michael E Chastain, AFAIK.
@@ -74,7 +74,7 @@
7474
*
7575
* and then basically copies the .<target>.d file to stdout, in the
7676
* process filtering out the dependency on autoconf.h and adding
77-
* dependencies on include/config/my/option.h for every
77+
* dependencies on include/config/MY_OPTION for every
7878
* CONFIG_MY_OPTION encountered in any of the prerequisites.
7979
*
8080
* We don't even try to really parse the header files, but
@@ -107,8 +107,8 @@ static void usage(void)
107107

108108
/*
109109
* In the intended usage of this program, the stdout is redirected to .*.cmd
110-
* files. The return value of printf() and putchar() must be checked to catch
111-
* any error, e.g. "No space left on device".
110+
* files. The return value of printf() must be checked to catch any error,
111+
* e.g. "No space left on device".
112112
*/
113113
static void xprintf(const char *format, ...)
114114
{
@@ -124,38 +124,6 @@ static void xprintf(const char *format, ...)
124124
va_end(ap);
125125
}
126126

127-
static void xputchar(int c)
128-
{
129-
int ret;
130-
131-
ret = putchar(c);
132-
if (ret == EOF) {
133-
perror("fixdep");
134-
exit(1);
135-
}
136-
}
137-
138-
/*
139-
* Print out a dependency path from a symbol name
140-
*/
141-
static void print_dep(const char *m, int slen, const char *dir)
142-
{
143-
int c, prev_c = '/', i;
144-
145-
xprintf(" $(wildcard %s/", dir);
146-
for (i = 0; i < slen; i++) {
147-
c = m[i];
148-
if (c == '_')
149-
c = '/';
150-
else
151-
c = tolower(c);
152-
if (c != '/' || prev_c != '/')
153-
xputchar(c);
154-
prev_c = c;
155-
}
156-
xprintf(".h) \\\n");
157-
}
158-
159127
struct item {
160128
struct item *next;
161129
unsigned int len;
@@ -220,7 +188,8 @@ static void use_config(const char *m, int slen)
220188
return;
221189

222190
define_config(m, slen, hash);
223-
print_dep(m, slen, "include/config");
191+
/* Print out a dependency path from a symbol name. */
192+
xprintf(" $(wildcard include/config/%.*s) \\\n", slen, m);
224193
}
225194

226195
/* test if s ends in sub */

scripts/kconfig/confdata.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,14 @@ static size_t depfile_prefix_len;
130130
static int conf_touch_dep(const char *name)
131131
{
132132
int fd, ret;
133-
const char *s;
134-
char *d, c;
133+
char *d;
135134

136-
/* check overflow: prefix + name + ".h" + '\0' must fit in buffer. */
137-
if (depfile_prefix_len + strlen(name) + 3 > sizeof(depfile_path))
135+
/* check overflow: prefix + name + '\0' must fit in buffer. */
136+
if (depfile_prefix_len + strlen(name) + 1 > sizeof(depfile_path))
138137
return -1;
139138

140139
d = depfile_path + depfile_prefix_len;
141-
s = name;
142-
143-
while ((c = *s++))
144-
*d++ = (c == '_') ? '/' : tolower(c);
145-
strcpy(d, ".h");
140+
strcpy(d, name);
146141

147142
/* Assume directory path already exists. */
148143
fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
@@ -465,7 +460,7 @@ int conf_read_simple(const char *name, int def)
465460
* Reading from include/config/auto.conf
466461
* If CONFIG_FOO previously existed in
467462
* auto.conf but it is missing now,
468-
* include/config/foo.h must be touched.
463+
* include/config/FOO must be touched.
469464
*/
470465
conf_touch_dep(line + strlen(CONFIG_));
471466
else

0 commit comments

Comments
 (0)