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@
11 BIN = src/@PACKAGE_TARNAME@.native@EXE@
12 BYTE = src/@PACKAGE_TARNAME@.byte@EXE@
17 ODEPS = tools/odeps.sh $(OCAMLDEP)
20 OCAMLFLAGS = @OCAMLFLAGS@
21 OCAMLOPTFLAGS = @OCAMLOPTFLAGS@
22 OCAMLCFLAGS = @OCAMLCFLAGS@
23 OCAMLYACC = @OCAMLYACC@
27 tools: tools/xml_diff.native$(EXE) tools/XPathEval.class tools/split_path.native$(EXE)
29 Remakefile: Remakefile.in config.status
30 ./config.status Remakefile
32 configure config.status: configure.in
34 ./config.status --recheck
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' -o -name '*.ml.str' | while read file; do
43 rm -f "${file%.mll}.ml"
46 rm -f "${file%.mly}.ml" "${file%.mly}.mli"
49 rm -f "${file%.ml.str}.ml"
58 distclean: clean test_clean
59 rm -rf config.status configure config.log autom4te.cache .remake Remakefile remake Makefile
64 %.native$(EXE): %.cmx %.depx
65 if test -f $@".flags"; then
66 FLAGS=`cat $@".flags"`
68 objects=`cat $*.depx | xargs | sed 's/[.]depx/.cmx/g'`
69 $(REMAKE) OCAMLNATIVE="-native" $objects #ensure all objects have been built
70 $(OCAMLOPT) -o $@ $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDLINKFLAGS) $(OCAMLFINDFLAGS) $FLAGS $objects $<
72 %.byte$(EXE): %.cmo %.depo
73 objects=`cat $*.depo | xargs | sed 's/[.]depo/.cmo/g'`
74 $(REMAKE) OCAMLNATIVE="" $objects #ensure all objects have been built
75 $(OCAMLC) -o $@ $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDLINKFLAGS) $(OCAMLFINDFLAGS) $objects $<
78 if test -f $*.mly; then
81 elif test -f $*.mll; then
84 elif test -f $*.ml.str; then
86 echo -n 'let content = "' > $*.ml
87 sed -e 's/\(["\\]\)/\\\1/g' $*.ml.str | sed -e 's/^\(.*\)$/\1\\n\\/g' >> $*.ml
97 REMAKE="$(REMAKE) OCAMLNATIVE=$NATIVE"
98 OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)"
100 if test -f "$base".flags; then
101 FLAGS=`cat "$base".flags`
103 COMPILE="$(OCAMLOPT) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDFLAGS) $FLAGS"
104 . tools/ocamldriver.sh
111 REMAKE="$(REMAKE) OCAMLNATIVE=$NATIVE"
112 OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)"
114 COMPILE="$(OCAMLC) $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDFLAGS)"
115 . tools/ocamldriver.sh
120 NATIVE=$(OCAMLNATIVE)
121 REMAKE="$(REMAKE) OCAMLNATIVE=$NATIVE"
122 OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)"
124 if test -z "$NATIVE"; then
126 COMPILE="$(OCAMLC) $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDFLAGS)"
128 COMPILE="$(OCAMLOPT) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDFLAGS)"
131 . tools/ocamldriver.sh
135 test_byte: tools $(BYTE)
136 $(REMAKE) TEST=$(BYTE) real_test
138 test_native: tools $(BIN)
139 $(REMAKE) TEST=$(BIN) real_test
148 $(REMAKE) TEST=$(TEST) "$i".test"$j".summary
153 rm -rf tests/*.summary tests/*.results/*_"$(PACKAGE)"_*.*
162 SPLIT=tools/split_path.native$(EXE)
163 XMLDIFF=tools/xml_diff.native$(EXE)
165 $REMAKE $xml ${xml}.queries tests/${test}.sh