fixes, moved ir test driver to testir.c
[henge/webcc.git] / src / Makefile
index 36f0e97..b5e6754 100644 (file)
@@ -105,7 +105,7 @@ endef
 define PREMAKE_SOURCE_COMPILER =
 # Find the sources for each source-to-source language
 $(foreach slang,$(SLANGS),
-$(eval SLANG_SRC := $(patsubst ./%,%,$(shell find -name "*.$(slang)")))
+$(eval SLANG_SRC := $(patsubst ./%,%,$(filter-out .%,$(shell find -name "*.$(slang)"))))
 # Foreach target type in the source-to-source language, add this source's
 # targets to the list of the current source-to-source language targets
 $(foreach trg,$($(slang)_TRG),
@@ -133,11 +133,12 @@ $(eval BUILDGOALS := $(filter-out clean scrub purge uninstall,$(MAKECMDGOALS))),
 $(eval BUILDGOALS := all))
 $(if $(and $(BUILDGOALS),$(filter $(OLDER_TIME),$(NEWEST_TRG_TIME))),
 $(eval SHELL_CMD := cd $(dir $(src)) && $($(slang)_C) $($(slang)_FLAGS) $(notdir $(src)))
+$(info SHELL_CMD := cd $(dir $(src)) && $($(slang)_C) $($(slang)_FLAGS) $(notdir $(src)))
 $(info $(SHELL_CMD) $(shell $(SHELL_CMD)))
 )
 # Put these targets on the MAKE_TARGETS list to be removed during "clean",
 # regardless of whether or not they were built just now.
-$(info MAKE_TARGETS+= $(SLANG_TRG))
+$(eval MAKE_TARGETS+= $(SLANG_TRG))
 ))
 endef
 # Compile a source language to a language that compiles to binary, but only if
@@ -167,7 +168,7 @@ endef
 define SRC_LANG_RULE =
 $(if $($1),,$(eval $1 := t)\
 $(eval MOD  := $(filter $(MODULES),$(firstword $(subst /, ,$(dir $1)))))\
-$(eval FLG  := $($2_FLAGS) $(MOD:%=-I% ))\
+$(eval FLG  := $(MOD:%=-I% ))\
 $(if $(wildcard $1),
 $(eval DEPS := $(filter-out \ %:,$(shell $($2_C) $(FLG) -M -MG $1)))\
 $(eval MDEPS := $(filter $(MODULES:%=%/%),$(DEPS)))\
@@ -177,7 +178,7 @@ $(eval MDEPS := $(shell echo $(MDEPS) | sed -e 's@[a-zA-Z0-9\-\+/]*\.\./include@
 $(eval ALLDEPS := $(MDEPS) $(DEPS)),\
 $(error Cannot generate deps for: $1, file not found))\
 $(eval SRC_OBJ    := $(basename $1).$($2_OBJ))\
-$(info MAKE_TARGETS+= $(SRC_OBJ))\
+$(eval MAKE_TARGETS+= $(SRC_OBJ))\
 
 # Object for $1
 $(SRC_OBJ): $(ALLDEPS)
@@ -285,13 +286,14 @@ endef
 # modules as static libs).
 define MODULE_ARCRULE =
 $(eval ARCDEPS := $(filter $1/%.$(c_OBJ),$(foreach lang,$(LANGS),$($(lang)_MOD_TRG))))\
-$(info MAKE_TARGETS+= $1.$(c_AROBJ))\
+$(eval MAKE_TARGETS+= $1.$(c_AROBJ))\
+
 $1.$(c_AROBJ): $(ARCDEPS)
        $(c_AR) cr $$@ $$^
 $(if $(c_DBG),
 $(eval undefine DBGARCDEPS)
 $(foreach arcdep,$(ARCDEPS),$(eval DBGARCDEPS += $(dir $(arcdep)).$(c_DBG)/$(notdir $(arcdep))))
-$(info MAKE_TARGETS+= .$(c_DBG)/$1.$(c_AROBJ))\
+$(eval MAKE_TARGETS+= .$(c_DBG)/$1.$(c_AROBJ))\
 
 .$(c_DBG)/$1.$(c_AROBJ): $(DBGARCDEPS) | .$(c_DBG)/
        $(c_AR) cr $$@ $$^
@@ -519,7 +521,7 @@ all: $(basename $(DRV_FNAMES))
        @echo Build Complete
 
 # Rule to make any dirs that we're in charge of
-$(MAKE_DIRS):
+$(sort $(MAKE_DIRS)):
        @mkdir -p $@
 
 # Cleaning rules.