From cfb67f815394d187a9708b23f2ebefbb4be339bd Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Thu, 26 Dec 2019 09:37:26 +0100 Subject: [PATCH] Makefile: move the targets for compilerlibs archives to an included Makefie --- Makefile | 272 +-------------------------- compilerlibs/.gitignore | 9 +- compilerlibs/Makefile.compilerlibs | 288 +++++++++++++++++++++++++++++ 3 files changed, 293 insertions(+), 276 deletions(-) create mode 100644 compilerlibs/Makefile.compilerlibs diff --git a/Makefile b/Makefile index 9d5759e60..7b9f726a7 100644 --- a/Makefile +++ b/Makefile @@ -69,217 +69,6 @@ DEPINCLUDES=$(INCLUDES) OCAMLDOC_OPT=$(WITH_OCAMLDOC:=.opt) -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 \ - utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \ - utils/consistbl.cmo utils/strongly_connected_components.cmo \ - utils/targetint.cmo utils/int_replace_polymorphic_compare.cmo \ - utils/domainstate.cmo - -PARSING=parsing/location.cmo parsing/longident.cmo \ - parsing/docstrings.cmo parsing/syntaxerr.cmo \ - parsing/ast_helper.cmo \ - parsing/pprintast.cmo \ - parsing/camlinternalMenhirLib.cmo parsing/parser.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 - -TYPING=typing/ident.cmo typing/path.cmo \ - typing/primitive.cmo typing/type_immediacy.cmo typing/types.cmo \ - typing/btype.cmo typing/oprint.cmo \ - typing/subst.cmo typing/predef.cmo \ - typing/datarepr.cmo file_formats/cmi_format.cmo \ - typing/persistent_env.cmo typing/env.cmo \ - typing/typedtree.cmo typing/printtyped.cmo typing/ctype.cmo \ - typing/printtyp.cmo typing/includeclass.cmo \ - typing/mtype.cmo typing/envaux.cmo typing/includecore.cmo \ - typing/tast_iterator.cmo typing/tast_mapper.cmo \ - file_formats/cmt_format.cmo typing/untypeast.cmo \ - typing/includemod.cmo typing/typetexp.cmo typing/printpat.cmo \ - typing/parmatch.cmo typing/stypes.cmo \ - typing/typedecl_properties.cmo typing/typedecl_variance.cmo \ - typing/typedecl_unboxed.cmo typing/typedecl_immediacy.cmo \ - typing/typedecl.cmo typing/typeopt.cmo \ - typing/rec_check.cmo typing/typecore.cmo typing/typeclass.cmo \ - typing/typemod.cmo - -LAMBDA=lambda/debuginfo.cmo \ - lambda/lambda.cmo lambda/printlambda.cmo \ - lambda/switch.cmo lambda/matching.cmo \ - lambda/translobj.cmo lambda/translattribute.cmo \ - lambda/translprim.cmo lambda/translcore.cmo \ - lambda/translclass.cmo lambda/translmod.cmo \ - lambda/simplif.cmo lambda/runtimedef.cmo - -COMP=\ - bytecomp/meta.cmo bytecomp/opcodes.cmo \ - bytecomp/bytesections.cmo bytecomp/dll.cmo \ - bytecomp/symtable.cmo \ - driver/pparse.cmo driver/compenv.cmo \ - driver/main_args.cmo driver/compmisc.cmo \ - driver/makedepend.cmo \ - driver/compile_common.cmo - -COMMON=$(UTILS) $(PARSING) $(TYPING) $(LAMBDA) $(COMP) - -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 - -ARCH_SPECIFIC =\ - asmcomp/arch.ml asmcomp/proc.ml asmcomp/CSE.ml asmcomp/selection.ml \ - asmcomp/scheduling.ml asmcomp/reload.ml - -INTEL_ASM=\ - asmcomp/x86_proc.cmo \ - asmcomp/x86_dsl.cmo \ - asmcomp/x86_gas.cmo \ - asmcomp/x86_masm.cmo - -ARCH_SPECIFIC_ASMCOMP= -ifeq ($(ARCH),i386) -ARCH_SPECIFIC_ASMCOMP=$(INTEL_ASM) -endif -ifeq ($(ARCH),amd64) -ARCH_SPECIFIC_ASMCOMP=$(INTEL_ASM) -endif - -ASMCOMP=\ - $(ARCH_SPECIFIC_ASMCOMP) \ - asmcomp/arch.cmo \ - asmcomp/cmm.cmo asmcomp/printcmm.cmo \ - asmcomp/reg.cmo asmcomp/debug/reg_with_debug_info.cmo \ - asmcomp/debug/reg_availability_set.cmo \ - asmcomp/mach.cmo asmcomp/proc.cmo \ - asmcomp/afl_instrument.cmo \ - asmcomp/strmatch.cmo \ - asmcomp/cmmgen_state.cmo \ - asmcomp/cmm_helpers.cmo \ - asmcomp/cmmgen.cmo \ - asmcomp/interval.cmo \ - asmcomp/printmach.cmo asmcomp/selectgen.cmo \ - asmcomp/spacetime_profiling.cmo asmcomp/selection.cmo \ - asmcomp/comballoc.cmo \ - asmcomp/CSEgen.cmo asmcomp/CSE.cmo \ - asmcomp/liveness.cmo \ - asmcomp/spill.cmo asmcomp/split.cmo \ - asmcomp/interf.cmo asmcomp/coloring.cmo \ - asmcomp/linscan.cmo \ - asmcomp/reloadgen.cmo asmcomp/reload.cmo \ - asmcomp/deadcode.cmo \ - asmcomp/linear.cmo asmcomp/printlinear.cmo asmcomp/linearize.cmo \ - asmcomp/debug/available_regs.cmo \ - asmcomp/debug/compute_ranges_intf.cmo \ - asmcomp/debug/compute_ranges.cmo \ - asmcomp/schedgen.cmo asmcomp/scheduling.cmo \ - asmcomp/branch_relaxation_intf.cmo \ - asmcomp/branch_relaxation.cmo \ - asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \ - asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo \ - driver/opterrors.cmo driver/optcompile.cmo - -# 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 -# the native code compiler is not present for some particular target. - -MIDDLE_END_CLOSURE=\ - middle_end/closure/closure.cmo \ - middle_end/closure/closure_middle_end.cmo - -# Owing to dependencies through [Compilenv], which would be -# difficult to remove, some of the lower parts of Flambda (anything that is -# saved in a .cmx file) have to be included in the [MIDDLE_END] stanza, below. -MIDDLE_END_FLAMBDA=\ - middle_end/flambda/import_approx.cmo \ - middle_end/flambda/lift_code.cmo \ - middle_end/flambda/closure_conversion_aux.cmo \ - middle_end/flambda/closure_conversion.cmo \ - middle_end/flambda/initialize_symbol_to_let_symbol.cmo \ - middle_end/flambda/lift_let_to_initialize_symbol.cmo \ - middle_end/flambda/find_recursive_functions.cmo \ - middle_end/flambda/invariant_params.cmo \ - middle_end/flambda/inconstant_idents.cmo \ - middle_end/flambda/alias_analysis.cmo \ - middle_end/flambda/lift_constants.cmo \ - middle_end/flambda/share_constants.cmo \ - middle_end/flambda/simplify_common.cmo \ - middle_end/flambda/remove_unused_arguments.cmo \ - middle_end/flambda/remove_unused_closure_vars.cmo \ - middle_end/flambda/remove_unused_program_constructs.cmo \ - middle_end/flambda/simplify_boxed_integer_ops.cmo \ - middle_end/flambda/simplify_primitives.cmo \ - middle_end/flambda/inlining_stats_types.cmo \ - middle_end/flambda/inlining_stats.cmo \ - middle_end/flambda/inline_and_simplify_aux.cmo \ - middle_end/flambda/remove_free_vars_equal_to_args.cmo \ - middle_end/flambda/extract_projections.cmo \ - middle_end/flambda/augment_specialised_args.cmo \ - middle_end/flambda/unbox_free_vars_of_closures.cmo \ - middle_end/flambda/unbox_specialised_args.cmo \ - middle_end/flambda/unbox_closures.cmo \ - middle_end/flambda/inlining_transforms.cmo \ - middle_end/flambda/inlining_decision.cmo \ - middle_end/flambda/inline_and_simplify.cmo \ - middle_end/flambda/ref_to_variables.cmo \ - middle_end/flambda/flambda_invariants.cmo \ - middle_end/flambda/traverse_for_exported_symbols.cmo \ - middle_end/flambda/build_export_info.cmo \ - middle_end/flambda/closure_offsets.cmo \ - middle_end/flambda/un_anf.cmo \ - middle_end/flambda/flambda_to_clambda.cmo \ - middle_end/flambda/flambda_middle_end.cmo - -MIDDLE_END=\ - middle_end/internal_variable_names.cmo \ - middle_end/linkage_name.cmo \ - middle_end/compilation_unit.cmo \ - middle_end/variable.cmo \ - middle_end/flambda/base_types/closure_element.cmo \ - middle_end/flambda/base_types/closure_id.cmo \ - middle_end/symbol.cmo \ - middle_end/backend_var.cmo \ - middle_end/clambda_primitives.cmo \ - middle_end/printclambda_primitives.cmo \ - middle_end/clambda.cmo \ - middle_end/printclambda.cmo \ - middle_end/semantics_of_primitives.cmo \ - middle_end/convert_primitives.cmo \ - middle_end/flambda/base_types/id_types.cmo \ - middle_end/flambda/base_types/export_id.cmo \ - middle_end/flambda/base_types/tag.cmo \ - middle_end/flambda/base_types/mutable_variable.cmo \ - middle_end/flambda/base_types/set_of_closures_id.cmo \ - middle_end/flambda/base_types/set_of_closures_origin.cmo \ - middle_end/flambda/base_types/closure_origin.cmo \ - middle_end/flambda/base_types/var_within_closure.cmo \ - middle_end/flambda/base_types/static_exception.cmo \ - middle_end/flambda/pass_wrapper.cmo \ - middle_end/flambda/allocated_const.cmo \ - middle_end/flambda/parameter.cmo \ - middle_end/flambda/projection.cmo \ - middle_end/flambda/flambda.cmo \ - middle_end/flambda/flambda_iterators.cmo \ - middle_end/flambda/flambda_utils.cmo \ - middle_end/flambda/freshening.cmo \ - middle_end/flambda/effect_analysis.cmo \ - middle_end/flambda/inlining_cost.cmo \ - middle_end/flambda/simple_value_approx.cmo \ - middle_end/flambda/export_info.cmo \ - middle_end/flambda/export_info_for_pack.cmo \ - middle_end/compilenv.cmo \ - $(MIDDLE_END_CLOSURE) \ - $(MIDDLE_END_FLAMBDA) - -OPTCOMP=$(MIDDLE_END) $(ASMCOMP) - -TOPLEVEL=toplevel/genprintval.cmo toplevel/toploop.cmo \ - toplevel/trace.cmo toplevel/topdirs.cmo toplevel/topmain.cmo - -OPTTOPLEVEL=toplevel/genprintval.cmo toplevel/opttoploop.cmo \ - toplevel/opttopdirs.cmo toplevel/opttopmain.cmo BYTESTART=driver/main.cmo OPTSTART=driver/optmain.cmo @@ -319,6 +108,9 @@ endif else endif +# targets for the compilerlibs/*.{cma,cmxa} archives +include compilerlibs/Makefile.compilerlibs + # The configuration file utils/config.ml: utils/config.mlp Makefile.config utils/Makefile @@ -788,20 +580,8 @@ manual-pregen: opt.opt # The clean target clean:: partialclean -# Shared parts of the system - -compilerlibs/ocamlcommon.cma: $(COMMON) - $(CAMLC) -a -linkall -o $@ $^ -partialclean:: - rm -f compilerlibs/ocamlcommon.cma - # The bytecode compiler -compilerlibs/ocamlbytecomp.cma: $(BYTECOMP) - $(CAMLC) -a -o $@ $^ -partialclean:: - rm -f compilerlibs/ocamlbytecomp.cma - ocamlc: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma $(BYTESTART) $(CAMLC) $(LINKFLAGS) -compat-32 -o $@ $^ @@ -810,12 +590,6 @@ partialclean:: # The native-code compiler -compilerlibs/ocamloptcomp.cma: $(OPTCOMP) - $(CAMLC) -a -o $@ $^ - -partialclean:: - rm -f compilerlibs/ocamloptcomp.cma - ocamlopt: compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma \ $(OPTSTART) $(CAMLC) $(LINKFLAGS) -o $@ $^ @@ -825,11 +599,6 @@ partialclean:: # The toplevel -compilerlibs/ocamltoplevel.cma: $(TOPLEVEL) - $(CAMLC) -a -o $@ $^ -partialclean:: - rm -f compilerlibs/ocamltoplevel.cma - ocaml_dependencies := \ compilerlibs/ocamlcommon.cma \ compilerlibs/ocamlbytecomp.cma \ @@ -877,20 +646,8 @@ partialclean:: beforedepend:: parsing/lexer.ml -# Shared parts of the system compiled with the native-code compiler - -compilerlibs/ocamlcommon.cmxa: $(COMMON:.cmo=.cmx) - $(CAMLOPT) -a -linkall -o $@ $^ -partialclean:: - rm -f compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlcommon.$(A) - # The bytecode compiler compiled with the native-code compiler -compilerlibs/ocamlbytecomp.cmxa: $(BYTECOMP:.cmo=.cmx) - $(CAMLOPT) -a $(OCAML_NATDYNLINKOPTS) -o $@ $^ -partialclean:: - rm -f compilerlibs/ocamlbytecomp.cmxa compilerlibs/ocamlbytecomp.$(A) - ocamlc.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \ $(BYTESTART:.cmo=.cmx) $(CAMLOPT_CMD) $(LINKFLAGS) -o $@ $^ -cclib "$(BYTECCLIBS)" @@ -900,11 +657,6 @@ partialclean:: # The native-code compiler compiled with itself -compilerlibs/ocamloptcomp.cmxa: $(OPTCOMP:.cmo=.cmx) - $(CAMLOPT) -a -o $@ $^ -partialclean:: - rm -f compilerlibs/ocamloptcomp.cmxa compilerlibs/ocamloptcomp.$(A) - ocamlopt.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \ $(OPTSTART:.cmo=.cmx) $(CAMLOPT_CMD) $(LINKFLAGS) -o $@ $^ @@ -912,8 +664,6 @@ ocamlopt.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \ partialclean:: rm -f ocamlopt.opt -$(COMMON:.cmo=.cmx) $(BYTECOMP:.cmo=.cmx) $(OPTCOMP:.cmo=.cmx): ocamlopt - # The predefined exceptions and primitives runtime/primitives: @@ -1189,17 +939,6 @@ lintapidiff: grep -Ev internal\|obj\|spacetime\|stdLabels\|moreLabels |\ tools/lintapidiff.opt $(VERSIONS) -# The middle end. - -compilerlibs/ocamlmiddleend.cma: $(MIDDLE_END) - $(CAMLC) -a -o $@ $^ -compilerlibs/ocamlmiddleend.cmxa: $(MIDDLE_END:%.cmo=%.cmx) - $(CAMLOPT) -a -o $@ $^ -partialclean:: - rm -f compilerlibs/ocamlmiddleend.cma \ - compilerlibs/ocamlmiddleend.cmxa \ - compilerlibs/ocamlmiddleend.$(A) - # Tools .PHONY: ocamltools @@ -1249,11 +988,6 @@ endif # The native toplevel -compilerlibs/ocamlopttoplevel.cmxa: $(OPTTOPLEVEL:.cmo=.cmx) - $(CAMLOPT) -a -o $@ $^ -partialclean:: - rm -f compilerlibs/ocamlopttoplevel.cmxa - # When the native toplevel executable has an extension (e.g. ".exe"), # provide a phony 'ocamlnat' synonym diff --git a/compilerlibs/.gitignore b/compilerlibs/.gitignore index c1eda49d0..a94f12c40 100644 --- a/compilerlibs/.gitignore +++ b/compilerlibs/.gitignore @@ -1,7 +1,2 @@ -# This .gitignore is here to force git to create the compilerlibs directory -# because git doesn't create empty directories. -# The lines tell git to ignore everything in this directory except -# the .gitignore file itself. - -* -!.gitignore +*.cma +*.cmxa diff --git a/compilerlibs/Makefile.compilerlibs b/compilerlibs/Makefile.compilerlibs new file mode 100644 index 000000000..d35f3b093 --- /dev/null +++ b/compilerlibs/Makefile.compilerlibs @@ -0,0 +1,288 @@ +#************************************************************************** +#* * +#* OCaml * +#* * +#* Xavier Leroy, projet Cristal, INRIA Rocquencourt * +#* * +#* Copyright 1999 Institut National de Recherche en Informatique et * +#* en Automatique. * +#* * +#* All rights reserved. This file is distributed under the terms of * +#* the GNU Lesser General Public License version 2.1, with the * +#* special exception on linking described in the file LICENSE. * +#* * +#************************************************************************** + +# Targets and dependencies for compilerlibs archives + +# 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). + +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 \ + utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \ + utils/consistbl.cmo utils/strongly_connected_components.cmo \ + utils/targetint.cmo utils/int_replace_polymorphic_compare.cmo \ + utils/domainstate.cmo + +PARSING=parsing/location.cmo parsing/longident.cmo \ + parsing/docstrings.cmo parsing/syntaxerr.cmo \ + parsing/ast_helper.cmo \ + parsing/pprintast.cmo \ + parsing/camlinternalMenhirLib.cmo parsing/parser.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 + +TYPING=typing/ident.cmo typing/path.cmo \ + typing/primitive.cmo typing/type_immediacy.cmo typing/types.cmo \ + typing/btype.cmo typing/oprint.cmo \ + typing/subst.cmo typing/predef.cmo \ + typing/datarepr.cmo file_formats/cmi_format.cmo \ + typing/persistent_env.cmo typing/env.cmo \ + typing/typedtree.cmo typing/printtyped.cmo typing/ctype.cmo \ + typing/printtyp.cmo typing/includeclass.cmo \ + typing/mtype.cmo typing/envaux.cmo typing/includecore.cmo \ + typing/tast_iterator.cmo typing/tast_mapper.cmo \ + file_formats/cmt_format.cmo typing/untypeast.cmo \ + typing/includemod.cmo typing/typetexp.cmo typing/printpat.cmo \ + typing/parmatch.cmo typing/stypes.cmo \ + typing/typedecl_properties.cmo typing/typedecl_variance.cmo \ + typing/typedecl_unboxed.cmo typing/typedecl_immediacy.cmo \ + typing/typedecl.cmo typing/typeopt.cmo \ + typing/rec_check.cmo typing/typecore.cmo typing/typeclass.cmo \ + typing/typemod.cmo + +LAMBDA=lambda/debuginfo.cmo \ + lambda/lambda.cmo lambda/printlambda.cmo \ + lambda/switch.cmo lambda/matching.cmo \ + lambda/translobj.cmo lambda/translattribute.cmo \ + lambda/translprim.cmo lambda/translcore.cmo \ + lambda/translclass.cmo lambda/translmod.cmo \ + lambda/simplif.cmo lambda/runtimedef.cmo + +COMP=\ + bytecomp/meta.cmo bytecomp/opcodes.cmo \ + bytecomp/bytesections.cmo bytecomp/dll.cmo \ + bytecomp/symtable.cmo \ + driver/pparse.cmo driver/compenv.cmo \ + driver/main_args.cmo driver/compmisc.cmo \ + driver/makedepend.cmo \ + driver/compile_common.cmo + +COMMON=$(UTILS) $(PARSING) $(TYPING) $(LAMBDA) $(COMP) + +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 + +ARCH_SPECIFIC =\ + asmcomp/arch.ml asmcomp/proc.ml asmcomp/CSE.ml asmcomp/selection.ml \ + asmcomp/scheduling.ml asmcomp/reload.ml + +INTEL_ASM=\ + asmcomp/x86_proc.cmo \ + asmcomp/x86_dsl.cmo \ + asmcomp/x86_gas.cmo \ + asmcomp/x86_masm.cmo + +ARCH_SPECIFIC_ASMCOMP= +ifeq ($(ARCH),i386) +ARCH_SPECIFIC_ASMCOMP=$(INTEL_ASM) +endif +ifeq ($(ARCH),amd64) +ARCH_SPECIFIC_ASMCOMP=$(INTEL_ASM) +endif + +ASMCOMP=\ + $(ARCH_SPECIFIC_ASMCOMP) \ + asmcomp/arch.cmo \ + asmcomp/cmm.cmo asmcomp/printcmm.cmo \ + asmcomp/reg.cmo asmcomp/debug/reg_with_debug_info.cmo \ + asmcomp/debug/reg_availability_set.cmo \ + asmcomp/mach.cmo asmcomp/proc.cmo \ + asmcomp/afl_instrument.cmo \ + asmcomp/strmatch.cmo \ + asmcomp/cmmgen_state.cmo \ + asmcomp/cmm_helpers.cmo \ + asmcomp/cmmgen.cmo \ + asmcomp/interval.cmo \ + asmcomp/printmach.cmo asmcomp/selectgen.cmo \ + asmcomp/spacetime_profiling.cmo asmcomp/selection.cmo \ + asmcomp/comballoc.cmo \ + asmcomp/CSEgen.cmo asmcomp/CSE.cmo \ + asmcomp/liveness.cmo \ + asmcomp/spill.cmo asmcomp/split.cmo \ + asmcomp/interf.cmo asmcomp/coloring.cmo \ + asmcomp/linscan.cmo \ + asmcomp/reloadgen.cmo asmcomp/reload.cmo \ + asmcomp/deadcode.cmo \ + asmcomp/linear.cmo asmcomp/printlinear.cmo asmcomp/linearize.cmo \ + asmcomp/debug/available_regs.cmo \ + asmcomp/debug/compute_ranges_intf.cmo \ + asmcomp/debug/compute_ranges.cmo \ + asmcomp/schedgen.cmo asmcomp/scheduling.cmo \ + asmcomp/branch_relaxation_intf.cmo \ + asmcomp/branch_relaxation.cmo \ + asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \ + asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo \ + driver/opterrors.cmo driver/optcompile.cmo + +# 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 +# the native code compiler is not present for some particular target. + +MIDDLE_END_CLOSURE=\ + middle_end/closure/closure.cmo \ + middle_end/closure/closure_middle_end.cmo + +# Owing to dependencies through [Compilenv], which would be +# difficult to remove, some of the lower parts of Flambda (anything that is +# saved in a .cmx file) have to be included in the [MIDDLE_END] stanza, below. +MIDDLE_END_FLAMBDA=\ + middle_end/flambda/import_approx.cmo \ + middle_end/flambda/lift_code.cmo \ + middle_end/flambda/closure_conversion_aux.cmo \ + middle_end/flambda/closure_conversion.cmo \ + middle_end/flambda/initialize_symbol_to_let_symbol.cmo \ + middle_end/flambda/lift_let_to_initialize_symbol.cmo \ + middle_end/flambda/find_recursive_functions.cmo \ + middle_end/flambda/invariant_params.cmo \ + middle_end/flambda/inconstant_idents.cmo \ + middle_end/flambda/alias_analysis.cmo \ + middle_end/flambda/lift_constants.cmo \ + middle_end/flambda/share_constants.cmo \ + middle_end/flambda/simplify_common.cmo \ + middle_end/flambda/remove_unused_arguments.cmo \ + middle_end/flambda/remove_unused_closure_vars.cmo \ + middle_end/flambda/remove_unused_program_constructs.cmo \ + middle_end/flambda/simplify_boxed_integer_ops.cmo \ + middle_end/flambda/simplify_primitives.cmo \ + middle_end/flambda/inlining_stats_types.cmo \ + middle_end/flambda/inlining_stats.cmo \ + middle_end/flambda/inline_and_simplify_aux.cmo \ + middle_end/flambda/remove_free_vars_equal_to_args.cmo \ + middle_end/flambda/extract_projections.cmo \ + middle_end/flambda/augment_specialised_args.cmo \ + middle_end/flambda/unbox_free_vars_of_closures.cmo \ + middle_end/flambda/unbox_specialised_args.cmo \ + middle_end/flambda/unbox_closures.cmo \ + middle_end/flambda/inlining_transforms.cmo \ + middle_end/flambda/inlining_decision.cmo \ + middle_end/flambda/inline_and_simplify.cmo \ + middle_end/flambda/ref_to_variables.cmo \ + middle_end/flambda/flambda_invariants.cmo \ + middle_end/flambda/traverse_for_exported_symbols.cmo \ + middle_end/flambda/build_export_info.cmo \ + middle_end/flambda/closure_offsets.cmo \ + middle_end/flambda/un_anf.cmo \ + middle_end/flambda/flambda_to_clambda.cmo \ + middle_end/flambda/flambda_middle_end.cmo + +MIDDLE_END=\ + middle_end/internal_variable_names.cmo \ + middle_end/linkage_name.cmo \ + middle_end/compilation_unit.cmo \ + middle_end/variable.cmo \ + middle_end/flambda/base_types/closure_element.cmo \ + middle_end/flambda/base_types/closure_id.cmo \ + middle_end/symbol.cmo \ + middle_end/backend_var.cmo \ + middle_end/clambda_primitives.cmo \ + middle_end/printclambda_primitives.cmo \ + middle_end/clambda.cmo \ + middle_end/printclambda.cmo \ + middle_end/semantics_of_primitives.cmo \ + middle_end/convert_primitives.cmo \ + middle_end/flambda/base_types/id_types.cmo \ + middle_end/flambda/base_types/export_id.cmo \ + middle_end/flambda/base_types/tag.cmo \ + middle_end/flambda/base_types/mutable_variable.cmo \ + middle_end/flambda/base_types/set_of_closures_id.cmo \ + middle_end/flambda/base_types/set_of_closures_origin.cmo \ + middle_end/flambda/base_types/closure_origin.cmo \ + middle_end/flambda/base_types/var_within_closure.cmo \ + middle_end/flambda/base_types/static_exception.cmo \ + middle_end/flambda/pass_wrapper.cmo \ + middle_end/flambda/allocated_const.cmo \ + middle_end/flambda/parameter.cmo \ + middle_end/flambda/projection.cmo \ + middle_end/flambda/flambda.cmo \ + middle_end/flambda/flambda_iterators.cmo \ + middle_end/flambda/flambda_utils.cmo \ + middle_end/flambda/freshening.cmo \ + middle_end/flambda/effect_analysis.cmo \ + middle_end/flambda/inlining_cost.cmo \ + middle_end/flambda/simple_value_approx.cmo \ + middle_end/flambda/export_info.cmo \ + middle_end/flambda/export_info_for_pack.cmo \ + middle_end/compilenv.cmo \ + $(MIDDLE_END_CLOSURE) \ + $(MIDDLE_END_FLAMBDA) + +OPTCOMP=$(MIDDLE_END) $(ASMCOMP) + +TOPLEVEL=toplevel/genprintval.cmo toplevel/toploop.cmo \ + toplevel/trace.cmo toplevel/topdirs.cmo toplevel/topmain.cmo + +OPTTOPLEVEL=toplevel/genprintval.cmo toplevel/opttoploop.cmo \ + toplevel/opttopdirs.cmo toplevel/opttopmain.cmo + +$(COMMON:.cmo=.cmx) $(BYTECOMP:.cmo=.cmx) $(OPTCOMP:.cmo=.cmx): ocamlopt +$(OPTTOPLEVEL:.cmo=.cmx): ocamlopt + +compilerlibs/ocamlcommon.cma: $(COMMON) + $(CAMLC) -a -linkall -o $@ $^ +partialclean:: + rm -f compilerlibs/ocamlcommon.cma + +compilerlibs/ocamlcommon.cmxa: $(COMMON:.cmo=.cmx) + $(CAMLOPT) -a -linkall -o $@ $^ +partialclean:: + rm -f compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlcommon.$(A) + + +compilerlibs/ocamlbytecomp.cma: $(BYTECOMP) + $(CAMLC) -a -o $@ $^ +partialclean:: + rm -f compilerlibs/ocamlbytecomp.cma + +compilerlibs/ocamlbytecomp.cmxa: $(BYTECOMP:.cmo=.cmx) + $(CAMLOPT) -a $(OCAML_NATDYNLINKOPTS) -o $@ $^ +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 $@ $^ +partialclean:: + rm -f compilerlibs/ocamlmiddleend.cma \ + compilerlibs/ocamlmiddleend.cmxa \ + compilerlibs/ocamlmiddleend.$(A) + + +compilerlibs/ocamloptcomp.cma: $(OPTCOMP) + $(CAMLC) -a -o $@ $^ +partialclean:: + rm -f compilerlibs/ocamloptcomp.cma + +compilerlibs/ocamloptcomp.cmxa: $(OPTCOMP:.cmo=.cmx) + $(CAMLOPT) -a -o $@ $^ +partialclean:: + rm -f compilerlibs/ocamloptcomp.cmxa compilerlibs/ocamloptcomp.$(A) + + +compilerlibs/ocamltoplevel.cma: $(TOPLEVEL) + $(CAMLC) -a -o $@ $^ +partialclean:: + rm -f compilerlibs/ocamltoplevel.cma + +compilerlibs/ocamlopttoplevel.cmxa: $(OPTTOPLEVEL:.cmo=.cmx) + $(CAMLOPT) -a -o $@ $^ +partialclean:: + rm -f compilerlibs/ocamlopttoplevel.cmxa \ + compilerlibs/ocamlopttoplevel.$(A)