.OPTIONS = variable-propagation OCAMLFINDPACKAGES = "ulex,unix,expat,camlp4.macro,bigarray" OCAMLFINDSYNTAX = camlp4o OCAMLFINDPPOPTS = $(addprefix "-ppopt ", @CAMLP4FLAGS@ -I include) OCAMLFINDINCLUDES = $(addprefix "-I ", src) OCAMLFINDFLAGS = -syntax $(OCAMLFINDSYNTAX) -package $(OCAMLFINDPACKAGES) \ $(OCAMLFINDPPOPTS) $(OCAMLFINDINCLUDES) OCAMLFINDLINKFLAGS = -linkpkg PACKAGE = @PACKAGE_TARNAME@ SRC = src BIN = src/@PACKAGE_TARNAME@.native@EXE@ BYTE = src/@PACKAGE_TARNAME@.byte@EXE@ EXE = @EXE@ REMAKE = @REMAKE@ OCAMLDEP = @OCAMLDEP@ ODEPS = tools/odeps.sh $(OCAMLDEP) OCAMLC = @OCAMLC@ OCAMLOPT = @OCAMLOPT@ OCAMLFLAGS = @OCAMLFLAGS@ OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ OCAMLCFLAGS = @OCAMLCFLAGS@ OCAMLYACC = @OCAMLYACC@ all: $(BIN) tools: tools/xml_diff.native$(EXE) tools/XPathEval.class tools/split_path.native$(EXE) Remakefile: Remakefile.in config.status ./config.status Remakefile configure config.status: configure.in autoconf ./config.status --recheck clean: for dir in src tools; do find $dir -name '*.cm*' -o -name '*.o' -o -name '*.byte' -o \ -name '*.native' -o -name '*.mll' -o -name '*.mly' -o \ -name '*.class' -o -name '*.depo' -o -name '*.depx' -o -name '*.ml.str' | while read file; do case "$file" in *.mll) rm -f "${file%.mll}.ml" ;; *.mly) rm -f "${file%.mly}.ml" "${file%.mly}.mli" ;; *.ml.str) rm -f "${file%.ml.str}.ml" ;; *) rm -f "$file" ;; esac done done distclean: clean test_clean rm -rf config.status configure config.log autom4te.cache .remake Remakefile remake Makefile %.class: %.java javac $< %.native$(EXE): %.cmx %.depx if test -f $@".flags"; then FLAGS=`cat $@".flags"` fi objects=`cat $*.depx | xargs | sed 's/[.]depx/.cmx/g'` $(REMAKE) OCAMLNATIVE="-native" $objects #ensure all objects have been built $(OCAMLOPT) -o $@ $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDLINKFLAGS) $(OCAMLFINDFLAGS) $FLAGS $objects $< %.byte$(EXE): %.cmo %.depo objects=`cat $*.depo | xargs | sed 's/[.]depo/.cmo/g'` $(REMAKE) OCAMLNATIVE="" $objects #ensure all objects have been built $(OCAMLC) -o $@ $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDLINKFLAGS) $(OCAMLFINDFLAGS) $objects $< %.ml: if test -f $*.mly; then $(REMAKE) $*.mly $(OCAMLYACC) $*.mly elif test -f $*.mll; then $(REMAKE) $*.mll $(OCAMLLEX) $*.mll elif test -f $*.ml.str; then $(REMAKE) $*.ml.str echo -n 'let content = "' > $*.ml sed -e 's/\(["\\]\)/\\\1/g' $*.ml.str | sed -e 's/^\(.*\)$/\1\\n\\/g' >> $*.ml echo '' >> $*.ml echo '"' >> $*.ml fi %.cmx %.depx: base=$* target=$@ DEPEXT=depx NATIVE=-native REMAKE="$(REMAKE) OCAMLNATIVE=$NATIVE" OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)" SRC=$(SRC) if test -f "$base".flags; then FLAGS=`cat "$base".flags` fi COMPILE="$(OCAMLOPT) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDFLAGS) $FLAGS" . tools/ocamldriver.sh %.cmo %.depo: base=$* target=$@ DEPEXT=depo NATIVE="" REMAKE="$(REMAKE) OCAMLNATIVE=$NATIVE" OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)" SRC=$(SRC) COMPILE="$(OCAMLC) $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDFLAGS)" . tools/ocamldriver.sh %.cmi: base=$* target=$@ NATIVE=$(OCAMLNATIVE) REMAKE="$(REMAKE) OCAMLNATIVE=$NATIVE" OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)" SRC=$(SRC) if test -z "$NATIVE"; then DEPEXT=.depo COMPILE="$(OCAMLC) $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDFLAGS)" else COMPILE="$(OCAMLOPT) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDFLAGS)" DEPEXT=.depx fi . tools/ocamldriver.sh ## Tests test_byte: tools $(BYTE) $(REMAKE) TEST=$(BYTE) real_test test_native: tools $(BIN) $(REMAKE) TEST=$(BIN) real_test test: test_native real_test: for i in tests/*.xml do for j in 1 2 3 do $(REMAKE) TEST=$(TEST) "$i".test"$j".summary done done test_clean: rm -rf tests/*.summary tests/*.results/*_"$(PACKAGE)"_*.* %.summary: target=$@ base=$* test=${base#*.xml.} xml=${base%.$test} REMAKE=$(REMAKE) BIN=$(TEST) SPLIT=tools/split_path.native$(EXE) XMLDIFF=tools/xml_diff.native$(EXE) PACKAGE=$(PACKAGE) $REMAKE $xml ${xml}.queries tests/${test}.sh rm -f "$target" . tests/${test}.sh