################################################## #Desc: Mihrtec Standard Makefile #Author: Mihrtec LLC #Date: 2016 ################################################## #Application Information ################################################## #Executable name, also passed as -DAPPNAME to compiler APPNAME := the_march #Directory in which we expect to find main() APPMODULE := core #Compiler flags for the final executable APPFLAGS := #Object files statically linked for the executable APPOBJ := #Dependencies which must be built before the executable APPDEPS := ################################################## #Emscripten Info ################################################## #Functions to export for JS Module EXPORT_FUNCS := em_main auth_encrypt #Flags to always run on emcc/em++ 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): $(DIRS) $(APPDEPS) $(APPC) -o $(APPTARG) $(APPFLAGS) $(APPSRC) #create directories $(DIRS): @mkdir -p $@ #run the game after making it run: $(APPNAME) $(APPTARG) #push to github after successful compile push: $(APPTARG) @printf '\nEnter a commit message:\n'; \ read CMT; \ git commit -am "$$CMT" git push dox doc: doxygen dox.conf #clean up intermediate dependency files and binaries clean: @echo "Cleaning build targets" rm -f $(APPTARG) $(WEBTARG) $(CTARG) #Scrub down to minimal distribution scrub: | clean ################## DEFAULTS ##################### #cancel default %.o behavior for %.d dependency %.o : %.c #Generate and evaluate C dependencies $(foreach base,$(basename $(sort $(strip $(CTARG)))),\ $(eval $(strip $(base)$(COBJSUF): $(shell $(subst $BASE,$(base),$(CDEPSCOMMAND)))) $(CDEPS))) #new default C build rule %.bc %.o: %.c $(CDEPS) $(CC) $(CXXFLAGS) $(CFLAGS) $< -c -o $@ #construct list of cp rules for each web item ifdef WEBTARG $(WEBTARG): $(subst $(DISTDIR),$(HTSRCDIR),$(WEBTARG)) cp -f $(subst $(DISTDIR),$(HTSRCDIR),$@) $@ endif #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 #include rules for making each app ifdef APPTARGS include $(foreach app,$(APPTARGS),.make/app$(app).mk) endif