Commit c63dbbd5268c397f051e0e0f665799ef64a1f3a4
Exists in
master
and in
6 other branches
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: Kbuild: Use dtc's -d (dependency) option dtc: Implement -d option to write out a dependency file kbuild: Fix comment in Makefile.lib scripts/genksyms: clean lex/yacc generated files kbuild: Correctly deal with make options which contain an "s"
Showing 10 changed files Side-by-side Diff
Makefile
arch/arm/boot/Makefile
... | ... | @@ -59,9 +59,11 @@ |
59 | 59 | |
60 | 60 | endif |
61 | 61 | |
62 | +targets += $(dtb-y) | |
63 | + | |
62 | 64 | # Rule to build device tree blobs |
63 | -$(obj)/%.dtb: $(src)/dts/%.dts | |
64 | - $(call cmd,dtc) | |
65 | +$(obj)/%.dtb: $(src)/dts/%.dts FORCE | |
66 | + $(call if_changed_dep,dtc) | |
65 | 67 | |
66 | 68 | $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) |
67 | 69 |
arch/microblaze/boot/Makefile
arch/openrisc/boot/Makefile
arch/powerpc/boot/Makefile
... | ... | @@ -345,8 +345,8 @@ |
345 | 345 | $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) |
346 | 346 | |
347 | 347 | # Rule to build device tree blobs |
348 | -$(obj)/%.dtb: $(src)/dts/%.dts | |
349 | - $(call cmd,dtc) | |
348 | +$(obj)/%.dtb: $(src)/dts/%.dts FORCE | |
349 | + $(call if_changed_dep,dtc) | |
350 | 350 | |
351 | 351 | # If there isn't a platform selected then just strip the vmlinux. |
352 | 352 | ifeq (,$(image-y)) |
scripts/Makefile.lib
... | ... | @@ -93,9 +93,9 @@ |
93 | 93 | # already |
94 | 94 | # $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will |
95 | 95 | # end up in (or would, if it gets compiled in) |
96 | -# Note: It's possible that one object gets potentially linked into more | |
97 | -# than one module. In that case KBUILD_MODNAME will be set to foo_bar, | |
98 | -# where foo and bar are the name of the modules. | |
96 | +# Note: Files that end up in two or more modules are compiled without the | |
97 | +# KBUILD_MODNAME definition. The reason is that any made-up name would | |
98 | +# differ in different configs. | |
99 | 99 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) |
100 | 100 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" |
101 | 101 | modname_flags = $(if $(filter 1,$(words $(modname))),\ |
... | ... | @@ -264,7 +264,7 @@ |
264 | 264 | $(call cmd,dt_S_dtb) |
265 | 265 | |
266 | 266 | quiet_cmd_dtc = DTC $@ |
267 | -cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $< | |
267 | +cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $< | |
268 | 268 | |
269 | 269 | # Bzip2 |
270 | 270 | # --------------------------------------------------------------------------- |
scripts/dtc/dtc.c
... | ... | @@ -71,6 +71,7 @@ |
71 | 71 | fprintf(stderr, "\t\t\tasm - assembler source\n"); |
72 | 72 | fprintf(stderr, "\t-V <output version>\n"); |
73 | 73 | fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION); |
74 | + fprintf(stderr, "\t-d <output dependency file>\n"); | |
74 | 75 | fprintf(stderr, "\t-R <number>\n"); |
75 | 76 | fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n"); |
76 | 77 | fprintf(stderr, "\t-S <bytes>\n"); |
... | ... | @@ -99,6 +100,7 @@ |
99 | 100 | const char *inform = "dts"; |
100 | 101 | const char *outform = "dts"; |
101 | 102 | const char *outname = "-"; |
103 | + const char *depname = NULL; | |
102 | 104 | int force = 0, check = 0, sort = 0; |
103 | 105 | const char *arg; |
104 | 106 | int opt; |
... | ... | @@ -111,7 +113,8 @@ |
111 | 113 | minsize = 0; |
112 | 114 | padsize = 0; |
113 | 115 | |
114 | - while ((opt = getopt(argc, argv, "hI:O:o:V:R:S:p:fcqb:vH:s")) != EOF) { | |
116 | + while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fcqb:vH:s")) | |
117 | + != EOF) { | |
115 | 118 | switch (opt) { |
116 | 119 | case 'I': |
117 | 120 | inform = optarg; |
... | ... | @@ -125,6 +128,9 @@ |
125 | 128 | case 'V': |
126 | 129 | outversion = strtol(optarg, NULL, 0); |
127 | 130 | break; |
131 | + case 'd': | |
132 | + depname = optarg; | |
133 | + break; | |
128 | 134 | case 'R': |
129 | 135 | reservenum = strtol(optarg, NULL, 0); |
130 | 136 | break; |
... | ... | @@ -188,6 +194,14 @@ |
188 | 194 | fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", |
189 | 195 | inform, outform, arg); |
190 | 196 | |
197 | + if (depname) { | |
198 | + depfile = fopen(depname, "w"); | |
199 | + if (!depfile) | |
200 | + die("Couldn't open dependency file %s: %s\n", depname, | |
201 | + strerror(errno)); | |
202 | + fprintf(depfile, "%s:", outname); | |
203 | + } | |
204 | + | |
191 | 205 | if (streq(inform, "dts")) |
192 | 206 | bi = dt_from_source(arg); |
193 | 207 | else if (streq(inform, "fs")) |
... | ... | @@ -196,6 +210,11 @@ |
196 | 210 | bi = dt_from_blob(arg); |
197 | 211 | else |
198 | 212 | die("Unknown input format \"%s\"\n", inform); |
213 | + | |
214 | + if (depfile) { | |
215 | + fputc('\n', depfile); | |
216 | + fclose(depfile); | |
217 | + } | |
199 | 218 | |
200 | 219 | if (cmdline_boot_cpuid != -1) |
201 | 220 | bi->boot_cpuid_phys = cmdline_boot_cpuid; |
scripts/dtc/srcpos.c
... | ... | @@ -40,6 +40,7 @@ |
40 | 40 | return NULL; |
41 | 41 | } |
42 | 42 | |
43 | +FILE *depfile; /* = NULL */ | |
43 | 44 | struct srcfile_state *current_srcfile; /* = NULL */ |
44 | 45 | |
45 | 46 | /* Detect infinite include recursion. */ |
... | ... | @@ -66,6 +67,9 @@ |
66 | 67 | die("Couldn't open \"%s\": %s\n", fname, |
67 | 68 | strerror(errno)); |
68 | 69 | } |
70 | + | |
71 | + if (depfile) | |
72 | + fprintf(depfile, " %s", fullname); | |
69 | 73 | |
70 | 74 | if (fullnamep) |
71 | 75 | *fullnamep = fullname; |
scripts/dtc/srcpos.h
scripts/genksyms/Makefile