aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-16 17:34:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-16 17:34:54 -0500
commitc63dbbd5268c397f051e0e0f665799ef64a1f3a4 (patch)
tree3d832ca143858fd601869a1e2dbe553bd513d854 /scripts
parent53999bf34d55981328f8ba9def558d3e104d6e36 (diff)
parent7c43185138cf523b0810ffd2c9e18e2ecb356730 (diff)
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"
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib8
-rw-r--r--scripts/dtc/dtc.c21
-rw-r--r--scripts/dtc/srcpos.c4
-rw-r--r--scripts/dtc/srcpos.h1
-rw-r--r--scripts/genksyms/Makefile1
5 files changed, 30 insertions, 5 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 5d986d9adf1b..00c368c6e996 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -93,9 +93,9 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
93# already 93# already
94# $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will 94# $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will
95# end up in (or would, if it gets compiled in) 95# end up in (or would, if it gets compiled in)
96# Note: It's possible that one object gets potentially linked into more 96# Note: Files that end up in two or more modules are compiled without the
97# than one module. In that case KBUILD_MODNAME will be set to foo_bar, 97# KBUILD_MODNAME definition. The reason is that any made-up name would
98# where foo and bar are the name of the modules. 98# differ in different configs.
99name-fix = $(subst $(comma),_,$(subst -,_,$1)) 99name-fix = $(subst $(comma),_,$(subst -,_,$1))
100basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" 100basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
101modname_flags = $(if $(filter 1,$(words $(modname))),\ 101modname_flags = $(if $(filter 1,$(words $(modname))),\
@@ -264,7 +264,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
264 $(call cmd,dt_S_dtb) 264 $(call cmd,dt_S_dtb)
265 265
266quiet_cmd_dtc = DTC $@ 266quiet_cmd_dtc = DTC $@
267cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $< 267cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
268 268
269# Bzip2 269# Bzip2
270# --------------------------------------------------------------------------- 270# ---------------------------------------------------------------------------
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c
index cbc0193098e4..451c92d31b19 100644
--- a/scripts/dtc/dtc.c
+++ b/scripts/dtc/dtc.c
@@ -71,6 +71,7 @@ static void __attribute__ ((noreturn)) usage(void)
71 fprintf(stderr, "\t\t\tasm - assembler source\n"); 71 fprintf(stderr, "\t\t\tasm - assembler source\n");
72 fprintf(stderr, "\t-V <output version>\n"); 72 fprintf(stderr, "\t-V <output version>\n");
73 fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION); 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 fprintf(stderr, "\t-R <number>\n"); 75 fprintf(stderr, "\t-R <number>\n");
75 fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n"); 76 fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n");
76 fprintf(stderr, "\t-S <bytes>\n"); 77 fprintf(stderr, "\t-S <bytes>\n");
@@ -99,6 +100,7 @@ int main(int argc, char *argv[])
99 const char *inform = "dts"; 100 const char *inform = "dts";
100 const char *outform = "dts"; 101 const char *outform = "dts";
101 const char *outname = "-"; 102 const char *outname = "-";
103 const char *depname = NULL;
102 int force = 0, check = 0, sort = 0; 104 int force = 0, check = 0, sort = 0;
103 const char *arg; 105 const char *arg;
104 int opt; 106 int opt;
@@ -111,7 +113,8 @@ int main(int argc, char *argv[])
111 minsize = 0; 113 minsize = 0;
112 padsize = 0; 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 switch (opt) { 118 switch (opt) {
116 case 'I': 119 case 'I':
117 inform = optarg; 120 inform = optarg;
@@ -125,6 +128,9 @@ int main(int argc, char *argv[])
125 case 'V': 128 case 'V':
126 outversion = strtol(optarg, NULL, 0); 129 outversion = strtol(optarg, NULL, 0);
127 break; 130 break;
131 case 'd':
132 depname = optarg;
133 break;
128 case 'R': 134 case 'R':
129 reservenum = strtol(optarg, NULL, 0); 135 reservenum = strtol(optarg, NULL, 0);
130 break; 136 break;
@@ -188,6 +194,14 @@ int main(int argc, char *argv[])
188 fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", 194 fprintf(stderr, "DTC: %s->%s on file \"%s\"\n",
189 inform, outform, arg); 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 if (streq(inform, "dts")) 205 if (streq(inform, "dts"))
192 bi = dt_from_source(arg); 206 bi = dt_from_source(arg);
193 else if (streq(inform, "fs")) 207 else if (streq(inform, "fs"))
@@ -197,6 +211,11 @@ int main(int argc, char *argv[])
197 else 211 else
198 die("Unknown input format \"%s\"\n", inform); 212 die("Unknown input format \"%s\"\n", inform);
199 213
214 if (depfile) {
215 fputc('\n', depfile);
216 fclose(depfile);
217 }
218
200 if (cmdline_boot_cpuid != -1) 219 if (cmdline_boot_cpuid != -1)
201 bi->boot_cpuid_phys = cmdline_boot_cpuid; 220 bi->boot_cpuid_phys = cmdline_boot_cpuid;
202 221
diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c
index 2dbc874288ca..36a38e9f1a2c 100644
--- a/scripts/dtc/srcpos.c
+++ b/scripts/dtc/srcpos.c
@@ -40,6 +40,7 @@ static char *dirname(const char *path)
40 return NULL; 40 return NULL;
41} 41}
42 42
43FILE *depfile; /* = NULL */
43struct srcfile_state *current_srcfile; /* = NULL */ 44struct srcfile_state *current_srcfile; /* = NULL */
44 45
45/* Detect infinite include recursion. */ 46/* Detect infinite include recursion. */
@@ -67,6 +68,9 @@ FILE *srcfile_relative_open(const char *fname, char **fullnamep)
67 strerror(errno)); 68 strerror(errno));
68 } 69 }
69 70
71 if (depfile)
72 fprintf(depfile, " %s", fullname);
73
70 if (fullnamep) 74 if (fullnamep)
71 *fullnamep = fullname; 75 *fullnamep = fullname;
72 else 76 else
diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h
index bd7966e56a53..ce980cafe588 100644
--- a/scripts/dtc/srcpos.h
+++ b/scripts/dtc/srcpos.h
@@ -30,6 +30,7 @@ struct srcfile_state {
30 struct srcfile_state *prev; 30 struct srcfile_state *prev;
31}; 31};
32 32
33extern FILE *depfile; /* = NULL */
33extern struct srcfile_state *current_srcfile; /* = NULL */ 34extern struct srcfile_state *current_srcfile; /* = NULL */
34 35
35FILE *srcfile_relative_open(const char *fname, char **fullnamep); 36FILE *srcfile_relative_open(const char *fname, char **fullnamep);
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index a5510903e874..aca33b98bf63 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -11,3 +11,4 @@ HOSTCFLAGS_lex.lex.o := -I$(src)
11# dependencies on generated files need to be listed explicitly 11# dependencies on generated files need to be listed explicitly
12$(obj)/lex.lex.o: $(obj)/keywords.hash.c $(obj)/parse.tab.h 12$(obj)/lex.lex.o: $(obj)/keywords.hash.c $(obj)/parse.tab.h
13 13
14clean-files := keywords.hash.c lex.lex.c parse.tab.c parse.tab.h