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.2 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 src/assembler
  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. SRCS = $(filter-out %.inc.c,$(foreach d,. $(SOURCES),$(wildcard $(addprefix $(d)/*,.c))))
  16. OBJS = $(patsubst %.c,%.o,$(addprefix $(BUILD)/$(MODE)/,$(SRCS)))
  17. DEPS = $(OBJS:%.o=%.d)
  18. DIRS = $(sort $(dir $(OBJS)))
  19. ifdef DEBUG
  20. BNRY := $(BNRY)$(DEVEXT)
  21. FLAGS += -g -fsanitize=address -DDEBUG_MODE
  22. MODE = debug
  23. endif
  24. .PHONY: all clean test test-all test-z80 test-asm test-dasm
  25. all: $(BNRY)
  26. clean:
  27. $(RM) $(BUILD) $(PROGRAM) $(PROGRAM)$(DEVEXT)
  28. $(DIRS):
  29. $(MKDIR) $@
  30. $(BNRY): $(OBJS)
  31. $(CC) $(FLAGS) $(LIBS) $(OBJS) -o $@
  32. $(OBJS): | $(DIRS)
  33. $(BUILD)/$(MODE)/%.o: %.c
  34. $(CC) $(FLAGS) $(CFLAGS) -MMD -MP -c $< -o $@
  35. -include $(DEPS)
  36. test: test-all test-z80 test-asm test-dasm
  37. test-all:
  38. @echo "running all tests"
  39. test-z80:
  40. @echo "running Z80 CPU tests"
  41. test-asm:
  42. @echo "running assembler tests"
  43. test-dasm:
  44. @echo "running disassembler tests"