An emulator, assembler, and disassembler for the Sega Game Gear
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Copyright (C) 2014-2015 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. TESTS = cpu vdp psg asm dis integrate
  8. CC = clang
  9. FLAGS = -O2 -Wall -Wextra -pedantic -std=c11
  10. CFLAGS = $(shell sdl2-config --cflags)
  11. LIBS = $(shell sdl2-config --libs)
  12. DFLAGS = -g -DDEBUG_MODE
  13. MKDIR = mkdir -p
  14. RM = rm -rf
  15. ASM_UP = scripts/update_asm_instructions.py
  16. MODE = release
  17. BNRY = $(PROGRAM)
  18. FLGS = $(FLAGS)
  19. SDRS = $(shell find $(SOURCES) -type d | xargs echo)
  20. SRCS = $(filter-out %.inc.c,$(foreach d,. $(SDRS),$(wildcard $(addprefix $(d)/*,.c))))
  21. OBJS = $(patsubst %.c,%.o,$(addprefix $(BUILD)/$(MODE)/,$(SRCS)))
  22. DEPS = $(OBJS:%.o=%.d)
  23. DIRS = $(sort $(dir $(OBJS)))
  24. TCPS = $(addprefix test-,$(TESTS))
  25. ifdef DEBUG
  26. BNRY := $(BNRY)$(DEVEXT)
  27. FLGS += $(DFLAGS)
  28. MODE = debug
  29. endif
  30. export CC
  31. export FLAGS
  32. export RM
  33. .PHONY: all clean test-prereqs test tests $(TCPS)
  34. all: $(BNRY)
  35. clean:
  36. $(RM) $(BUILD) $(PROGRAM) $(PROGRAM)$(DEVEXT)
  37. $(MAKE) -C tests clean
  38. $(DIRS):
  39. $(MKDIR) $@
  40. $(BNRY): $(OBJS)
  41. $(CC) $(FLGS) $(LIBS) $(OBJS) -o $@
  42. $(OBJS): | $(DIRS)
  43. $(BUILD)/$(MODE)/%.o: %.c
  44. $(CC) $(FLGS) $(CFLAGS) -MMD -MP -c $< -o $@
  45. -include $(DEPS)
  46. ASM_INST = $(SOURCES)/assembler/instructions
  47. $(ASM_INST).inc.c: $(ASM_INST).yml $(ASM_UP)
  48. python $(ASM_UP)
  49. test-prereqs:
  50. $(MAKE) $(PROGRAM) DEBUG=
  51. test: test-prereqs
  52. $(MAKE) -C tests all
  53. tests: test
  54. $(TCPS): test-prereqs
  55. $(MAKE) -C tests $(subst test-,,$@)