initial
[prop.git] / tests / Makefile
blobae70901bb8499e0a9028983d00516f0f68034733
1 ##############################################################################
2 # Makefile for compiling the sample programs in this directory
3 # You *must* have prop and adlib already compiled.
4 ##############################################################################
7 # C++ compiler setup (assume gcc)
9 CC = g++
10 CINCLUDE= -I../include
11 COPTS = -O6 -pedantic
12 LDOPTS = -lg++
13 CFLAGS = $(COPTS) $(CINCLUDE)
14 LDFLAGS = -L../lib -lprop $(LDOPTS)
15 RM = /bin/rm
18 # The executable. I assume you have set up the directory hierarchy
19 # the same way I do.
21 PROP = ../bin/prop
25 # Options to prop
26 # -l generate no #line directives
27 # -f generate fast tables
28 # -r generate a long report listing
30 PROP_OPTS= -report
33 # The sample source
35 PROP_SRC= inference.pcc rewriting2.pcc rewriting3.pcc \
36 rewriting5.pcc rewriting6.pcc rewriting7.pcc \
37 logical_patterns.pcc \
38 regexp.pcc list1.pcc list2.pcc printer1.pcc \
39 poly2.pcc \
40 persist1.pcc persist2.pcc persist3.pcc \
41 tuple.pcc insertion_sort.pcc merge_sort.pcc bubble_sort.pcc \
42 test_gc2.pcc test_gc3.pcc test_gc4.pcc \
43 test_gc5.pcc \
44 test_gc9.pcc test_gc10.pcc test_gc11.pcc \
45 test_gc12.pcc test_gc18.pcc \
46 prop1.pcc prop2.pcc prop3.pcc prop4.pcc prop5.pcc prop6.pcc \
47 prop7.pcc prop8.pcc prop9.pcc
50 # Generated C++ source from prop
52 SRC = $(PROP_SRC:.pcc=.cc)
55 # Compiled demo programs
57 PROGS= inference logical_patterns \
58 qa1 qa2 qa3 qa5 qa6 qa7 qa8 \
59 rewriting2 rewriting3 rewriting5 rewriting6 rewriting7 \
60 regexp list1 list2 printer1 \
61 poly2 \
62 persist1 persist2 persist3 \
63 tuple insertion_sort merge_sort bubble_sort \
64 test_gc1 test_gc2 test_gc3 test_gc4 test_gc5 test_gc6 test_gc7 \
65 test_gc8 test_gc9 test_gc10 test_gc11 test_gc12 test_gc13 test_gc14 \
66 test_gc15 test_gc16 test_gc17 test_gc18 test_gc19 test_gc20 \
67 test_gc21 test_gc22 test_gc23 test_gc24 \
68 prop1 prop2 prop3 prop4 prop5 prop6 prop7 prop8 prop9
71 # Prop's output log
73 PROP_LOG= rewriting.report rewriting2.report rewriting3.report
77 # Various rules
80 build: $(SRC) $(PROGS)
81 @echo Done.
82 clean:
83 $(RM) -f $(SRC) *.report
84 spotless: clean
85 $(RM) -f $(PROP_LOG) $(PROGS)
86 test: build run-tests
87 run-tests:
88 >TESTLOG
89 FAILED=0; \
90 for p in $(PROGS); do \
91 echo "[Running $$p]"; \
92 (echo "20" | ./$$p); \
93 if [ $$? != 0 ]; then \
94 FAILED=1; \
95 echo "[$$p has failed.]"; \
96 echo "$$p has failed." >>TESTLOG; \
97 fi; \
98 done; \
99 if [ $$FAILED = 1 ]; then \
100 echo "See TESTLOG for failed tests."; \
101 exit 1; \
102 else \
103 echo "All tests ran successfully."; \
106 prop4.cc: prop4.pcc $(PROP)
107 $(PROP) $(PROP_OPTS) -save_space -O15 $(@:.cc=.pcc)
108 %.cc: %.pcc $(PROP)
109 $(PROP) $(PROP_OPTS) $(@:.cc=.pcc)
110 %.h: %.ph $(PROP)
111 $(PROP) $(PROP_OPTS) $(@:.h=.ph)
112 prop3: prop3.cc ../lib/libprop.a
113 $(CC) $(CFLAGS) -fno-implicit-templates -o $@ $@.cc $(LDFLAGS)
114 strip $@
115 prop4: prop4.cc ../lib/libprop.a
116 $(CC) $(CFLAGS) -fno-implicit-templates -o $@ $@.cc $(LDFLAGS)
117 strip $@
118 %: %.cc ../lib/libprop.a
119 $(CC) $(CFLAGS) -o $@ $@.cc $(LDFLAGS)
120 strip $@