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"
This commit is contained in:
Linus Torvalds 2012-01-16 14:34:54 -08:00
Родитель 53999bf34d 7c43185138
Коммит c63dbbd526
10 изменённых файлов: 40 добавлений и 13 удалений

Просмотреть файл

@ -312,7 +312,7 @@ endif
# If the user is running make -s (silent mode), suppress echoing of # If the user is running make -s (silent mode), suppress echoing of
# commands # commands
ifneq ($(findstring s,$(MAKEFLAGS)),) ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
quiet=silent_ quiet=silent_
endif endif

Просмотреть файл

@ -59,9 +59,11 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
endif endif
targets += $(dtb-y)
# Rule to build device tree blobs # Rule to build device tree blobs
$(obj)/%.dtb: $(src)/dts/%.dts $(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call cmd,dtc) $(call if_changed_dep,dtc)
$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))

Просмотреть файл

@ -53,6 +53,6 @@ $(obj)/simpleImage.%: vmlinux FORCE
DTC_FLAGS := -p 1024 DTC_FLAGS := -p 1024
$(obj)/%.dtb: $(src)/dts/%.dts FORCE $(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call cmd,dtc) $(call if_changed_dep,dtc)
clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub

Просмотреть файл

@ -11,5 +11,5 @@ clean-files := *.dtb.S
#DTC_FLAGS ?= -p 1024 #DTC_FLAGS ?= -p 1024
$(obj)/%.dtb: $(src)/dts/%.dts $(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call cmd,dtc) $(call if_changed_dep,dtc)

Просмотреть файл

