tests: OOT build fixes etc.
[tinycc.git] / tests / pp / Makefile
blob0b96caa9402ca45f688b562fcaa558eef4a86624
2 # credits: 01..13.c from the pcc cpp-tests suite
5 TOP = ../..
6 include $(TOP)/config.mak
7 SRC = $(TOPSRC)/tests/pp
8 VPATH = $(SRC)
10 TCC = ../../tcc
11 files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1)))
12 TESTS = $(call files,c) $(call files,S)
14 all test : $(sort $(TESTS))
16 DIFF_OPTS = -Nu -b -B -I "^\#"
18 # Filter source directory in warnings/errors (out-of-tree builds)
19 FILTER = 2>&1 | sed 's,$(SRC)/,,g'
21 %.test: %.c %.expect
22 @echo PPTest $* ...
23 -@$(TCC) -E -P $< $(FILTER) >$*.output 2>&1 ; \
24 diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
25 && rm -f $*.output
27 %.test: %.S %.expect
28 @echo PPTest $* ...
29 -@$(TCC) -E -P $< $(FILTER) >$*.output 2>&1 ; \
30 diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
31 && rm -f $*.output
33 # automatically generate .expect files with gcc:
34 %.expect: %.c
35 gcc -E -P $< >$*.expect 2>&1
37 %.expect: %.S
38 gcc -E -P $< >$*.expect 2>&1
40 # tell make not to delete
41 .PRECIOUS: %.expect
43 clean:
44 rm -f *.output
46 02.test : DIFF_OPTS += -w
47 15.test : DIFF_OPTS += -I"^XXX:"
49 # diff options:
50 # -b ighore space changes
51 # -w ighore all whitespace
52 # -B ignore blank lines
53 # -I <RE> ignore lines matching RE