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