X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fwebcc.git;a=blobdiff_plain;f=src%2FMakefile;h=c6262fdbc4acf1e4f95e4211adffbb17a61914c0;hp=4e22f2fc81ddd46ae9d98cdd628dd4084e575f6e;hb=a5c588ba0efe9ab274d1b5b86df3cdfd8de97d4e;hpb=745c7147f006a757c4f4387604c6525ef3768abc diff --git a/src/Makefile b/src/Makefile index 4e22f2f..c6262fd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,7 +8,7 @@ #Executable name, also passed as -DAPPNAME to compiler APPNAME := the_march #Directory in which we expect to find main() -APPSRC := core +APPMODULE := core #Compiler flags for the final executable APPFLAGS := #Object files statically linked for the executable @@ -26,17 +26,20 @@ EMFLAGS := #Import the build system setup include .make/build.mk +#Directories to be constructed +DIRS := $(sort $(dir $(APPDEPS) $(APPTARG))) + #Targets that don't generate a file .PHONY: $(APPNAME) run push dox doc clean scrub all default #Define default rules to point to APPNAME all default: $(APPTARG) #Build the executable -$(APPNAME) $(APPTARG): $(APPDEPS) | $(APPDIRS) - $(CC) -o $(APPTARG) $(APPFLAGS) $(APPDEPS) +$(APPNAME) $(APPTARG): $(DIRS) $(APPDEPS) + $(APPC) -o $(APPTARG) $(APPFLAGS) $(APPSRC) #create directories -$(APPDIRS): +$(DIRS): @mkdir -p $@ #run the game after making it @@ -67,7 +70,7 @@ scrub: | clean #Generate and evaluate C dependencies $(foreach base,$(basename $(sort $(strip $(CTARG)))),\ - $(eval $(strip $(base)$(COBJSUF): $(shell $(subst $BASE,$(base),$(CGENDEP)))))) + $(eval $(strip $(base)$(COBJSUF): $(shell $(subst $BASE,$(base),$(CDEPSCOMMAND)))) $(CDEPS))) #new default C build rule %.bc %.o: %.c $(CDEPS) @@ -75,11 +78,13 @@ $(foreach base,$(basename $(sort $(strip $(CTARG)))),\ #construct list of cp rules for each web item ifdef WEBTARG -$(WEBTARG): $(HTMLDIR)/$(filter-out $(EXEDIR),$@) - cp -f $< $@ +$(WEBTARG): $(subst $(DISTDIR),$(HTSRCDIR),$(WEBTARG)) + cp -f $(subst $(DISTDIR),$(HTSRCDIR),$@) $@ endif -#force including rules for making each lib in this case +#force including rules for making each lib if +#we have identified any missing libs +#(fail if no rule exists) ifdef MISSINGLIBS include $(foreach lib,$(MISSINGLIBS),.make/lib$(lib).mk) endif