Commit 121ead14 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Makefile reordering and simplification.

parent 3834e19d
.PHONY: all clean test
.PHONY: test all clean
# Find Menhir.
ifndef MENHIR
......@@ -8,45 +8,27 @@ endif
MENHIRFLAGS := --infer -v --fixed-exception
OCAMLBUILD := ocamlbuild -use-ocamlfind
MAIN := calc
all:
cd .. && ./build.sh
# ocamlyacc.
@ $(OCAMLBUILD) -build-dir _ocamlyacc $(MAIN).native
# Menhir, code back-end, %inline disabled.
@ $(OCAMLBUILD) -build-dir _menhir_code -tag fancy $(MAIN).native \
-use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS) -lc 1 --comment --no-code-inlining --no-inline"
# Menhir, code back-end, %inline enabled.
@ $(OCAMLBUILD) -build-dir _menhir_code_inline -tag fancy $(MAIN).native \
-use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS) -lc 1 --comment --no-code-inlining"
# Menhir, table back-end, %inline disabled.
@ $(OCAMLBUILD) -build-dir _menhir_table -tag fancy $(MAIN).native \
-package menhirLib -use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS) --table --no-inline "
# Menhir, table back-end, %inline enabled.
@ $(OCAMLBUILD) -build-dir _menhir_table_inline -tag fancy $(MAIN).native \
-package menhirLib -use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS) --table"
clean:
@ rm -f *~ .*~ *.log
@ $(OCAMLBUILD) -build-dir _ocamlyacc -clean
@ $(OCAMLBUILD) -build-dir _menhir_code -clean
@ $(OCAMLBUILD) -build-dir _menhir_code_inline -clean
@ $(OCAMLBUILD) -build-dir _menhir_table -clean
@ $(OCAMLBUILD) -build-dir _menhir_table_inline -clean
TARGETS := _ocamlyacc _menhir_code _menhir_code_inline _menhir_table _menhir_table_inline
# We try every input file whose name matches *.in.
# We parse it using each of the parsers,
# and compare the results pairwise.
test: all
test:
# Make sure everything is freshly compiled.
$(MAKE) clean
cd .. && ./build.sh
$(MAKE) all
# Create the output files.
@ for f in *.in ; do \
base=$${f%*.in} ; \
out=$$base.out ; \
echo "Processing $$f..." ; \
for target in _ocamlyacc _menhir_code _menhir_code_inline _menhir_table _menhir_table_inline ; do \
for target in $(TARGETS) ; do \
$$target/$(MAIN).native < $$f > $$target/$$out ; \
done ; \
done
# Compare the output files. Lots of comparisons.
@ for pair in \
_ocamlyacc/_menhir_code \
_ocamlyacc/_menhir_table \
......@@ -70,3 +52,24 @@ test: all
done ; \
done
all:
# ocamlyacc.
@ $(OCAMLBUILD) -build-dir _ocamlyacc $(MAIN).native
# Menhir, code back-end, %inline disabled.
@ $(OCAMLBUILD) -build-dir _menhir_code -tag fancy $(MAIN).native \
-use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS) -lc 1 --comment --no-code-inlining --no-inline"
# Menhir, code back-end, %inline enabled.
@ $(OCAMLBUILD) -build-dir _menhir_code_inline -tag fancy $(MAIN).native \
-use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS) -lc 1 --comment --no-code-inlining"
# Menhir, table back-end, %inline disabled.
@ $(OCAMLBUILD) -build-dir _menhir_table -tag fancy $(MAIN).native \
-package menhirLib -use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS) --table --no-inline "
# Menhir, table back-end, %inline enabled.
@ $(OCAMLBUILD) -build-dir _menhir_table_inline -tag fancy $(MAIN).native \
-package menhirLib -use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS) --table"
clean:
@ rm -f *~ .*~ *.log
@ for target in $(TARGETS) ; do \
$(OCAMLBUILD) -build-dir $$target -clean ; \
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment