An emulator, assembler, and disassembler for the Sega Game Gear
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

makefile 1.3 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. # Released under the terms of the MIT License. See LICENSE for details.
  3. PROGRAM = crater
  4. SOURCES = src
  5. BUILD = build
  6. DEVEXT = -dev
  7. CC = clang
  8. FLAGS = -O2 -Wall -Wextra -pedantic -std=c11
  9. CFLAGS = $(shell sdl2-config --cflags)
  10. LIBS = $(shell sdl2-config --libs)
  11. MKDIR = mkdir -p
  12. RM = rm -rf
  13. MODE = release
  14. BNRY = $(PROGRAM)
  15. SDRS = $(shell find $(SOURCES) -type d | xargs echo)
  16. SRCS = $(filter-out %.inc.c,$(foreach d,. $(SDRS),$(wildcard $(addprefix $(d)/*,.c))))
  17. OBJS = $(patsubst %.c,%.o,$(addprefix $(BUILD)/$(MODE)/,$(SRCS)))
  18. DEPS = $(OBJS:%.o=%.d)
  19. DIRS = $(sort $(dir $(OBJS)))
  20. ifdef DEBUG
  21. BNRY := $(BNRY)$(DEVEXT)
  22. FLAGS += -g -fsanitize=address -DDEBUG_MODE
  23. MODE = debug
  24. endif
  25. .PHONY: all clean test test-all test-z80 test-asm test-dasm
  26. all: $(BNRY)
  27. clean:
  28. $(RM) $(BUILD) $(PROGRAM) $(PROGRAM)$(DEVEXT)
  29. $(DIRS):
  30. $(MKDIR) $@
  31. $(BNRY): $(OBJS)
  32. $(CC) $(FLAGS) $(LIBS) $(OBJS) -o $@
  33. $(OBJS): | $(DIRS)
  34. $(BUILD)/$(MODE)/%.o: %.c
  35. $(CC) $(FLAGS) $(CFLAGS) -MMD -MP -c $< -o $@
  36. -include $(DEPS)
  37. test: test-all test-z80 test-asm test-dasm
  38. test-all:
  39. @echo "running all tests"
  40. test-z80:
  41. @echo "running Z80 CPU tests"
  42. test-asm:
  43. @echo "running assembler tests"
  44. test-dasm:
  45. @echo "running disassembler tests"