Game Boy assembler.
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.
 
 
 
 
 
 

88 lines
1.9 KiB

  1. CXXFLAGS += -ggdb -Wextra -Wall -std=c++17
  2. LDFLAGS += -ggdb -Wextra -Wall -std=c++17
  3. EXE_SRC = src/main.cpp
  4. EXE = gbas
  5. TEST_EXE = gbas_test
  6. SRCS = src/tokenizer.cpp \
  7. src/parser.cpp \
  8. src/assembler.cpp \
  9. src/elf.cpp \
  10. src/elf_writer.cpp \
  11. src/elf_reader.cpp \
  12. OBJS = $(patsubst %.cpp,build/%.o,$(notdir $(SRCS)))
  13. DEPS = $(OBJS:.o=.d)
  14. COVS = $(OBJS:.o=.gcda) $(OBJS:.o=.gcno)
  15. EXE_OBJS = $(OBJS) $(patsubst %.cpp,build/%.o,$(notdir $(EXE_SRC)))
  16. INC = -Iinclude -Ilib/expected/include
  17. TEST_SRCS = test/char_utils_test.cpp \
  18. test/tokenizer_test.cpp \
  19. test/parser_test.cpp \
  20. test/assembler_test.cpp \
  21. test/elf_test.cpp \
  22. TEST_OBJS = $(patsubst %.cpp,build/%.o,$(notdir $(TEST_SRCS)))
  23. TEST_DEPS = $(TEST_OBJS:.o=.d)
  24. TEST_COVS = $(TEST_OBJS:.o=.gcno) \
  25. $(TEST_OBJS:.o=.gcda)
  26. $(EXE): $(EXE_OBJS)
  27. $(CXX) $(LDFLAGS) -o [email protected] $^
  28. .PHONY: test
  29. test: $(TEST_EXE)
  30. test: CXXFLAGS += -Itest
  31. $(TEST_EXE): $(OBJS) $(TEST_OBJS)
  32. $(CXX) $(LDFLAGS) -o [email protected] $^ -lboost_unit_test_framework
  33. .PHONY: check
  34. check: CXXFLAGS += -Itest
  35. check: $(TEST_EXE)
  36. ifdef CHECK_LOG
  37. -./$(TEST_EXE) $(CHECK_OPTIONS) > $(CHECK_LOG)
  38. else
  39. -./$(TEST_EXE) $(CHECK_OPTIONS)
  40. endif
  41. build/%.o: src/%.cpp Makefile
  42. mkdir -p build
  43. $(CXX) -MD -c $(CXXFLAGS) $(INC) -o [email protected] $<
  44. build/%.o: test/%.cpp Makefile
  45. mkdir -p build
  46. $(CXX) -MD -c $(CXXFLAGS) $(INC) -o [email protected] $<
  47. .PHONY: clean
  48. clean:
  49. rm -f $(OBJS) $(DEPS) $(EXE) $(TEST_OBJS) $(TEST_DEPS) $(TEST_EXE)
  50. rm -rf coverage/ coverage.info $(COVS) $(TEST_COVS)
  51. .PHONY: distclean
  52. distclean: clean
  53. rm -rf docs
  54. .PHONY: ctags
  55. ctags:
  56. ctags -R src include test
  57. .PHONY: doxygen
  58. doxygen:
  59. doxygen Doxyfile
  60. .PHONY: coverage
  61. coverage: CXXFLAGS += --coverage
  62. coverage: LDFLAGS += --coverage
  63. coverage: check
  64. lcov --capture --directory . --output-file coverage.info
  65. genhtml coverage.info --output-directory coverage/
  66. -include $(DEPS) $(TEST_DEPS)