chibicc/Makefile

27 lines
563 B
Makefile
Raw Normal View History

CFLAGS=-std=c11 -g -fno-common
2020-09-04 13:03:01 +03:00
2020-10-07 14:11:16 +03:00
SRCS=$(wildcard *.c)
OBJS=$(SRCS:.c=.o)
2020-09-04 13:03:01 +03:00
TEST_SRCS=$(wildcard test/*.c)
TESTS=$(TEST_SRCS:.c=.exe)
2020-10-07 14:11:16 +03:00
chibicc: $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(OBJS): chibicc.h
2020-09-04 13:03:01 +03:00
test/%.exe: chibicc test/%.c
$(CC) -o- -E -P -C test/$*.c | ./chibicc -o test/$*.s -
$(CC) -o $@ test/$*.s -xc test/common
test: $(TESTS)
for i in $^; do echo $$i; ./$$i || exit 1; echo; done
test/driver.sh
clean:
2020-09-04 13:03:01 +03:00
rm -rf chibicc tmp* $(TESTS) test/*.s test/*.exe
find * -type f '(' -name '*~' -o -name '*.o' ')' -exec rm {} ';'
.PHONY: test clean