Commit e5d97d9e authored by POTTIER Francois's avatar POTTIER Francois

New entries [make update] and [make strip].

parent aff52244
.PHONY: everyday bootstrap stage1 stage2 stage3 sdk clean
# ----------------------------------------------------------------------------
# Choose a target.
......@@ -25,11 +23,13 @@ endif
# Typing "make" will perform just stage 1. This is enough to ensure that
# the source code is correct.
.PHONY: everyday
everyday: installation.ml stage1
# ----------------------------------------------------------------------------
# Building Menhir from scratch (a.k.a. bootstrapping).
.PHONY: bootstrap
bootstrap:
@ $(MAKE) stage1
@ $(MAKE) stage2
......@@ -39,10 +39,32 @@ bootstrap:
# Stage 1.
# Build Menhir using ocamlyacc.
.PHONY: stage1
stage1:
@ $(OCAMLBUILD) -build-dir _stage1 \
$(MENHIRLIBCMXS) menhir.$(TARGET)
# ----------------------------------------------------------------------------
# Updating the auto-generated comments in parserMessages.messages.
# We use Menhir (from stage 1).
.PHONY: update
update: stage1
cp parserMessages.messages parserMessages.messages.bak
_stage1/menhir.$(TARGET) $(BASEFLAGS) --stdlib . \
--update-errors parserMessages.messages.bak \
fancy-parser.mly \
> parserMessages.messages
rm parserMessages.messages.bak
# ----------------------------------------------------------------------------
# Stripping away the auto-generated comments in parserMessages.messages.
.PHONY: strip
strip:
sed -e "/^##/d" -i.bak parserMessages.messages
rm parserMessages.messages.bak
# ----------------------------------------------------------------------------
# Stage 2.
# Build Menhir using Menhir (from stage 1).
......@@ -55,8 +77,19 @@ stage1:
# into a subdirectory.
SRC := ..
FLAGS := -v -lg 1 -la 1 -lc 1 --table --infer --stdlib $(SRC) --strict --fixed-exception --canonical
BASEFLAGS := \
-lg 1 -la 1 -lc 1 \
--canonical \
--table \
--strict \
--fixed-exception \
FLAGS := \
$(BASEFLAGS) \
-v \
--stdlib $(SRC) \
.PHONY: stage2
stage2:
@ $(OCAMLBUILD) -build-dir _stage2 -tag fancy_parser \
-use-menhir -menhir "$(SRC)/_stage1/menhir.$(TARGET) $(FLAGS)" \
......@@ -66,6 +99,8 @@ stage2:
# Stage 3 (optional).
# Re-generate Menhir's parser using Menhir (from stage 2) and check that it
# is identical to the stage 2 parser.
.PHONY: stage3
stage3:
@ $(OCAMLBUILD) -build-dir _stage3 -tag fancy_parser \
-use-menhir -menhir "$(SRC)/_stage2/menhir.$(TARGET) $(FLAGS)" \
......@@ -77,7 +112,7 @@ stage3:
done; \
echo "Bootstrap successful."
# -------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# The ocamlbuild targets that should be used to build menhirSdk.
......@@ -89,6 +124,7 @@ endif
# ----------------------------------------------------------------------------
# Building menhirSdk.
.PHONY: sdk
sdk:
@ $(OCAMLBUILD) \
-build-dir _sdk \
......@@ -98,5 +134,6 @@ sdk:
# ----------------------------------------------------------------------------
# Cleaning up.
.PHONY: clean
clean::
rm -rf _stage1 _stage2 _stage3 _sdk
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