mirror of https://github.com/rui314/chibicc
27 lines
563 B
Makefile
27 lines
563 B
Makefile
CFLAGS=-std=c11 -g -fno-common
|
|
|
|
SRCS=$(wildcard *.c)
|
|
OBJS=$(SRCS:.c=.o)
|
|
|
|
TEST_SRCS=$(wildcard test/*.c)
|
|
TESTS=$(TEST_SRCS:.c=.exe)
|
|
|
|
chibicc: $(OBJS)
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
|
|
$(OBJS): chibicc.h
|
|
|
|
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:
|
|
rm -rf chibicc tmp* $(TESTS) test/*.s test/*.exe
|
|
find * -type f '(' -name '*~' -o -name '*.o' ')' -exec rm {} ';'
|
|
|
|
.PHONY: test clean
|