Makefile 686 字节
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 14 15 16
INCLUDE = -I../src
CFLAGS  = -pipe -ansi -pedantic -Wall -Wextra -g
LDFLAGS =
all: check
17

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

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

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

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

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