Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Adapted from Makefile for Dingux by palxex
  2. # note: only works in chrome now, and audio not works now.
  3. TARGET = sdlpal.html
  4. EMFILES = sdlpal.{html,js,mem,data,bc,wast,wasm}
  5. INTER=.emscripten
  6. HOST =
  7. DEPFLAGS = -MT $@ -MMD -MP -MF $*$(INTER).Td
  8. CFILES = $(wildcard ../adplug/*.c) $(wildcard ../libmad/*.c) $(wildcard ../liboggvorbis/src/*.c) $(wildcard ../*.c) em.c
  9. CPPFILES = $(wildcard ../adplug/*.cpp) $(wildcard ../*.cpp) $(wildcard ./*.cpp)
  10. OBJFILES = $(CFILES:.c=$(INTER).o) $(CPPFILES:.cpp=$(INTER).o)
  11. DEPFILES = $(OBJFILES:.o=.d)
  12. CFLAGS = -I${EMSCRIPTEN_TOOLCHAIN}/include/SDL2 -g -Wall -Oz -fno-strict-aliasing -I. -I../ -I../liboggvorbis/include -I../liboggvorbis/src -DPAL_HAS_PLATFORM_SPECIFIC_UTILS $(DEPFLAGS)
  13. CPPFLAGS = $(CFLAGS)
  14. override LDFLAGS += -Oz -L${EMSCRIPTEN_TOOLCHAIN}/lib -lSDL2 -lm -lstdc++ --preload-file data -s TOTAL_MEMORY=134217728 -s TOTAL_STACK=5242880 --emrun -s DEMANGLE_SUPPORT=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s 'EMTERPRETIFY_FILE="sdlpal.bc"' -s WASM=1
  15. POSTCOMPILE = @mv -f $*$(INTER).Td $*$(INTER).d && touch $@
  16. %$(INTER).o: %.c %$(INTER).d
  17. @echo [CC] $<
  18. @emcc -c $(CFLAGS) -o $@ $<
  19. $(POSTCOMPILE)
  20. %$(INTER).o: %.cpp %$(INTER).d
  21. @echo [CC] $<
  22. @em++ -c $(CPPFLAGS) -o $@ $<
  23. $(POSTCOMPILE)
  24. $(TARGET):$(OBJFILES)
  25. @echo [LD] $@
  26. @em++ -o $(TARGET) $(OBJFILES) $(LDFLAGS)
  27. clean:
  28. rm -f $(TARGET) $(EMFILES) $(OBJFILES) $(DEPFILES)
  29. repackage:
  30. rm -f $(TARGET) $(EMFILES)
  31. em++ -o $(TARGET) $(OBJFILES) $(LDFLAGS)
  32. %.d: ;
  33. .PRECIOUS: %.d
  34. -include $(DEPFILES)