Makefile 689 字节
Newer Older
E
Emmanuel Leblond 已提交
1
CC   ?= gcc
2

E
Emmanuel Leblond 已提交
3 4 5 6
ifndef V
QUIET_CC         = @echo "CC	$@";
QUIET_MAKE_TESTS = @echo "GN	Alltests.c";
endif
7

E
Emmanuel Leblond 已提交
8
DEPS = $(shell ls ../src/*.[ch])
9

E
Emmanuel Leblond 已提交
10 11
SRC = $(shell ls *.c | sed 's/AllTests.c//')
OBJ = $(SRC:.c=.o)
12

E
Emmanuel Leblond 已提交
13
INCLUDE = -I../src
14 15 16
CFLAGS  += -pipe -ansi -pedantic -Wall -Wextra -g
LDFLAGS +=

E
Emmanuel Leblond 已提交
17
all: check
18

E
Emmanuel Leblond 已提交
19 20
check: testrun
	@./testrun
21

E
Emmanuel Leblond 已提交
22 23
testrun: AllTests.o $(OBJ)
	$(QUIET_CC)$(CC) -o $@ AllTests.o $(OBJ) $(LDFLAGS)
24

E
Emmanuel Leblond 已提交
25 26 27
AllTests.o: $(OBJ)
	$(QUIET_MAKE_TESTS)./make-tests.sh > AllTests.c
	$(QUIET_CC)$(CC) -c -o AllTests.o AllTests.c $(CFLAGS) $(INCLUDE)
28

E
Emmanuel Leblond 已提交
29 30
%.o: %.c $(DEPS)
	$(QUIET_CC)$(CC) -c -o $@ $< $(CFLAGS) $(INCLUDE)
31

E
Emmanuel Leblond 已提交
32 33 34 35
clean veryclean:
	rm -rf AllTests.c
	rm -rf $(OBJ) AllTests.o
	rm -rf testrun