summaryrefslogtreecommitdiff
path: root/compilerlibs
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2019-12-26 09:51:35 +0100
committerGabriel Scherer <gabriel.scherer@gmail.com>2019-12-26 21:09:13 +0100
commit52b5815d7e5a8273a2815d853d29651c396f6b6c (patch)
tree65c9ea75cd395d7b123abce58bb7859b6296f9ad /compilerlibs
parentcfb67f815394d187a9708b23f2ebefbb4be339bd (diff)
downloadocaml-52b5815d7e5a8273a2815d853d29651c396f6b6c.tar.gz
compilerlibs archives: add dependencies on .mli-only compilation units
Before this commit, the Makefile for compilerlibs archives only tracks their dependencies on implementation object files (.cmo, .cmx). .mli-only files in those directories result in a .cmi without a .cmo. The main makefile uses dependencies on compilerlibs archives as a proxy for all dependencies on the corresponding compiler modules. This assumption was broken by .mli-only modules not being dependencies on the archives. For example, rebuilding compilerlibs archives would not refresh file_format/cmxs_format.cmi. The following steps would lead to a build failure: make core make ocamltools <add a new blank line at the beginning of utils/misc.mli> make ocamltools File "/home/gasche/Prog/ocaml/github-trunk/tools/objinfo.ml", line 1: Error: The files /home/gasche/Prog/ocaml/github-trunk/utils/misc.cmi and /home/gasche/Prog/ocaml/github-trunk/file_formats/cmxs_format.cmi make inconsistent assumptions over interface Misc
Diffstat (limited to 'compilerlibs')
-rw-r--r--compilerlibs/Makefile.compilerlibs82
1 files changed, 62 insertions, 20 deletions
diff --git a/compilerlibs/Makefile.compilerlibs b/compilerlibs/Makefile.compilerlibs
index d35f3b093a..e52b6edf1d 100644
--- a/compilerlibs/Makefile.compilerlibs
+++ b/compilerlibs/Makefile.compilerlibs
@@ -18,6 +18,12 @@
# This file is meant to be included from the root Makefile, not to be
# executed directly (this is why it is not simply named Makefile).
+# For each group of compilation units, we have a variable GROUP with
+# only .cmo files, and a separate variable GROUP_CMI for .cmi files
+# corresponding to the .mli-only modules only. These .cmi are not
+# linked in the archive, but they are marked as dependencies to ensure
+# that they are consistent with the interface digests in the archives.
+
UTILS=utils/config.cmo utils/build_path_prefix_map.cmo utils/misc.cmo \
utils/identifiable.cmo utils/numbers.cmo utils/arg_helper.cmo \
utils/clflags.cmo utils/profile.cmo utils/load_path.cmo \
@@ -25,6 +31,7 @@ UTILS=utils/config.cmo utils/build_path_prefix_map.cmo utils/misc.cmo \
utils/consistbl.cmo utils/strongly_connected_components.cmo \
utils/targetint.cmo utils/int_replace_polymorphic_compare.cmo \
utils/domainstate.cmo
+UTILS_CMI=
PARSING=parsing/location.cmo parsing/longident.cmo \
parsing/docstrings.cmo parsing/syntaxerr.cmo \
@@ -34,6 +41,9 @@ PARSING=parsing/location.cmo parsing/longident.cmo \
parsing/lexer.cmo parsing/parse.cmo parsing/printast.cmo \
parsing/ast_mapper.cmo parsing/ast_iterator.cmo parsing/attr_helper.cmo \
parsing/builtin_attributes.cmo parsing/ast_invariants.cmo parsing/depend.cmo
+PARSING_CMI=\
+ parsing/asttypes.cmi \
+ parsing/parsetree.cmi
TYPING=typing/ident.cmo typing/path.cmo \
typing/primitive.cmo typing/type_immediacy.cmo typing/types.cmo \
@@ -53,6 +63,9 @@ TYPING=typing/ident.cmo typing/path.cmo \
typing/typedecl.cmo typing/typeopt.cmo \
typing/rec_check.cmo typing/typecore.cmo typing/typeclass.cmo \
typing/typemod.cmo
+TYPING_CMI=\
+ typing/annot.cmi \
+ typing/outcometree.cmi
LAMBDA=lambda/debuginfo.cmo \
lambda/lambda.cmo lambda/printlambda.cmo \
@@ -61,6 +74,7 @@ LAMBDA=lambda/debuginfo.cmo \
lambda/translprim.cmo lambda/translcore.cmo \
lambda/translclass.cmo lambda/translmod.cmo \
lambda/simplif.cmo lambda/runtimedef.cmo
+LAMBDA_CMI=
COMP=\
bytecomp/meta.cmo bytecomp/opcodes.cmo \
@@ -70,6 +84,14 @@ COMP=\
driver/main_args.cmo driver/compmisc.cmo \
driver/makedepend.cmo \
driver/compile_common.cmo
+COMP_CMI=\
+ file_formats/cmo_format.cmi \
+ file_formats/cmx_format.cmi \
+ file_formats/cmxs_format.cmi
+# All file format descriptions (including cmx{,s}) are in the
+# ocamlcommon library so that ocamlobjinfo can depend on them.
+
+COMMON_CMI=$(UTILS_CMI) $(PARSING_CMI) $(TYPING_CMI) $(LAMBDA_CMI) $(COMP_CMI)
COMMON=$(UTILS) $(PARSING) $(TYPING) $(LAMBDA) $(COMP)
@@ -77,23 +99,29 @@ BYTECOMP=bytecomp/instruct.cmo bytecomp/bytegen.cmo \
bytecomp/printinstr.cmo bytecomp/emitcode.cmo \
bytecomp/bytelink.cmo bytecomp/bytelibrarian.cmo bytecomp/bytepackager.cmo \
driver/errors.cmo driver/compile.cmo
+BYTECOMP_CMI=
ARCH_SPECIFIC =\
asmcomp/arch.ml asmcomp/proc.ml asmcomp/CSE.ml asmcomp/selection.ml \
asmcomp/scheduling.ml asmcomp/reload.ml
+ARCH_SPECIFIC_CMI=
INTEL_ASM=\
asmcomp/x86_proc.cmo \
asmcomp/x86_dsl.cmo \
asmcomp/x86_gas.cmo \
asmcomp/x86_masm.cmo
+INTL_ASM_CMI=\
+ asmcomp/x86_ast.cmi
ARCH_SPECIFIC_ASMCOMP=
ifeq ($(ARCH),i386)
ARCH_SPECIFIC_ASMCOMP=$(INTEL_ASM)
+ARCH_SPECIFIC_ASMCOMP_CMI=$(INTEL_ASM_CMI)
endif
ifeq ($(ARCH),amd64)
ARCH_SPECIFIC_ASMCOMP=$(INTEL_ASM)
+ARCH_SPECIFIC_ASMCOMP_CMI=$(INTEL_ASM_CMI)
endif
ASMCOMP=\
@@ -129,6 +157,7 @@ ASMCOMP=\
asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \
asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo \
driver/opterrors.cmo driver/optcompile.cmo
+ASMCOMP_CMI=$(ARCH_SPECIFIC_ASMCOMP_CMI)
# Files under middle_end/ are not to reference files under asmcomp/.
# This ensures that the middle end can be linked (e.g. for objinfo) even when
@@ -137,6 +166,7 @@ ASMCOMP=\
MIDDLE_END_CLOSURE=\
middle_end/closure/closure.cmo \
middle_end/closure/closure_middle_end.cmo
+MIDDLE_END_CLOSURE_CMI=
# Owing to dependencies through [Compilenv], which would be
# difficult to remove, some of the lower parts of Flambda (anything that is
@@ -180,6 +210,9 @@ MIDDLE_END_FLAMBDA=\
middle_end/flambda/un_anf.cmo \
middle_end/flambda/flambda_to_clambda.cmo \
middle_end/flambda/flambda_middle_end.cmo
+MIDDLE_END_FLAMBDA_CMI=\
+ middle_end/flambda/inlining_decision_intf.cmi \
+ middle_end/flambda/simplify_boxed_integer_ops_intf.cmi
MIDDLE_END=\
middle_end/internal_variable_names.cmo \
@@ -221,68 +254,77 @@ MIDDLE_END=\
middle_end/compilenv.cmo \
$(MIDDLE_END_CLOSURE) \
$(MIDDLE_END_FLAMBDA)
+MIDDLE_END_CMI=\
+ middle_end/backend_intf.cmi \
+ $(MIDDLE_END_CLOSURE_CMI) \
+ $(MIDDLE_END_FLAMBDA_CMI)
OPTCOMP=$(MIDDLE_END) $(ASMCOMP)
+OPTCOMP_CMI=$(MIDDLE_END_CMI) $(ASMCOMP_CMI)
TOPLEVEL=toplevel/genprintval.cmo toplevel/toploop.cmo \
toplevel/trace.cmo toplevel/topdirs.cmo toplevel/topmain.cmo
+TOPLEVEL_CMI=
OPTTOPLEVEL=toplevel/genprintval.cmo toplevel/opttoploop.cmo \
toplevel/opttopdirs.cmo toplevel/opttopmain.cmo
+OPTTOPLEVEL_CMI=
+
$(COMMON:.cmo=.cmx) $(BYTECOMP:.cmo=.cmx) $(OPTCOMP:.cmo=.cmx): ocamlopt
$(OPTTOPLEVEL:.cmo=.cmx): ocamlopt
-compilerlibs/ocamlcommon.cma: $(COMMON)
- $(CAMLC) -a -linkall -o $@ $^
+
+compilerlibs/ocamlcommon.cma: $(COMMON_CMI) $(COMMON)
+ $(CAMLC) -a -linkall -o $@ $(COMMON)
partialclean::
rm -f compilerlibs/ocamlcommon.cma
-compilerlibs/ocamlcommon.cmxa: $(COMMON:.cmo=.cmx)
- $(CAMLOPT) -a -linkall -o $@ $^
+compilerlibs/ocamlcommon.cmxa: $(COMMON_CMI) $(COMMON:.cmo=.cmx)
+ $(CAMLOPT) -a -linkall -o $@ $(COMMON:.cmo=.cmx)
partialclean::
rm -f compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlcommon.$(A)
-compilerlibs/ocamlbytecomp.cma: $(BYTECOMP)
- $(CAMLC) -a -o $@ $^
+compilerlibs/ocamlbytecomp.cma: $(BYTECOMP_CMI) $(BYTECOMP)
+ $(CAMLC) -a -o $@ $(BYTECOMP)
partialclean::
rm -f compilerlibs/ocamlbytecomp.cma
-compilerlibs/ocamlbytecomp.cmxa: $(BYTECOMP:.cmo=.cmx)
- $(CAMLOPT) -a $(OCAML_NATDYNLINKOPTS) -o $@ $^
+compilerlibs/ocamlbytecomp.cmxa: $(BYTECOMP_CMI) $(BYTECOMP:.cmo=.cmx)
+ $(CAMLOPT) -a $(OCAML_NATDYNLINKOPTS) -o $@ $(BYTECOMP:.cmo=.cmx)
partialclean::
rm -f compilerlibs/ocamlbytecomp.cmxa compilerlibs/ocamlbytecomp.$(A)
-compilerlibs/ocamlmiddleend.cma: $(MIDDLE_END)
- $(CAMLC) -a -o $@ $^
-compilerlibs/ocamlmiddleend.cmxa: $(MIDDLE_END:%.cmo=%.cmx)
- $(CAMLOPT) -a -o $@ $^
+compilerlibs/ocamlmiddleend.cma: $(MIDDLE_END_CMI) $(MIDDLE_END)
+ $(CAMLC) -a -o $@ $(MIDDLE_END)
+compilerlibs/ocamlmiddleend.cmxa: $(MIDDLE_END_CMI) $(MIDDLE_END:%.cmo=%.cmx)
+ $(CAMLOPT) -a -o $@ $(MIDDLE_END:%.cmo=%.cmx)
partialclean::
rm -f compilerlibs/ocamlmiddleend.cma \
compilerlibs/ocamlmiddleend.cmxa \
compilerlibs/ocamlmiddleend.$(A)
-compilerlibs/ocamloptcomp.cma: $(OPTCOMP)
- $(CAMLC) -a -o $@ $^
+compilerlibs/ocamloptcomp.cma: $(OPTCOMP_CMI) $(OPTCOMP)
+ $(CAMLC) -a -o $@ $(OPTCOMP)
partialclean::
rm -f compilerlibs/ocamloptcomp.cma
-compilerlibs/ocamloptcomp.cmxa: $(OPTCOMP:.cmo=.cmx)
- $(CAMLOPT) -a -o $@ $^
+compilerlibs/ocamloptcomp.cmxa: $(OPTCOMP_CMI) $(OPTCOMP:.cmo=.cmx)
+ $(CAMLOPT) -a -o $@ $(OPTCOMP:.cmo=.cmx)
partialclean::
rm -f compilerlibs/ocamloptcomp.cmxa compilerlibs/ocamloptcomp.$(A)
-compilerlibs/ocamltoplevel.cma: $(TOPLEVEL)
- $(CAMLC) -a -o $@ $^
+compilerlibs/ocamltoplevel.cma: $(TOPLEVEL_CMI) $(TOPLEVEL)
+ $(CAMLC) -a -o $@ $(TOPLEVEL)
partialclean::
rm -f compilerlibs/ocamltoplevel.cma
-compilerlibs/ocamlopttoplevel.cmxa: $(OPTTOPLEVEL:.cmo=.cmx)
- $(CAMLOPT) -a -o $@ $^
+compilerlibs/ocamlopttoplevel.cmxa: $(OPTTOPLEVEL_CMI) $(OPTTOPLEVEL:.cmo=.cmx)
+ $(CAMLOPT) -a -o $@ $(OPTTOPLEVEL:.cmo=.cmx)
partialclean::
rm -f compilerlibs/ocamlopttoplevel.cmxa \
compilerlibs/ocamlopttoplevel.$(A)