cgi frontend
[henge/webcc.git] / src / Makefile
index 89ebf6e..b4c8225 100644 (file)
@@ -144,7 +144,7 @@ $(eval OLDER_TIME := $(firstword $(sort $(NEWEST_TRG_TIME) $(SRC_TIME))))
 $(if $(MAKECMDGOALS),
 $(eval BUILDGOALS := $(filter-out clean scrub purge uninstall,$(MAKECMDGOALS))),
 $(eval BUILDGOALS := all))
-$(if $(or $(MISSING_TRG), $(and $(BUILDGOALS),$(filter $(OLDER_TIME),$(NEWEST_TRG_TIME)))),
+$(if $(and $(BUILDGOALS),$(or $(MISSING_TRG), $(filter $(OLDER_TIME),$(NEWEST_TRG_TIME)))),
 $(if $(findstring n,$(MAKEFLAGS)),
 $(SLANG_TRG):
        $(SHELL_CMD)
@@ -242,7 +242,9 @@ $(eval DRIVER_MODULES := $(filter-out $(DRIVER_DIR) ..,$(sort $(DRIVER_MODULES))
 # any internal modules, the developer may instead create a file with the same
 # basename as the driver, but with the '.ld' suffix, which contains a space
 # separated list of internal modules to link together during compilation
-$(eval DRIVER_MODULES += $(file <$(1:%.$2=%.ld)))
+$(eval DRIVER_LDVALS  := $(file <$(1:%.$2=%.ld)))
+$(eval DRIVER_LFLAGS  := $(filter -l%,$(DRIVER_LDVALS)))
+$(eval DRIVER_MODULES += $(filter-out -l%,$(DRIVER_LDVALS)))
 
 # List of module archives to link together during compilation
 $(eval DRIVER_ARCHIVES    := $(DRIVER_MODULES:%=%.$($2_AROBJ)))
@@ -271,8 +273,8 @@ $(if $($2_DBG),$(eval MAKE_DIRS += $(DRIVER_TARG_DIR).$($2_DBG)))
 # '_start').  This driver object is then simply linked to its libraries and
 # module archives to create an executable binary in the output folder.
 # ORDER MATTERS HERE, this is for the linker:
-$(eval DRIVER_SRC  := $(DRIVER_DEPS))
-$(eval DRIVER_DBGSRC := $(DRIVER_DBGDEPS))
+$(eval DRIVER_SRC  := $(DRIVER_LFLAGS) $(DRIVER_DEPS))
+$(eval DRIVER_DBGSRC := $(DRIVER_LFLAGS) $(DRIVER_DBGDEPS))
 # Iterate through the list of libraries in our language and stack commands from
 # left to right in the "sources" section of the LD command (or LD section of the
 # commandline for the compiler), to preserve ordering and also ensure that it is