diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 883435b..3c686e4 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -379,6 +379,17 @@ targets += $(multi-used-y) $(multi-used-m) targets := $(filter-out $(PHONY), $(targets)) +# 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 # ---------------------------------------------------------------------------