diff options
author | Sébastien Hinderer <Sebastien.Hinderer@inria.fr> | 2022-03-22 17:49:19 +0100 |
---|---|---|
committer | Sébastien Hinderer <Sebastien.Hinderer@inria.fr> | 2022-03-22 18:12:02 +0100 |
commit | df4759a2205e85302fed1006e7509e73365cd4a1 (patch) | |
tree | 8eaf337b73192948fefddaf45e53b6b52e3f40fa | |
parent | 3a96f253cf76691ee8aa53090e4d7e710c4aeb0a (diff) | |
download | ocaml-df4759a2205e85302fed1006e7509e73365cd4a1.tar.gz |
Build system: factorize the definitions related to ocamldep
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | Makefile.common | 12 | ||||
-rw-r--r-- | Makefile.menhir | 5 | ||||
-rw-r--r-- | api_docgen/Makefile.docfiles | 2 | ||||
-rw-r--r-- | debugger/Makefile | 4 | ||||
-rw-r--r-- | lex/Makefile | 14 | ||||
-rw-r--r-- | ocamldoc/Makefile | 7 | ||||
-rw-r--r-- | ocamltest/Makefile | 6 | ||||
-rw-r--r-- | otherlibs/dynlink/dynlink_compilerlibs/Makefile.copy-sources | 6 | ||||
-rw-r--r-- | stdlib/Makefile | 7 | ||||
-rw-r--r-- | testsuite/tests/memory-model/Makefile | 5 | ||||
-rw-r--r-- | tools/Makefile | 6 |
12 files changed, 37 insertions, 48 deletions
@@ -16,9 +16,11 @@ # The main Makefile ROOTDIR = . -# NOTE: it is important that OCAMLLEX is defined *before* Makefile.common -# gets included, so that its definition here takes precedence -# over the one there. +# NOTE: it is important that the OCAMLDEP and OCAMLLEX variables +# are defined *before* Makefile.common gets included, so that +# their local definitions here take precedence over their +# general shared definitions in Makefile.common. +OCAMLDEP ?= $(BOOT_OCAMLDEP) OCAMLLEX ?= $(BOOT_OCAMLLEX) include Makefile.common @@ -58,9 +60,6 @@ else OCAML_NATDYNLINKOPTS = -ccopt "$(NATDYNLINKOPTS)" endif -OCAMLDEP ?= $(OCAMLRUN) boot/ocamlc -depend -OC_OCAMLDEPFLAGS = -slash -OCAMLDEP_CMD = $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) DEPINCLUDES=$(INCLUDES) OCAMLDOC_OPT=$(WITH_OCAMLDOC:=.opt) diff --git a/Makefile.common b/Makefile.common index 43068151c8..e02169167e 100644 --- a/Makefile.common +++ b/Makefile.common @@ -60,6 +60,8 @@ else BOOT_OCAMLC = $(OCAMLRUN) $(ROOTDIR)/boot/ocamlc endif +BOOT_OCAMLDEP = $(BOOT_OCAMLC) -depend + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" FLEXLINK_ENV = CAMLOPT_CMD = $(CAMLOPT) @@ -140,6 +142,16 @@ $(1): $(1)$(EXE) endif endef # PROGRAM_SYNONYM +# Definitions related to ocamldep + +# Default value for OCAMLDEP +# In those directories where this needs to be overridden, the overriding +# should take place *before* Makefile.common is included. + +OCAMLDEP ?= $(BEST_OCAMLDEP) +OC_OCAMLDEPFLAGS = -slash +OCAMLDEP_CMD = $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) + # Lexer generation BOOT_OCAMLLEX ?= $(OCAMLRUN) $(ROOTDIR)/boot/ocamllex diff --git a/Makefile.menhir b/Makefile.menhir index d55997e440..ee4385794d 100644 --- a/Makefile.menhir +++ b/Makefile.menhir @@ -159,12 +159,9 @@ clean-menhir: partialclean-menhir ## depend-menhir -OCAMLDEP_CMD = \ - $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) $(DEPINCLUDES) - .PHONY: depend-menhir depend-menhir: - $(MENHIR) --depend --ocamldep "$(OCAMLDEP_CMD)" \ + $(MENHIR) --depend --ocamldep "$(OCAMLDEP_CMD) $(DEPINCLUDES)" \ parsing/parser.mly > .depend.menhir # This rule depends on the OCAMLDEP, OC_OCAMLDEPFLAGS and DEPINCLUDES # variables defined in Makefile, so it can only be invoked from the diff --git a/api_docgen/Makefile.docfiles b/api_docgen/Makefile.docfiles index 7cb2d10ba0..c579c616e3 100644 --- a/api_docgen/Makefile.docfiles +++ b/api_docgen/Makefile.docfiles @@ -26,8 +26,6 @@ define capitalize $(foreach m,$(1),$(call capitalize_one,$m)) endef -OCAMLDEP ?= $(BEST_OCAMLDEP) - define sort $(shell $(OCAMLDEP) -sort $(1)) endef diff --git a/debugger/Makefile b/debugger/Makefile index f21a99c88a..cd30648e1c 100644 --- a/debugger/Makefile +++ b/debugger/Makefile @@ -25,8 +25,6 @@ CAMLC=$(BEST_OCAMLC) -g -nostdlib -I $(ROOTDIR)/stdlib COMPFLAGS=$(INCLUDES) -absname -w +a-4-9-41-42-44-45-48-70 -warn-error +A \ -safe-string -strict-sequence -strict-formats LINKFLAGS=-linkall -I $(UNIXDIR) -I $(DYNLINKDIR) -OCAMLDEP ?= $(BEST_OCAMLDEP) -OC_OCAMLDEPFLAGS = -slash DEPINCLUDES=$(INCLUDES) DIRECTORIES=$(UNIXDIR) $(DYNLINKDIR) $(addprefix $(ROOTDIR)/,\ @@ -80,7 +78,7 @@ ocamldebug_entry.cmo: ocamldebug_entry.ml ocamldebug.cmo $(CAMLC) -c $(COMPFLAGS) -for-pack ocamldebug $< depend: beforedepend - $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) $(DEPINCLUDES) \ + $(OCAMLDEP_CMD) $(DEPINCLUDES) \ *.mli *.ml | sed -e 's,$(UNIXDIR)/,$$(UNIXDIR)/,' > .depend clean:: diff --git a/lex/Makefile b/lex/Makefile index 471afdf956..d932e86b53 100644 --- a/lex/Makefile +++ b/lex/Makefile @@ -17,9 +17,12 @@ ROOTDIR = .. -# NOTE: it is important that OCAMLLEX is defined *before* Makefile.common -# gets included, so that its definition here takes precedence -# over the one there. +# NOTE: it is important that the OCAMLDEP and OCAMLLEX variables +# are defined *before* Makefile.common gets included, so that +# their local definitions here take precedence over their +# general shared definitions in Makefile.common. + +OCAMLDEP ?= $(BOOT_OCAMLDEP) OCAMLLEX ?= $(BOOT_OCAMLLEX) include $(ROOTDIR)/Makefile.common @@ -32,8 +35,6 @@ CAMLOPT = $(OCAMLRUN) $(ROOTDIR)/ocamlopt$(EXE) -nostdlib -I $(ROOTDIR)/stdlib COMPFLAGS = -absname -w +a-4-9-41-42-44-45-48-70 -warn-error +A \ -safe-string -strict-sequence -strict-formats -bin-annot LINKFLAGS = -OCAMLDEP = $(BOOT_OCAMLC) -depend -OC_OCAMLDEPFLAGS = -slash DEPINCLUDES = OBJS=cset.cmo syntax.cmo parser.cmo lexer.cmo table.cmo lexgen.cmo \ @@ -81,7 +82,6 @@ beforedepend:: lexer.ml $(CAMLOPT) -c $(COMPFLAGS) $< depend: beforedepend - $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) $(DEPINCLUDES) \ - *.mli *.ml > .depend + $(OCAMLDEP_CMD) $(DEPINCLUDES) *.mli *.ml > .depend include .depend diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile index 6ffd960463..f8c30dc169 100644 --- a/ocamldoc/Makefile +++ b/ocamldoc/Makefile @@ -23,9 +23,6 @@ OCAMLYACCFLAGS = --strict -v STDLIBFLAGS = -nostdlib -I $(ROOTDIR)/stdlib OCAMLC = $(BEST_OCAMLC) $(STDLIBFLAGS) OCAMLOPT = $(BEST_OCAMLOPT) $(STDLIBFLAGS) -OCAMLDEP ?= $(BEST_OCAMLDEP) -OC_OCAMLDEPFLAGS = -slash -OCAMLDEP_CMD = $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) $(DEPINCLUDES) # For installation ############## @@ -353,7 +350,7 @@ distclean: clean .PHONY: depend depend: $(DEPEND_PREREQS) - $(OCAMLDEP_CMD) *.mll *.mly *.ml *.mli > .depend - $(OCAMLDEP_CMD) -shared generators/*.ml >> .depend + $(OCAMLDEP_CMD) $(DEPINCLUDES) *.mll *.mly *.ml *.mli > .depend + $(OCAMLDEP_CMD) $(DEPINCLUDES) -shared generators/*.ml >> .depend include .depend diff --git a/ocamltest/Makefile b/ocamltest/Makefile index f780199508..1b45ec3e38 100644 --- a/ocamltest/Makefile +++ b/ocamltest/Makefile @@ -198,9 +198,6 @@ ocamlc = $(BEST_OCAMLC) $(flags) ocamlopt = $(BEST_OCAMLOPT) $(flags) -OCAMLDEP ?= $(BEST_OCAMLDEP) -OC_OCAMLDEPFLAGS = -slash - .SECONDARY: $(lexers:.mll=.ml) $(parsers:.mly=.mli) $(parsers:.mly=.ml) .PHONY: all allopt opt.opt # allopt and opt.opt are synonyms @@ -311,7 +308,6 @@ $(DEPDIR)/%.$(D): %.c | $(DEPDIR) .PHONY: depend depend: $(dependencies_generated_prereqs) - $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) \ - $(mli_files) $(ml_files) > .depend + $(OCAMLDEP_CMD) $(mli_files) $(ml_files) > .depend -include .depend diff --git a/otherlibs/dynlink/dynlink_compilerlibs/Makefile.copy-sources b/otherlibs/dynlink/dynlink_compilerlibs/Makefile.copy-sources index ad773dd443..c842f00fc4 100644 --- a/otherlibs/dynlink/dynlink_compilerlibs/Makefile.copy-sources +++ b/otherlibs/dynlink/dynlink_compilerlibs/Makefile.copy-sources @@ -14,13 +14,9 @@ #* * #************************************************************************** -OCAMLDEP ?= $(BEST_OCAMLDEP) -OC_OCAMLDEPFLAGS = -slash - $(LOCAL_SRC)/.depend: $(COMPILERLIBS_COPIED_SOURCES) \ $(COMPILERLIBS_COPIED_SOURCES_INTFS) $(LOCAL_SRC)/Makefile - $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) -I $(LOCAL_SRC) \ - $(COMPILERLIBS_COPIED_SOURCES) \ + $(OCAMLDEP_CMD) -I $(LOCAL_SRC) $(COMPILERLIBS_COPIED_SOURCES) \ $(COMPILERLIBS_COPIED_SOURCES_INTFS) \ > $(LOCAL_SRC)/.depend diff --git a/stdlib/Makefile b/stdlib/Makefile index 2c13a20427..4a52e3b159 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -14,6 +14,10 @@ #************************************************************************** ROOTDIR = .. +# NOTE: it is important that the OCAMLDEP variable is defined *before* +# Makefile.common gets included, so that its local definition here +# take precedence over its general shared definitions in Makefile.common. +OCAMLDEP ?= $(BOOT_OCAMLDEP) include $(ROOTDIR)/Makefile.common @@ -29,9 +33,6 @@ OPTCOMPFLAGS += -O3 endif OPTCOMPILER=$(ROOTDIR)/ocamlopt CAMLOPT=$(OCAMLRUN) $(OPTCOMPILER) -OCAMLDEP ?= $(BOOT_OCAMLC) -depend -OC_OCAMLDEPFLAGS = -slash -OCAMLDEP_CMD = $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) OC_CPPFLAGS += -I$(ROOTDIR)/runtime diff --git a/testsuite/tests/memory-model/Makefile b/testsuite/tests/memory-model/Makefile index a86627c158..abb060032c 100644 --- a/testsuite/tests/memory-model/Makefile +++ b/testsuite/tests/memory-model/Makefile @@ -6,8 +6,6 @@ include $(ROOTDIR)/Makefile.best_binaries STDLIBFLAGS = -nostdlib -I $(ROOTDIR)/stdlib OCAMLC ?= $(BEST_OCAMLC) $(STDLIBFLAGS) OCAMLOPT ?= $(BEST_OCAMLOPT) $(STDLIBFLAGS) -OCAMLDEP ?= $(BEST_OCAMLDEP) -OC_OCAMLDEPFLAGS = -slash PGM=forbidden.exe publish.exe MOREPGM= @@ -48,7 +46,6 @@ clean:: $(OCAMLC) -o $@ $^ depend: - $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) \ - $(SRC) $(MLI) > .depend + $(OCAMLDEP_CMD) $(SRC) $(MLI) > .depend -include .depend diff --git a/tools/Makefile b/tools/Makefile index c22c0eff59..0942e386f6 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -19,6 +19,7 @@ ROOTDIR = .. # over the one there. OCAMLLEX ?= $(BOOT_OCAMLLEX) include $(ROOTDIR)/Makefile.common +include $(ROOTDIR)/Makefile.best_binaries # Setup GNU make variables storing per-target source and target, # a list of installed tools, and a function to quote a filename for @@ -341,12 +342,9 @@ clean:: clean:: rm -f *.cmo *.cmi *.cma *.dll *.so *.lib *.a -OCAMLDEP ?= $(BEST_OCAMLDEP) -OC_OCAMLDEP_FLAGS = -slash DEPINCLUDES=$(INCLUDES) depend: beforedepend - $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) $(OCAMLDEPFLAGS) $(DEPINCLUDES) \ - *.mli *.ml > .depend + $(OCAMLDEP_CMD) $(DEPINCLUDES) *.mli *.ml > .depend .PHONY: clean distclean install beforedepend depend |