psx emulator
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.

27 lines
613 B

3 years ago
3 years ago
3 years ago
3 years ago
  1. CFLAGS ?= -Wall -Wextra -Iinclude
  2. HFILES := $(shell find include -type f -name '*.h')
  3. CFILES := $(shell find src -type f -name '*.c')
  4. OFILES := $(CFILES:%.c=%.o)
  5. TESTFILES := $(shell find test -type f -name '*.c' -not -name runner.c)
  6. TESTS := $(TESTFILES:%.c=%)
  7. .PHONY: clean test
  8. psxc: $(OFILES)
  9. $(CC) $(OFILES) -o $@
  10. test/%: test/%.c $(HFILES) $(OFILES)
  11. $(CC) -Wno-unused-parameter $(CFLAGS) $(filter-out src/main.o, $(OFILES)) test/runner.c $< -o $@
  12. %.o: %.c $(HFILES)
  13. $(CC) $(CFLAGS) -c $< -o $@
  14. clean:
  15. rm -f $(OFILES) $(TESTS) psxc
  16. test: $(TESTS)
  17. @for TEST in $(TESTS); do \
  18. ./$$TEST; \
  19. done