case's c compiler
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.

Makefile 653B

12345678910111213141516171819202122232425262728293031323334
  1. APP = ccc
  2. CC := gcc
  3. CFLAGS := -Iinclude
  4. LDFLAGS :=
  5. HEADERS := $(shell find include -type f -name '*.h')
  6. CFILES := $(shell find src -type f -name '*.c')
  7. OFILES := $(CFILES:%.c=%.o)
  8. TEST_SRCS := $(shell find test -type f -name '*.c')
  9. TESTS := $(TEST_SRCS:%.c=%)
  10. .PHONY: clean test
  11. $(APP): grammar.c main.c $(OFILES)
  12. $(CC) $(CFLAGS) $(LDFLAGS) $(OFILES) main.c -o $@
  13. grammar.c: grammar.peg
  14. leg -o $@ $<
  15. %.o: %.c $(HEADERS)
  16. $(CC) $(CFLAGS) -c $< -o $@
  17. clean:
  18. find src -type f -name '*.o' -delete
  19. find test -type f -perm +111 -delete
  20. rm -f $(APP) grammar.c
  21. test/%: test/%.c
  22. $(CC) -I. $(CFLAGS) $(OFILES) $< -o $@
  23. ./$@
  24. test: $(APP) $(TESTS)