Add missing tests for xmark_0.xml file.
[tatoo.git] / Remakefile.in
1 .OPTIONS = variable-propagation
2 OCAMLFINDPACKAGES = "ulex,unix,expat,camlp4.macro,bigarray"
3 OCAMLFINDSYNTAX = camlp4o
4 OCAMLFINDPPOPTS = $(addprefix "-ppopt ", @CAMLP4FLAGS@ -I include)
5 OCAMLFINDINCLUDES = $(addprefix "-I ", src)
6 OCAMLFINDFLAGS = -syntax $(OCAMLFINDSYNTAX) -package $(OCAMLFINDPACKAGES)  \
7         $(OCAMLFINDPPOPTS) $(OCAMLFINDINCLUDES)
8 OCAMLFINDLINKFLAGS = -linkpkg
9 PACKAGE = @PACKAGE_TARNAME@
10 SRC = src
11 BIN = src/@PACKAGE_TARNAME@.native@EXE@
12 BYTE = src/@PACKAGE_TARNAME@.byte@EXE@
13 EXE = @EXE@
14
15 REMAKE = @REMAKE@
16 OCAMLDEP = @OCAMLDEP@
17 ODEPS = tools/odeps.sh $(OCAMLDEP)
18 OCAMLC = @OCAMLC@
19 OCAMLOPT = @OCAMLOPT@
20 OCAMLFLAGS = @OCAMLFLAGS@
21 OCAMLOPTFLAGS = @OCAMLOPTFLAGS@
22 OCAMLCFLAGS = @OCAMLCFLAGS@
23 OCAMLYACC = @OCAMLYACC@
24
25 all: $(BIN)
26
27 tools: tools/xml_diff.native$(EXE) tools/XPathEval.class tools/split_path.native$(EXE)
28
29 Remakefile: Remakefile.in config.status
30         ./config.status Remakefile
31
32 configure config.status: configure.in
33         autoconf
34         ./config.status --recheck
35
36 clean:
37         for dir in src tools; do
38                 find $dir -name '*.cm*' -o -name '*.o' -o -name '*.byte' -o \
39                           -name '*.native' -o -name '*.mll' -o -name '*.mly' -o \
40                           -name '*.class' -o -name '*.depo' -o -name '*.depx' | while read file; do
41                 case "$file" in
42                         *.mll)
43                                 rm -f "${file%.mll}.ml"
44                         ;;
45                         *.mly)
46                                 rm -f "${file%.mly}.ml" "${file%.mly}.mli"
47                         ;;
48                         *)
49                         rm -f "$file"
50                         ;;
51                 esac
52                 done
53         done
54
55 distclean: clean test_clean
56         rm -rf config.status configure config.log autom4te.cache .remake Remakefile remake Makefile
57
58 %.class: %.java
59         javac $<
60
61 %.native$(EXE): %.cmx %.depx
62         objects=`cat $*.depx | xargs | sed 's/[.]depx/.cmx/g'`
63         $(REMAKE) OCAMLNATIVE="-native" $objects #ensure all objects have been built
64         $(OCAMLOPT) -o $@  $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDLINKFLAGS) $(OCAMLFINDFLAGS) $objects $<
65
66 %.byte$(EXE): %.cmo %.depo
67         objects=`cat $*.depo | xargs | sed 's/[.]depo/.cmo/g'`
68         $(REMAKE) OCAMLNATIVE="" $objects #ensure all objects have been built
69         $(OCAMLC) -o $@  $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDLINKFLAGS) $(OCAMLFINDFLAGS) $objects $<
70
71 %.ml:
72         if test -f $*.mly; then
73                 $(REMAKE) $*.mly
74                 $(OCAMLYACC) $*.mly
75         elif test -f $*.mll; then
76                 $(REMAKE) $*.mll
77                 $(OCAMLLEX) $*.mll
78         fi
79
80 %.cmx %.depx:
81         base=$*
82         target=$@
83         DEPEXT=depx
84         NATIVE=-native
85         REMAKE="$(REMAKE) OCAMLNATIVE=$NATIVE"
86         OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)"
87         SRC=$(SRC)
88         COMPILE="$(OCAMLOPT) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDFLAGS)"
89         . tools/ocamldriver.sh
90
91 %.cmo %.depo:
92         base=$*
93         target=$@
94         DEPEXT=depo
95         NATIVE=""
96         REMAKE="$(REMAKE) OCAMLNATIVE=$NATIVE"
97         OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)"
98         SRC=$(SRC)
99         COMPILE="$(OCAMLC) $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDFLAGS)"
100         . tools/ocamldriver.sh
101
102 %.cmi:
103         base=$*
104         target=$@
105         NATIVE=$(OCAMLNATIVE)
106         REMAKE="$(REMAKE) OCAMLNATIVE=$NATIVE"
107         OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)"
108         SRC=$(SRC)
109         if test -z "$NATIVE"; then
110                 DEPEXT=.depo
111                 COMPILE="$(OCAMLC) $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDFLAGS)"
112         else
113                 COMPILE="$(OCAMLOPT) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDFLAGS)"
114                 DEPEXT=.depx
115         fi
116         . tools/ocamldriver.sh
117
118 ## Tests
119
120 test_byte: tools $(BYTE)
121         $(REMAKE) TEST=$(BYTE) real_test
122
123 test_native: tools $(BIN)
124         $(REMAKE) TEST=$(BIN) real_test
125
126 test: test_native
127
128 real_test:
129         for i in tests/*.xml
130         do
131           for j in 1 2 3
132           do
133                 $(REMAKE) TEST=$(TEST) "$i".test"$j".summary
134           done
135         done
136
137 test_clean:
138         rm -rf tests/*.summary tests/*.results/*_"$(PACKAGE)"_*.*
139
140 %.summary:
141         target=$@
142         base=$*
143         test=${base#*.xml.}
144         xml=${base%.$test}
145         REMAKE=$(REMAKE)
146         BIN=$(TEST)
147         SPLIT=tools/split_path.native$(EXE)
148         XMLDIFF=tools/xml_diff.native$(EXE)
149         PACKAGE=$(PACKAGE)
150         $REMAKE $xml ${xml}.queries tests/${test}.sh
151         rm -f "$target"
152         . tests/${test}.sh