Emulator core geared towards emulating ZZT and Super ZZT.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. ifneq (${ARCH},)
  2. BUILDDIR = build/${ARCH}-${PLATFORM}
  3. CC = ${ARCH}gcc
  4. else
  5. BUILDDIR = build/${PLATFORM}
  6. CC = gcc
  7. endif
  8. RESDIR = res
  9. SRCDIR = src
  10. OBJDIR = ${BUILDDIR}/obj
  11. CFLAGS = -g -O3 -flto -std=c18 -Wall
  12. LDFLAGS = -g -O3 -flto -std=c18 -Wall
  13. ifeq (${PLATFORM},mingw32-sdl)
  14. USE_SDL = 1
  15. CC = ${ARCH}-w64-mingw32-gcc
  16. CFLAGS += -mwindows
  17. LIBS = -Wl,-Bstatic -lmingw32 -lwinpthread -lgcc -lSDL2main -lpng -lz -Wl,-Bdynamic -lSDL2 -lopengl32
  18. TARGET = $(BUILDDIR)/zeta86.exe
  19. else ifeq (${PLATFORM},unix-sdl)
  20. USE_SDL = 1
  21. LIBS = -lGL -lSDL2 -lSDL2main -lpng
  22. TARGET = $(BUILDDIR)/zeta86
  23. else ifeq (${PLATFORM},unix-curses)
  24. USE_CURSES = 1
  25. LIBS = -lncursesw
  26. TARGET = $(BUILDDIR)/zeta86
  27. else ifeq (${PLATFORM},wasm)
  28. CC = emcc
  29. CFLAGS = -O3 --js-library src/emscripten_glue.js \
  30. -s WASM_OBJECT_FILES=0 --llvm-lto 1 \
  31. -s ENVIRONMENT=web \
  32. -s 'EXPORTED_FUNCTIONS=["_malloc","_free"]' \
  33. -s 'EXTRA_EXPORTED_RUNTIME_METHODS=["AsciiToString"]' \
  34. -s MODULARIZE=1 -s 'EXPORT_NAME="ZetaNative"' \
  35. -s ALLOW_MEMORY_GROWTH=0 -s ASSERTIONS=0 \
  36. -s 'MALLOC="emmalloc"' -s NO_FILESYSTEM=1 \
  37. -s TOTAL_MEMORY=4194304 -s TOTAL_STACK=262144 \
  38. -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE="[]" \
  39. -DNO_MEMSET
  40. LDFLAGS = ${CFLAGS}
  41. TARGET = $(BUILDDIR)/zeta_native.js
  42. else
  43. $(error Please specify PLATFORM: mingw32-sdl, unix-curses, unix-sdl, wasm)
  44. endif
  45. OBJS = $(OBJDIR)/8x14.o \
  46. \
  47. $(OBJDIR)/cpu.o \
  48. $(OBJDIR)/zzt.o \
  49. $(OBJDIR)/audio_stream.o \
  50. $(OBJDIR)/audio_shared.o
  51. ifeq (${USE_SDL},1)
  52. OBJS += $(OBJDIR)/asset_loader.o \
  53. $(OBJDIR)/audio_writer.o \
  54. $(OBJDIR)/posix_vfs.o \
  55. $(OBJDIR)/render_software.o \
  56. $(OBJDIR)/screenshot_writer.o \
  57. $(OBJDIR)/util.o \
  58. $(OBJDIR)/sdl/frontend.o \
  59. $(OBJDIR)/sdl/render_software.o \
  60. $(OBJDIR)/sdl/render_opengl.o
  61. else ifeq (${USE_CURSES},1)
  62. OBJS += $(OBJDIR)/frontend_curses.o \
  63. $(OBJDIR)/asset_loader.o \
  64. $(OBJDIR)/posix_vfs.o
  65. endif
  66. all: $(TARGET)
  67. $(TARGET): $(OBJS)
  68. @mkdir -p $(@D)
  69. $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
  70. $(OBJDIR)/%.o: $(SRCDIR)/%.c
  71. @mkdir -p $(@D)
  72. $(CC) $(CFLAGS) -c -o $@ $<
  73. $(OBJDIR)/8x14.o: $(OBJDIR)/8x14.c
  74. @mkdir -p $(@D)
  75. $(CC) -g -c -o $@ $<
  76. $(OBJDIR)/8x14.c: $(RESDIR)/8x14.bin
  77. @mkdir -p $(@D)
  78. xxd -i $< > $@
  79. .PHONY: clean
  80. clean:
  81. rm -f $(OBJS) $(TARGET)