1 ##################################################
2 #Desc: Mihrtec Standard Makefile
5 ##################################################
6 #Application Information
7 ##################################################
8 #Executable name, also passed as -DAPPNAME to compiler
10 #Directory in which we expect to find main()
12 #Compiler flags for the final executable
14 #Object files statically linked for the executable
16 #Dependencies which must be built before the executable
18 ##################################################
20 ##################################################
21 #Functions to export for JS Module
22 EXPORT_FUNCS
:= em_main auth_encrypt
23 #Flags to always run on emcc/em++
26 #Import the build system setup
27 include .make
/build.mk
29 #Directories to be constructed
30 DIRS
:= $(sort $(dir $(APPDEPS
) $(APPTARG
)))
32 #Targets that don't generate a file
33 .PHONY
: $(APPNAME
) run push dox doc
clean scrub
all default
34 #Define default rules to point to APPNAME
35 all default
: $(APPTARG
)
38 $(APPNAME
) $(APPTARG
): $(DIRS
) $(APPDEPS
)
39 $(APPC
) -o
$(APPTARG
) $(APPFLAGS
) $(APPSRC
)
45 #run the game after making it
49 #push to github after successful compile
51 @printf
'\nEnter a commit message:\n'; \
53 git commit
-am
"$$CMT"
59 #clean up intermediate dependency files and binaries
61 @echo
"Cleaning build targets"
62 rm -f
$(APPTARG
) $(WEBTARG
) $(CTARG
)
64 #Scrub down to minimal distribution
67 ################## DEFAULTS #####################
68 #cancel default %.o behavior for %.d dependency
71 #Generate and evaluate C dependencies
72 $(foreach base
,$(basename $(sort $(strip $(CTARG
)))),\
73 $(eval
$(strip $(base
)$(COBJSUF
): $(shell $(subst $BASE,$(base
),$(CDEPSCOMMAND
)))) $(CDEPS
)))
75 #new default C build rule
76 %.bc
%.o
: %.c
$(CDEPS
)
77 $(CC
) $(CXXFLAGS
) $(CFLAGS
) $< -c
-o
$@
79 #construct list of cp rules for each web item
81 $(WEBTARG
): $(subst $(DISTDIR
),$(HTSRCDIR
),$(WEBTARG
))
82 cp
-f
$(subst $(DISTDIR
),$(HTSRCDIR
),$@
) $@
85 #force including rules for making each lib if
86 #we have identified any missing libs
87 #(fail if no rule exists)
89 include $(foreach lib
,$(MISSINGLIBS
),.make
/lib
$(lib
).mk
)