tidy code
[tinycc.git] / tests / pp / Makefile
blob4785db3b906bc9db6b9b780af871e6307e70f84f
2 # credits: 01..13.c from the pcc cpp-tests suite
5 TOP = ../..
6 include $(TOP)/Makefile
7 SRC = $(TOPSRC)/tests/pp
8 VPATH = $(SRC)
10 files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1)))
11 TESTS = $(call files,c) $(call files,S)
13 all test testspp.all: $(sort $(TESTS))
15 DIFF_OPTS = -Nu -b -B
17 # Filter source directory in warnings/errors (out-of-tree builds)
18 FILTER = 2>&1 | sed 's,$(SRC)/,,g'
20 %.test: %.c %.expect
21 @echo PPTest $* ...
22 -@$(TCC) -E -P $< $(FILTER) >$*.output 2>&1 ; \
23 diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
24 && rm -f $*.output
26 %.test: %.S %.expect
27 @echo PPTest $* ...
28 -@$(TCC) -E -P $< $(FILTER) >$*.output 2>&1 ; \
29 diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
30 && rm -f $*.output
32 testspp.%: %.test ;
34 # automatically generate .expect files with gcc:
35 %.expect: # %.c
36 gcc -E -P $*.[cS] >$*.expect 2>&1
38 # tell make not to delete
39 .PRECIOUS: %.expect
41 clean:
42 rm -f *.output
44 02.test : DIFF_OPTS += -w
45 # 15.test : DIFF_OPTS += -I"^XXX:"
47 # diff options:
48 # -b ighore space changes
49 # -w ighore all whitespace
50 # -B ignore blank lines
51 # -I <RE> ignore lines matching RE