diff --git a/scripts/Makefile.build b/scripts/Makefile.build index aa804a94a1b2..7da202c567ac 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -670,6 +670,17 @@ $(call multi_depend, $(multi-used-m), .o, -objs -y -m) targets += $(multi-used-y) $(multi-used-m) +# Add intermediate targets: +# When building objects with specific suffix patterns, add intermediate +# targets that the final targets are derived from. +intermediate_targets = $(foreach sfx, $(2), \ + $(patsubst %$(strip $(1)),%$(sfx), \ + $(filter %$(strip $(1)), $(targets)))) +# %.lex.o <- %.lex.c <- %.l +# %.tab.o <- %.tab.[ch] <- %.y +targets += $(call intermediate_targets, .lex.o, .lex.c) \ + $(call intermediate_targets, .tab.o, .tab.c .tab.h) + # Descending # --------------------------------------------------------------------------- diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 69e257ee38f1..5d1d4dea7a9d 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile @@ -20,6 +20,3 @@ HOSTCFLAGS_dtc-parser.tab.o := -I$(src) # dependencies on generated files need to be listed explicitly $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h - -# generated files need to include *.cmd -targets := dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 3ad909534f9e..dafceae69a8b 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -191,6 +191,7 @@ gconf-objs := gconf.o zconf.tab.o hostprogs-y := conf nconf mconf kxgettext qconf gconf +targets += zconf.lex.c clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck clean-files += gconf.glade.h clean-files += config.pot linux.pot