# Copied from projects/make and modified for emscripten DEFINES += -DWREN_OPT_RANDOM -DWREN_OPT_META -DWREN_TRY LDFLAGS += -s WASM=1 -s FILESYSTEM=0 -s EXIT_RUNTIME=0 -s ENVIRONMENT='web' LDFLAGS += -s EXPORTED_FUNCTIONS='["_main", "_wren_compile"]' LDFLAGS += -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' ifndef config config=release_32bit endif ifndef verbose SILENT = @ endif .PHONY: clean prebuild SHELLTYPE := posix ifeq (.exe,$(findstring .exe,$(ComSpec))) SHELLTYPE := msdos endif # Configurations # ############################################# RESCOMP = windres INCLUDES += -I../../src/include FORCE_INCLUDE += ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) LINKCMD = $(CC) -o "$@.html" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) define PREBUILDCMDS endef define PRELINKCMDS endef define POSTBUILDCMDS endef ifeq ($(config),release_32bit) TARGETDIR = ../../bin TARGET = $(TARGETDIR)/wren_try OBJDIR = obj/32bit/Release/wren_try DEFINES += -DNDEBUG ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -std=c99 ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 LIBS += ../../lib/libwren.bc -lm LDDEPS += ../../lib/libwren.bc ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s else ifeq ($(config),debug_32bit) TARGETDIR = ../../bin TARGET = $(TARGETDIR)/wren_try_d OBJDIR = obj/32bit/Debug/wren_try DEFINES += -DDEBUG ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g -std=c99 ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -g LIBS += ../../lib/libwren_d.bc -lm LDDEPS += ../../lib/libwren_d.bc ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 else $(error "invalid configuration $(config)") endif # Per File Configurations # ############################################# # File sets # ############################################# OBJECTS := OBJECTS += $(OBJDIR)/main.try.o OBJECTS += $(OBJDIR)/test.o # Rules # ############################################# all: $(TARGET) @: $(TARGET): $(OBJECTS) $(LDDEPS) | $(TARGETDIR) $(PRELINKCMDS) @echo Linking wren_try $(SILENT) $(LINKCMD) $(POSTBUILDCMDS) $(TARGETDIR): @echo Creating $(TARGETDIR) ifeq (posix,$(SHELLTYPE)) $(SILENT) mkdir -p $(TARGETDIR) else $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) endif $(OBJDIR): @echo Creating $(OBJDIR) ifeq (posix,$(SHELLTYPE)) $(SILENT) mkdir -p $(OBJDIR) else $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) endif clean: @echo Cleaning wren_try ifeq (posix,$(SHELLTYPE)) $(SILENT) rm -f $(TARGET) $(SILENT) rm -rf $(OBJDIR) else $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) endif prebuild: | $(OBJDIR) $(PREBUILDCMDS) ifneq (,$(PCH)) $(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) $(GCH): $(PCH) | prebuild @echo $(notdir $<) $(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" $(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) ifeq (posix,$(SHELLTYPE)) $(SILENT) touch "$@" else $(SILENT) echo $null >> "$@" endif else $(OBJECTS): | prebuild endif # File Rules # ############################################# $(OBJDIR)/main.try.o: ../main.try.c @echo $(notdir $<) $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" $(OBJDIR)/test.o: ../../test/test.c @echo $(notdir $<) $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -include $(OBJECTS:%.o=%.d) ifneq (,$(PCH)) -include $(PCH_PLACEHOLDER).d endif