aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2009-03-16 13:41:47 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2009-03-16 13:41:47 +0000
commitc4fc3d3d4bcad5fd6dbca6f55dffd20580006f35 (patch)
tree813267c476604997a71036492aa0fb72278a4953 /Makefile
parent2ad3eaa5e34c8cc1d2e15fbd2f9e8fbae715b2ce (diff)
Makefile: fix ignored errors, several attempts to clarify things
* I encountered error messages during compilation, for instance ocamlopt complaining about non-existing coq_config.cmi when compiling coq_config.ml. Moreover, make was _not_ stopping at these errors (WTF?!). After some debug, it turned out to be (indirectly) my fault: I placed earlier the inclusion of the new .mllib.d in Makefile.stage1, but this is too early, coqdep, which is used to compute these files, isn't built yet. Due to the semantics of "-include", make tries to build it, fails with the above error, and goes on happily. Arrgh. After moving the inclusion of these .mllib.d to Makefile.stage2, everything seems to work ok now. * Since we're using such "nice" non-trivial features of make, I've started a small FAQ section about them at the beginning of Makefile * Recursive calls to make are now done with two options: --no-builtin-rules : let's avoid builtin rules like "%:%.o" ... --warn-undefined-variable : using a non-defined variable isn't necessarily bad, but I found a few bugs with this option, and I suggest we keep it. * Clarified the rules about stage* in Makefile and their STAGE*_TARGETS variables in Makefile.common. Now a newcomer _might_ have a chance to grasp in less than a day what's going on ... git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11983 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile88
1 files changed, 62 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index b94cb34da..b3be1e813 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,50 @@
# by Emacs' next-error.
###########################################################################
+
+# Specific command-line options to this Makefile
+#
+# make GOTO_STAGE=N # perform only stage N (with N=1,2,3)
+# make VERBOSE=1 # restore the raw echoing of commands
+# make NO_RECALC_DEPS=1 # avoid recomputing dependencies
+# make NO_RECOMPILE_LIB=1 # a coqtop rebuild does not trigger a stdlib rebuild
+#
+# Nota: the 1 above can be replaced by any non-empty value
+# More details in dev/doc/build-system*.txt
+
+
+# FAQ: special features used in this Makefile
+#
+# * Order-only dependencies: |
+#
+# Dependencies placed after a bar (|) should be built before
+# the current rule, but having one of them is out-of-date do not
+# trigger a rebuild of the current rule.
+# See http://www.gnu.org/software/make/manual/make.html#Prerequisite-Types
+#
+# * Annotation before commands: +/-/@
+#
+# a command starting by - is always successful (errors are ignored)
+# a command starting by + is runned even if option -n is given to make
+# a command starting by @ is not echoed before being runned
+#
+# * Custom functions
+#
+# Definition via "define foo" followed by commands (arg is $(1) etc)
+# Call via "$(call foo,arg1)"
+#
+# * Useful builtin functions
+#
+# $(subst ...), $(patsubst ...), $(shell ...), $(foreach ...)
+#
+# * Behavior of -include
+#
+# If the file given to -include doesn't exist, make tries to build it,
+# but doesn't care if this build fails. This can be quite surprising,
+# see in particular the -include in Makefile.stage*
+
+
+
# !! Before using FIND_VCS_CLAUSE, please read how you should in the !!
# !! FIND_VCS_CLAUSE section of dev/doc/build-system.dev.txt !!
export FIND_VCS_CLAUSE:='(' \
@@ -59,6 +103,9 @@ export CFILES := $(shell find kernel/byterun $(FIND_VCS_CLAUSE) '(' -name '*.c
export ML4FILESML:= $(ML4FILES:.ml4=.ml)
+# Nota: do not use the name $(MAKEFLAGS), it has a particular behavior
+MAKEFLGS:=--warn-undefined-variable --no-builtin-rules
+
include Makefile.common
NOARG: world
@@ -84,7 +131,7 @@ define stage-template
@echo '****************** Entering stage$(1) ******************'
@echo '*****************************************************'
@echo '*****************************************************'
- +$(MAKE) -f Makefile.stage$(1) "$@"
+ +$(MAKE) $(MAKEFLGS) -f Makefile.stage$(1) "$@"
endef
else
define stage-template
@@ -110,37 +157,26 @@ else
.PHONY: stage1 stage2 stage3 world revision
-# This is to remove the built-in rule "%: %.o"
-# Otherwise, "make foo" recurses into stage1, trying to build foo.o .
-%: %.o
-
-%.o: always
+stage1 $(STAGE1_TARGETS) : always
$(call stage-template,1)
-#STAGE1_TARGETS includes all object files necessary for $(STAGE1)
-stage1 $(STAGE1_TARGETS): always
- $(call stage-template,1)
-
-CAML_OBJECT_PATTERNS:=%.cmo %.cmx %.cmi %.cma %.cmxa %.cmxs %.dep.ps %.dot
-ifdef CM_STAGE1
-$(CAML_OBJECT_PATTERNS): always
- $(call stage-template,1)
-
-%.ml4-preprocessed: stage1
- $(call stage-template,2)
-else
-$(CAML_OBJECT_PATTERNS) %.ml4-preprocessed: stage1
- $(call stage-template,2)
-endif
-
-stage2 $(STAGE2_TARGETS): stage1
+stage2 $(STAGE2_TARGETS) : stage1
$(call stage-template,2)
-%.vo %.glob states/% install-%: stage2
+stage3 $(STAGE3_TARGETS) : stage2
$(call stage-template,3)
-stage3 $(STAGE3_TARGETS): stage2
- $(call stage-template,3)
+# Nota:
+# - world is one of the targets in $(STAGE3_TARGETS), hence launching
+# "make" or "make world" leads to recursion into stage{1,2,3}
+# - the aim of stage1 is to build grammar.cma and q_constr.cmo
+# - the aim of stage2 is to build coqdep
+# More details in dev/doc/build-system*.txt
+
+
+# This is to remove the built-in rule "%: %.o" :
+%: %.o
+# Otherwise, "make foo" recurses into stage1, trying to build foo.o .
endif #GOTO_STAGE