Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. HOST =
  6. DEPFLAGS = -MT $@ -MMD -MP -MF $*.Td
  7. CFILES = $(wildcard ../adplug/*.c) $(wildcard ../libmad/*.c) $(wildcard ../liboggvorbis/src/*.c) $(wildcard ../*.c) em.c
  8. CPPFILES = $(wildcard ../adplug/*.cpp) $(wildcard ../*.cpp) $(wildcard ./*.cpp)
  9. OBJFILES = $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
  10. DEPFILES = $(OBJFILES:.o=.d)
  11. 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)
  12. CPPFLAGS = $(CFLAGS)
  13. 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
  14. POSTCOMPILE = @mv -f $*.Td $*.d && touch $@
  15. %.o: %.c %.d
  16. @echo [CC] $<
  17. @emcc -c $(CFLAGS) -o $@ $<
  18. $(POSTCOMPILE)
  19. %.o: %.cpp %.d
  20. @echo [CC] $<
  21. @em++ -c $(CPPFLAGS) -o $@ $<
  22. $(POSTCOMPILE)
  23. $(TARGET):$(OBJFILES)
  24. @echo [LD] $@
  25. @em++ -o $(TARGET) $(OBJFILES) $(LDFLAGS)
  26. clean:
  27. rm -f $(TARGET) $(EMFILES) $(OBJFILES) $(DEPFILES)
  28. repackage:
  29. rm -f $(TARGET) $(EMFILES)
  30. em++ -o $(TARGET) $(OBJFILES) $(LDFLAGS)
  31. %.d: ;
  32. .PRECIOUS: %.d
  33. -include $(DEPFILES)