@ -345,8 +345,8 @@ $(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
# Rule to build device tree blobs # Rule to build device tree blobs
$(obj)/%.dtb: $(src)/dts/%.dts $(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call cmd,dtc) $(call if_changed_dep,dtc)
# If there isn't a platform selected then just strip the vmlinux. # If there isn't a platform selected then just strip the vmlinux.
ifeq (,$(image-y)) ifeq (,$(image-y))

Просмотреть файл

@ -93,9 +93,9 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
# already # already
# $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will # $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will
# end up in (or would, if it gets compiled in) # end up in (or would, if it gets compiled in)
# Note: It's possible that one object gets potentially linked into more # Note: Files that end up in two or more modules are compiled without the
# than one module. In that case KBUILD_MODNAME will be set to foo_bar, # KBUILD_MODNAME definition. The reason is that any made-up name would
# where foo and bar are the name of the modules. # differ in different configs.
name-fix = $(subst $(comma),_,$(subst -,_,$1)) name-fix = $(subst $(comma),_,$(subst -,_,$1))
basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
modname_flags = $(if $(filter 1,$(words $(modname))),\ modname_flags = $(if $(filter 1,$(words $(modname))),\
@ -264,7 +264,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
$(call cmd,dt_S_dtb) $(call cmd,dt_S_dtb)
quiet_cmd_dtc = DTC $@ quiet_cmd_dtc = DTC $@
cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $< cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
# Bzip2 # Bzip2
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

Просмотреть файл

@ -71,6 +71,7 @@ static void __attribute__ ((noreturn)) usage(void)
fprintf(stderr, "\t\t\tasm - assembler source\n"); fprintf(stderr, "\t\t\tasm - assembler source\n");
fprintf(stderr, "\t-V <output version>\n"); fprintf(stderr, "\t-V <output version>\n");
fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION); fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION);
fprintf(stderr, "\t-d <output dependency file>\n");
fprintf(stderr, "\t-R <number>\n"); fprintf(stderr, "\t-R <number>\n");
fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n"); fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n");
fprintf(stderr, "\t-S <bytes>\n"); fprintf(stderr, "\t-S <bytes>\n");
@ -99,6 +100,7 @@ int main(int argc, char *argv[])
const char *inform = "dts"; const char *inform = "dts";
const char *outform = "dts"; const char *outform = "dts";
const char *outname = "-"; const char *outname = "-";
const char *depname = NULL;
int force = 0, check = 0, sort = 0; int force = 0, check = 0, sort = 0;
const char *arg; const char *arg;
int opt; int opt;
@ -111,7 +113,8 @@ int main(int argc, char *argv[])
minsize = 0; minsize = 0;
padsize = 0; padsize = 0;
while ((opt = getopt(argc, argv, "hI:O:o:V:R:S:p:fcqb:vH:s")) != EOF) { while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fcqb:vH:s"))
!= EOF) {
switch (opt) { switch (opt) {
case 'I': case 'I':
inform = optarg; inform = optarg;
@ -125,6 +128,9 @@ int main(int argc, char *argv[])
case 'V': case 'V':
outversion = strtol(optarg, NULL, 0); outversion = strtol(optarg, NULL, 0);
break; break;
case 'd':
depname = optarg;
break;
case 'R': case 'R':
reservenum = strtol(optarg, NULL, 0); reservenum = strtol(optarg, NULL, 0);
break; break;
@ -188,6 +194,14 @@ int main(int argc, char *argv[])
fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", fprintf(stderr, "DTC: %s->%s on file \"%s\"\n",
inform, outform, arg); inform, outform, arg);
if (depname) {
depfile = fopen(depname, "w");
if (!depfile)
die("Couldn't open dependency file %s: %s\n", depname,
strerror(errno));
fprintf(depfile, "%s:", outname);
}
if (streq(inform, "dts")) if (streq(inform, "dts"))
bi = dt_from_source(arg); bi = dt_from_source(arg);
else if (streq(inform, "fs")) else if (streq(inform, "fs"))
@ -197,6 +211,11 @@ int main(int argc, char *argv[])
else else
die("Unknown input format \"%s\"\n", inform); die("Unknown input format \"%s\"\n", inform);
if (depfile) {
fputc('\n', depfile);
fclose(depfile);
}
if (cmdline_boot_cpuid != -1) if (cmdline_boot_cpuid != -1)
bi->boot_cpuid_phys = cmdline_boot_cpuid; bi->boot_cpuid_phys = cmdline_boot_cpuid;

Просмотреть файл

@ -40,6 +40,7 @@ static char *dirname(const char *path)
return NULL; return NULL;
} }
FILE *depfile; /* = NULL */
struct srcfile_state *current_srcfile; /* = NULL */ struct srcfile_state *current_srcfile; /* = NULL */
/* Detect infinite include recursion. */ /* Detect infinite include recursion. */
@ -67,6 +68,9 @@ FILE *srcfile_relative_open(const char *fname, char **fullnamep)
strerror(errno)); strerror(errno));
} }
if (depfile)
fprintf(depfile, " %s", fullname);
if (fullnamep) if (fullnamep)
*fullnamep = fullname; *fullnamep = fullname;
else else

Просмотреть файл

@ -30,6 +30,7 @@ struct srcfile_state {
struct srcfile_state *prev; struct srcfile_state *prev;
}; };
extern FILE *depfile; /* = NULL */
extern struct srcfile_state *current_srcfile; /* = NULL */ extern struct srcfile_state *current_srcfile; /* = NULL */
FILE *srcfile_relative_open(const char *fname, char **fullnamep); FILE *srcfile_relative_open(const char *fname, char **fullnamep);

Просмотреть файл

@ -11,3 +11,4 @@ HOSTCFLAGS_lex.lex.o := -I$(src)
# dependencies on generated files need to be listed explicitly # dependencies on generated files need to be listed explicitly
$(obj)/lex.lex.o: $(obj)/keywords.hash.c $(obj)/parse.tab.h $(obj)/lex.lex.o: $(obj)/keywords.hash.c $(obj)/parse.tab.h
clean-files := keywords.hash.c lex.lex.c parse.tab.c parse.tab.h