X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2FMakefile;h=0db8f54d511017105f573f6f2242f89ea5e5245b;hb=87fd32ed7c5c47b7278300d12bf67c5b46a604a6;hp=0c8a9acd67dd748c3aace06677213a189a977fce;hpb=438a173a61e0b6b62a5dbdda881e9c920df17165;p=rocksndiamonds.git diff --git a/src/Makefile b/src/Makefile index 0c8a9acd..0db8f54d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -31,6 +31,7 @@ endif AR = ar RANLIB = ranlib ETAGS = etags +STRIP = strip RM = rm -f CONVERT = convert @@ -57,6 +58,14 @@ PROGNAME = ../$(PROGBASE).exe EXTRA_LDFLAGS = -lshfolder -lwsock32 endif +ifeq ($(PLATFORM),emscripten) # compiling with Emscripten +PROGNAME = ../$(PROGBASE).js +CC = emcc +AR = emar +RANLIB = emranlib +STRIP = true +endif + ifdef BUILD_DIST # distribution build ifeq ($(shell uname -s),Darwin) # compiling on Mac OS X MAC_TARGET_VERSION_MIN = 10.7 @@ -84,9 +93,17 @@ endif # $(info Using SDL version $(SDL_VERSION) [TARGET == $(TARGET)]) ifeq ($(TARGET),sdl2) # compiling for SDL2 target -SYS_CFLAGS = -DTARGET_SDL2 $(shell sdl2-config --cflags) +ifeq ($(PLATFORM),emscripten) +SDL_LIBS = -s USE_SDL_IMAGE=2 -s USE_SDL_MIXER=2 -s USE_SDL_NET=2 -s USE_ZLIB=1 +SDL_FMTS = -s SDL2_IMAGE_FORMATS='["bmp","png","pcx","xpm"]' +EXTRA_CFLAGS = $(SDL_LIBS) +EXTRA_LDFLAGS = $(SDL_FMTS) -s INITIAL_MEMORY=65536000 -s ALLOW_MEMORY_GROWTH=1 --preload-file ../graphics/ --preload-file ../sounds/ --preload-file ../levels/ --preload-file ../music/ -s NO_EXIT_RUNTIME=0 -s ASYNCIFY -O2 +else SDL_LIBS = -lSDL2_image -lSDL2_mixer -lSDL2_net -SYS_LDFLAGS = $(SDL_LIBS) $(shell sdl2-config --libs) +endif + +SYS_CFLAGS := -DTARGET_SDL2 $(shell sdl2-config --cflags) +SYS_LDFLAGS := $(SDL_LIBS) $(shell sdl2-config --libs) -lm -lz endif @@ -109,22 +126,22 @@ DEBUG = -DDEBUG -g # PROFILING = $(PROFILING_FLAGS) # OPTIONS = $(DEBUG) -Wall # only for debugging purposes -# OPTIONS = $(DEBUG) -O3 -Wall # only for debugging purposes +# OPTIONS = $(DEBUG) -O2 -Wall # only for debugging purposes # OPTIONS = $(DEBUG) -Wall # only for debugging purposes OPTIONS = $(DEBUG) -Wall -Wstrict-prototypes -Wmissing-prototypes # OPTIONS = $(DEBUG) -Wall -ansi -pedantic # only for debugging purposes -# OPTIONS = -O3 -Wall -ansi -pedantic -# OPTIONS = -O3 -Wall -# OPTIONS = -O3 +# OPTIONS = -O2 -Wall -ansi -pedantic +# OPTIONS = -O2 -Wall +# OPTIONS = -O2 ifdef BUILD_DIST # distribution build SYS_LDFLAGS := $(shell echo $(SYS_LDFLAGS) | \ sed -e "s%-rpath,[^ ]*%-rpath,'\$$ORIGIN/lib'%") -OPTIONS = -O3 -Wall +OPTIONS = -O2 -Wall endif CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(EXTRA_CFLAGS) $(CONFIG) -LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) -lm -lz +LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) SRCS = main.c \ @@ -233,7 +250,7 @@ all: $(AUTOCONF) libgame_dir game_em_dir game_sp_dir game_mm_dir $(PROGNAME) gra $(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(COMMIT_HASH_FILE) $(OBJS) $(ICON) $(CC) $(PROFILING) $(OBJS) $(ICON) $(RNDLIBS) $(LDFLAGS) -o $(PROGNAME) ifdef BUILD_DIST - strip $(PROGNAME) + $(STRIP) $(PROGNAME) endif libgame_dir: @@ -316,7 +333,10 @@ clean-ico: clean-bin: $(RM) $(PROGNAME) - $(RM) ../*.exe + $(RM) $(PROGNAME).exe + $(RM) $(PROGNAME).js + $(RM) $(PROGNAME).wasm + $(RM) $(PROGNAME).data clean: clean-obj clean-ico clean-bin