APPNAME := the_march
MODULES := core
CFLAGS := -Wall
+
+#Additional deps and flags for the final executable file
+APP_FLAGS :=
APP_RULES :=
+
+#Extra cleanup rules
CLEAN_RULES :=
SCRUB_RULES :=
#Emscripten build environment
APP_RULES += move
HTML := index.html js/the_march.config.js js/auth.js
+EXPORTS := '_em_main', 'auth_encrypt'
CC := emcc
-EXPORTS := '_em_main', 'encrypt_password'
-EMOPTS := --verbose --separate-asm -s ALLOW_MEMORY_GROWTH=1 -s FORCE_FILESYSTEM=1 --pre-js html/js/pre.js
-LIBS += -s USE_SDL=2 -s USE_SDL_TTF=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]'
+EMFLAGS := -I../extern/include
+EMFLAGS += -s USE_SDL=2 -s USE_SDL_TTF=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]'
+APP_FLAGS += --separate-asm -s ALLOW_MEMORY_GROWTH=1 -s FORCE_FILESYSTEM=1 --pre-js html/js/pre.js
+APP_FLAGS += -s EXPORTED_FUNCTIONS="[$(EXPORTS)]"
EXEPATH := ../dist/bin/jasm/js
EXE := $(APPNAME).js
OBJFILE :=bc
-EMFLAGS := $(EMOPTS) -s EXPORTED_FUNCTIONS="[$(EXPORTS)]"
-EMFLAGS += -I/usr/include/google
+EMFLAGS += -I/usr/include/google -I../extern/include
BYPRODUCT := $(APPNAME).asm.js $(APPNAME).js.mem
+APP_FLAGS += $(EMFLAGS) ../extern/lib/libwolfssl.so
else
#Native Build Environment
CC := gcc
-CFLAGS += -v
+CFLAGS +=
#LIBS := -lprotobuf-c
-LIBS += -lSDL2_ttf -lSDL2_image -lSDL2main -lSDL2
+LIBS += SDL2_ttf SDL2_image SDL2main SDL2
EXEPATH := ../dist/bin/$(shell uname -m)
#windows mingw build rules
ifeq ($(OS), Windows_NT)
#include rules from any .mk file found in a module directory
include $(wildcard $(patsubst %,%/*.mk,$(MODULES)))
+CFLAGS += $(patsubst %,-l% ,$(LIBS))
+
#populate C objects and dependency files to generate from SRC
COBJ += $(patsubst %.c,%.$(OBJFILE), $(filter %.c,$(SRC)))
CDEP += $(COBJ:.$(OBJFILE)=.d)
#Build the executable
$(APPNAME): $(APP_RULES) $(CDEP) $(COBJ)
@mkdir -p $(EXEPATH)
- $(CC) -o $(EXEPATH)/$(EXE) $(EMFLAGS) $(CXXFLAGS) $(CFLAGS) core/main.$(OBJFILE) $(LIBS)
+ $(CC) -o $(EXEPATH)/$(EXE) $(CXXFLAGS) $(CFLAGS) $(APP_FLAGS) core/main.$(OBJFILE)
#run the game after making it
run: $(APPNAME)
#new default .o for .c files
%.bc %.o: %.c %.d
- $(CC) -c $(EMFLAGS) $(CPPFLAGS) $(CFLAGS) $< -o $@ $(LIBS)
+ $(CC) -c $(EMFLAGS) $(CPPFLAGS) $(CFLAGS) $< -o $@
#default for .d dependency files (output from gcc -M)
%.d: %.c