target removal fix
authorken <ken@mihrtec.com>
Thu, 22 Sep 2016 23:40:11 +0000 (16:40 -0700)
committerken <ken@mihrtec.com>
Thu, 22 Sep 2016 23:40:11 +0000 (16:40 -0700)
src/Makefile

index 4706047..1c6dad7 100644 (file)
@@ -299,15 +299,15 @@ $(eval $1_SOURCES := $(subst ./,,$(shell find -name "*.$1")))
 # result of such a transformation to the sources of this language.  Then, if the
 # source-to-source compiler also creates duplicate files of other formats
 # (i.e. yacc/bison also produce accompanying .h files), add them to the list of
-# source files that this makefile can generate ('$1_MKSRC'), to later be deleted
+# source files that this makefile can generate ('$1_TARGETS'), to later be deleted
 # during the clean rule.
 $(foreach srcl,$($1_SRCL),\
-$(eval $1_MKSRC   := $(shell find -name "*.$(srcl)" \
-sed -e 's@^\(.*\).$(srcl)@\1$($(srcl)_STEM:%=.%).$1@g' -e 's@\./@@'))\
-$(eval $1_SOURCES += $($1_MKSRC))\
-$(eval $(srcl)_SOURCES += $($1_MKSRC))\
-$(if $($(srcl)_DUP),\
-$(eval $1_SOURCES += $($1_MKSRC:%.$1=%.$($(srcl)_DUP))))\
+$(eval $(srcl)_SOURCES := $(shell find -name "*.$(srcl)" | \
+sed -e 's@^\(.*\).$(srcl)@\1$($(srcl)_STEM:%=.%).$1@g' -e 's@\./@@'))\
+$(eval $1_SOURCES += $($(srcl)_SOURCES))\
+$(eval $(srcl)_TARGETS += $($(srcl)_SOURCES:%.$(srcl)=.$1))\
+$(foreach dup,$($(srcl)_DUP),\
+$(eval $(srcl)_TARGETS += $($(srcl)_TARGETS:%.$1=%.$(dup)))\
 )
 
 $(eval $1_DRV_SRC := $(filter $(DRIVER_DIR)/%,$($1_SOURCES)))
@@ -388,7 +388,6 @@ $(eval $(call LANG_LIB_PARENT_BUILDRULE,$(lang),$(mlib),root))\
 # sources (yacc, etc)
 $(foreach module,$(MODULES),\
 $(eval $(call MODULE_ARCRULE,$(module)))\
-$(eval YS += $(wildcard $(module)/*.y))\
 )
 
 # Create lang-specific rules for producing final (linked) targets
@@ -429,7 +428,7 @@ $(foreach lang,$(LANGS),$(if $($(lang)_SRCL),$(foreach srcl,$($(lang)_SRCL),\
 $(eval $(call SRCLANG_TRGLANG_BUILDRULE,$(srcl),$(lang))))))
 
 clean:
-       rm -f $(foreach lang,$(LANGS),$($(lang)_TARGETS) $($(lang)_MKSRC))
+       rm$(foreach lang,$(LANGS),$(foreach srclang,$($(lang)_SRCL), $($(srclang)_TARGETS)) $($(lang)_TARGETS))
 
 scrub: clean
        rm -Rf $(MAKE_DIRS)