summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Hinderer <Sebastien.Hinderer@inria.fr>2022-05-10 18:48:14 +0200
committerSébastien Hinderer <Sebastien.Hinderer@inria.fr>2022-05-11 12:48:50 +0200
commit7242606db68c20884ace4a1e4e7bea7be216b78c (patch)
treeb485ff3ddfd511ad283fc84bc0dfa5f2f8814a67
parenta66250f8fd320b3158e26cf04210e78a4fde4fe5 (diff)
downloadocaml-7242606db68c20884ace4a1e4e7bea7be216b78c.tar.gz
Merge runtime/Makefile in the root Makefile
This commit moves the computed dependencies of C files from runtime/.dep to .dep/runtime.
-rw-r--r--.gitignore2
-rw-r--r--Makefile487
-rw-r--r--Makefile.build_config.in2
-rw-r--r--Makefile.common1
-rw-r--r--runtime/Makefile458
-rwxr-xr-xruntime/gen_primitives.sh5
6 files changed, 469 insertions, 486 deletions
diff --git a/.gitignore b/.gitignore
index c34c9daf05..3c15cfcd21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,7 @@ _build
# local to root directory
+/.dep
/Makefile.build_config
/Makefile.config
/autom4te.cache
@@ -168,7 +169,6 @@ _build
/runtime/ocamlruni
/runtime/ld.conf
/runtime/.gdb_history
-/runtime/.dep
/runtime/build_config.h
/runtime/sak
/runtime/domain_state32.inc
diff --git a/Makefile b/Makefile
index 18934c15da..9510d68c23 100644
--- a/Makefile
+++ b/Makefile
@@ -150,9 +150,8 @@ FLEXDLL_SOURCE_FILES = \
$(wildcard $(FLEXDLL_SOURCES)/*.c) $(wildcard $(FLEXDLL_SOURCES)/*.h) \
$(wildcard $(FLEXDLL_SOURCES)/*.ml)
-boot/ocamlruns$(EXE):
- $(MAKE) -C runtime ocamlruns$(EXE)
- cp runtime/ocamlruns$(EXE) boot/ocamlruns$(EXE)
+boot/ocamlruns$(EXE): runtime/ocamlruns$(EXE)
+ cp $< $@
boot/flexlink.byte$(EXE): $(FLEXDLL_SOURCE_FILES)
$(MAKE) -C $(FLEXDLL_SOURCES) $(FLEXLINK_BUILD_ENV) \
@@ -177,7 +176,7 @@ boot/flexlink.byte$(EXE): $(FLEXDLL_SOURCE_FILES)
.PHONY: coldstart
coldstart: $(COLDSTART_DEPS)
ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false"
- $(MAKE) -C runtime all
+ $(MAKE) runtime-all
$(MAKE) -C stdlib \
OCAMLRUN='$$(ROOTDIR)/runtime/ocamlrun$(EXE)' \
CAMLC='$$(BOOT_OCAMLC) $(USE_RUNTIME_PRIMS)' all
@@ -185,7 +184,7 @@ else
$(MAKE) -C stdlib OCAMLRUN='$$(ROOTDIR)/boot/ocamlruns$(EXE)' \
CAMLC='$$(BOOT_OCAMLC)' all
$(MAKE) boot/flexlink.byte$(EXE)
- $(MAKE) -C runtime $(BOOT_FLEXLINK_CMD) all
+ $(MAKE) $(BOOT_FLEXLINK_CMD) runtime-all
endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false"
cp runtime/ocamlrun$(EXE) boot/ocamlrun$(EXE)
cd boot; rm -f $(LIBFILES)
@@ -523,9 +522,6 @@ partialclean::
# The predefined exceptions and primitives
-runtime/primitives:
- $(MAKE) -C runtime primitives
-
lambda/runtimedef.ml: lambda/generate_runtimedef.sh runtime/caml/fail.h \
runtime/primitives
$^ > $@
@@ -581,10 +577,437 @@ $(expunge): compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma \
partialclean::
rm -f $(expunge)
-# The runtime system for the bytecode compiler
+# The runtime system
+
+## Lists of source files
+
+runtime_COMMON_C_SOURCES = \
+ addrmap \
+ afl \
+ alloc \
+ array \
+ backtrace \
+ bigarray \
+ callback \
+ codefrag \
+ compare \
+ custom \
+ debugger \
+ domain \
+ dynlink \
+ eventlog \
+ extern \
+ fiber \
+ finalise \
+ floats \
+ gc_ctrl \
+ gc_stats \
+ globroots \
+ hash \
+ intern \
+ ints \
+ io \
+ lexing \
+ lf_skiplist \
+ main \
+ major_gc \
+ md5 \
+ memory \
+ memprof \
+ meta \
+ minor_gc \
+ misc \
+ obj \
+ parsing \
+ platform \
+ printexc \
+ prng \
+ roots \
+ shared_heap \
+ signals \
+ skiplist \
+ startup_aux \
+ str \
+ sync \
+ sys \
+ $(UNIX_OR_WIN32) \
+ weak
+
+runtime_BYTECODE_ONLY_C_SOURCES = \
+ backtrace_byt \
+ fail_byt \
+ fix_code \
+ interp \
+ startup_byt
+runtime_BYTECODE_C_SOURCES = \
+ $(runtime_COMMON_C_SOURCES:%=runtime/%.c) \
+ $(runtime_BYTECODE_ONLY_C_SOURCES:%=runtime/%.c)
+
+runtime_NATIVE_ONLY_C_SOURCES = \
+ backtrace_nat \
+ clambda_checks \
+ dynlink_nat \
+ fail_nat \
+ frame_descriptors \
+ startup_nat \
+ signals_nat
+runtime_NATIVE_C_SOURCES = \
+ $(runtime_COMMON_C_SOURCES:%=runtime/%.c) \
+ $(runtime_NATIVE_ONLY_C_SOURCES:%=runtime/%.c)
+
+## Header files generated by configure
+runtime_CONFIGURED_HEADERS = $(addprefix runtime/caml/, m.h s.h version.h)
+
+## Header files generated by make
+runtime_BUILT_HEADERS = $(addprefix runtime/, \
+ caml/opnames.h caml/jumptbl.h build_config.h)
+
+## Targets to build and install
+
+runtime_PROGRAMS = runtime/ocamlrun$(EXE)
+runtime_BYTECODE_STATIC_LIBRARIES = $(addprefix runtime/, \
+ ld.conf libcamlrun.$(A))
+runtime_BYTECODE_SHARED_LIBRARIES =
+runtime_NATIVE_STATIC_LIBRARIES = runtime/libasmrun.$(A)
+runtime_NATIVE_SHARED_LIBRARIES =
+
+ifeq "$(RUNTIMED)" "true"
+runtime_PROGRAMS += runtime/ocamlrund$(EXE)
+runtime_BYTECODE_STATIC_LIBRARIES += runtime/libcamlrund.$(A)
+runtime_NATIVE_STATIC_LIBRARIES += runtime/libasmrund.$(A)
+endif
+
+ifeq "$(INSTRUMENTED_RUNTIME)" "true"
+runtime_PROGRAMS += runtime/ocamlruni$(EXE)
+runtime_BYTECODE_STATIC_LIBRARIES += runtime/libcamlruni.$(A)
+runtime_NATIVE_STATIC_LIBRARIES += runtime/libasmruni.$(A)
+endif
+
+ifeq "$(UNIX_OR_WIN32)" "unix"
+ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
+runtime_BYTECODE_STATIC_LIBRARIES += runtime/libcamlrun_pic.$(A)
+runtime_BYTECODE_SHARED_LIBRARIES += runtime/libcamlrun_shared.$(SO)
+runtime_NATIVE_STATIC_LIBRARIES += runtime/libasmrun_pic.$(A)
+runtime_NATIVE_SHARED_LIBRARIES += runtime/libasmrun_shared.$(SO)
+endif
+endif
+
+## List of object files for each target
+
+libcamlrun_OBJECTS = $(runtime_BYTECODE_C_SOURCES:.c=.b.$(O))
+
+libcamlrun_non_shared_OBJECTS = \
+ $(subst $(UNIX_OR_WIN32).b.$(O),$(UNIX_OR_WIN32)_non_shared.b.$(O), \
+ $(libcamlrun_OBJECTS))
+
+libcamlrund_OBJECTS = $(runtime_BYTECODE_C_SOURCES:.c=.bd.$(O)) \
+ runtime/instrtrace.bd.$(O)
+
+libcamlruni_OBJECTS = $(runtime_BYTECODE_C_SOURCES:.c=.bi.$(O))
+
+libcamlrunpic_OBJECTS = $(runtime_BYTECODE_C_SOURCES:.c=.bpic.$(O))
+
+libasmrun_OBJECTS = \
+ $(runtime_NATIVE_C_SOURCES:.c=.n.$(O)) $(runtime_ASM_OBJECTS)
+
+libasmrund_OBJECTS = \
+ $(runtime_NATIVE_C_SOURCES:.c=.nd.$(O)) $(runtime_ASM_OBJECTS:.$(O)=.d.$(O))
+
+libasmruni_OBJECTS = \
+ $(runtime_NATIVE_C_SOURCES:.c=.ni.$(O)) $(runtime_ASM_OBJECTS:.$(O)=.i.$(O))
+
+libasmrunpic_OBJECTS = $(runtime_NATIVE_C_SOURCES:.c=.npic.$(O)) \
+ $(runtime_ASM_OBJECTS:.$(O)=_libasmrunpic.$(O))
+
+## General (non target-specific) assembler and compiler flags
+
+runtime_CPPFLAGS = -DCAMLDLLIMPORT=
+ocamlrund_CPPFLAGS = -DDEBUG
+ocamlruni_CPPFLAGS = -DCAML_INSTR
+
+## Runtime targets
+
+.PHONY: runtime-all
+runtime-all: \
+ $(runtime_BYTECODE_STATIC_LIBRARIES) $(runtime_BYTECODE_SHARED_LIBRARIES) \
+ $(runtime_PROGRAMS) $(SAK)
+
+.PHONY: runtime-allopt
+ifneq "$(NATIVE_COMPILER)" "false"
+runtime-allopt: \
+ $(runtime_NATIVE_STATIC_LIBRARIES) $(runtime_NATIVE_SHARED_LIBRARIES)
+else
+runtime-allopt:
+ $(error The build has been configured with --disable-native-compiler)
+endif
+
+## Generated non-object files
+
+runtime/ld.conf: $(ROOTDIR)/Makefile.config
+ echo "$(STUBLIBDIR)" > $@
+ echo "$(LIBDIR)" >> $@
+
+# If primitives contain duplicated lines (e.g. because the code is defined
+# like
+# #ifdef X
+# CAMLprim value caml_foo() ...
+# #else
+# CAMLprim value caml_foo() ...
+# #endif), horrible things will happen: duplicated entries in Runtimedef ->
+# double registration in Symtable -> empty entry in the PRIM table ->
+# the bytecode interpreter is confused.
+# We sort the primitive file and remove duplicates to avoid this problem.
+
+# Warning: we use "sort | uniq" instead of "sort -u" because in the MSVC
+# port, the "sort" program in the path is Microsoft's and not cygwin's
+
+# Warning: POSIX sort is locale dependent, that's why we set LC_ALL explicitly.
+# Sort is unstable for "is_directory" and "isatty"
+# see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html:
+# "using sort to process pathnames, it is recommended that LC_ALL .. set to C"
+
+# To speed up builds, we avoid changing "primitives" when files
+# containing primitives change but the primitives table does not
+runtime/primitives: \
+ $(shell runtime/gen_primitives.sh > runtime/primitives.new; \
+ cmp -s runtime/primitives runtime/primitives.new || \
+ echo runtime/primitives.new)
+ cp $^ $@
+
+runtime/prims.c : runtime/primitives
+ (echo '#define CAML_INTERNALS'; \
+ echo '#include "caml/mlvalues.h"'; \
+ echo '#include "caml/prims.h"'; \
+ sed -e 's/.*/extern value &();/' $<; \
+ echo 'c_primitive caml_builtin_cprim[] = {'; \
+ sed -e 's/.*/ &,/' $<; \
+ echo ' 0 };'; \
+ echo 'char * caml_names_of_builtin_cprim[] = {'; \
+ sed -e 's/.*/ "&",/' $<; \
+ echo ' 0 };') > $@
+
+runtime/caml/opnames.h : runtime/caml/instruct.h
+ tr -d '\r' < $< | \
+ sed -e '/\/\*/d' \
+ -e '/^#/d' \
+ -e 's/enum /static char * names_of_/' \
+ -e 's/{$$/[] = {/' \
+ -e 's/\([[:upper:]][[:upper:]_0-9]*\)/"\1"/g' > $@
+
+# runtime/caml/jumptbl.h is required only if you have GCC 2.0 or later
+runtime/caml/jumptbl.h : runtime/caml/instruct.h
+ tr -d '\r' < $< | \
+ sed -n -e '/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp' \
+ -e '/^}/q' > $@
+
+# These are provided as a temporary shim to allow cross-compilation systems
+# to supply a host C compiler and different flags and a linking macro.
+SAK_CC ?= $(CC)
+SAK_CFLAGS ?= $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS)
+SAK_LINK ?= $(MKEXE_USING_COMPILER)
+
+$(SAK): runtime/sak.$(O)
+ $(call SAK_LINK,$@,$^)
+
+runtime/sak.$(O): runtime/sak.c runtime/caml/misc.h runtime/caml/config.h
+ $(SAK_CC) -c $(SAK_CFLAGS) $(OUTPUTOBJ)$@ $<
+
+C_LITERAL = $(shell $(SAK) encode-C-literal '$(1)')
+
+runtime/build_config.h: $(ROOTDIR)/Makefile.config $(SAK)
+ echo '/* This file is generated from $(ROOTDIR)/Makefile.config */' > $@
+ echo '#define OCAML_STDLIB_DIR $(call C_LITERAL,$(LIBDIR))' >> $@
+ echo '#define HOST "$(HOST)"' >> $@
+
+## Runtime libraries and programs
+
+runtime/ocamlrun$(EXE): runtime/prims.$(O) runtime/libcamlrun.$(A)
+ $(MKEXE) -o $@ $^ $(BYTECCLIBS)
+
+runtime/ocamlruns$(EXE): runtime/prims.$(O) runtime/libcamlrun_non_shared.$(A)
+ $(call MKEXE_USING_COMPILER,$@,$^ $(BYTECCLIBS))
+
+runtime/libcamlrun.$(A): $(libcamlrun_OBJECTS)
+ $(call MKLIB,$@, $^)
+
+runtime/libcamlrun_non_shared.$(A): $(libcamlrun_non_shared_OBJECTS)
+ $(call MKLIB,$@, $^)
+
+runtime/ocamlrund$(EXE): runtime/prims.$(O) runtime/libcamlrund.$(A)
+ $(MKEXE) $(MKEXEDEBUGFLAG) -o $@ $^ $(BYTECCLIBS)
+
+runtime/libcamlrund.$(A): $(libcamlrund_OBJECTS)
+ $(call MKLIB,$@, $^)
+
+runtime/ocamlruni$(EXE): runtime/prims.$(O) runtime/libcamlruni.$(A)
+ $(MKEXE) -o $@ $^ $(INSTRUMENTED_RUNTIME_LIBS) $(BYTECCLIBS)
+
+runtime/libcamlruni.$(A): $(libcamlruni_OBJECTS)
+ $(call MKLIB,$@, $^)
+
+runtime/libcamlrun_pic.$(A): $(libcamlrunpic_OBJECTS)
+ $(call MKLIB,$@, $^)
+
+runtime/libcamlrun_shared.$(SO): $(libcamlrunpic_OBJECTS)
+ $(MKDLL) -o $@ $^ $(BYTECCLIBS)
+
+runtime/libasmrun.$(A): $(libasmrun_OBJECTS)
+ $(call MKLIB,$@, $^)
+
+runtime/libasmrund.$(A): $(libasmrund_OBJECTS)
+ $(call MKLIB,$@, $^)
+
+runtime/libasmruni.$(A): $(libasmruni_OBJECTS)
+ $(call MKLIB,$@, $^)
+
+runtime/libasmrun_pic.$(A): $(libasmrunpic_OBJECTS)
+ $(call MKLIB,$@, $^)
+
+runtime/libasmrun_shared.$(SO): $(libasmrunpic_OBJECTS)
+ $(MKDLL) -o $@ $^ $(NATIVECCLIBS)
+
+## Runtime target-specific preprocessor and compiler flags
+
+runtime/%.$(O): OC_CPPFLAGS += $(runtime_CPPFLAGS)
+$(DEPDIR)/runtime/%.$(D): OC_CPPFLAGS += $(runtime_CPPFLAGS)
+
+runtime/%.bd.$(O): OC_CPPFLAGS += $(ocamlrund_CPPFLAGS)
+$(DEPDIR)/runtime/%.bd.$(D): OC_CPPFLAGS += $(ocamlrund_CPPFLAGS)
+
+runtime/%.bi.$(O): OC_CPPFLAGS += $(ocamlruni_CPPFLAGS)
+$(DEPDIR)/runtime/%.bi.$(D): OC_CPPFLAGS += $(ocamlruni_CPPFLAGS)
+
+runtime/%.bpic.$(O): OC_CFLAGS += $(SHAREDLIB_CFLAGS)
+$(DEPDIR)/runtime/%.bpic.$(D): OC_CFLAGS += $(SHAREDLIB_CFLAGS)
+
+runtime/%.n.$(O): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS)
+$(DEPDIR)/runtime/%.n.$(D): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS)
-$(SAK):
- $(MAKE) -C runtime sak$(EXE)
+runtime/%.nd.$(O): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS) $(ocamlrund_CPPFLAGS)
+$(DEPDIR)/runtime/%.nd.$(D): \
+ OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS) $(ocamlrund_CPPFLAGS)
+
+runtime/%.ni.$(O): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS) $(ocamlruni_CPPFLAGS)
+$(DEPDIR)/runtime/%.ni.$(D): \
+ OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS) $(ocamlruni_CPPFLAGS)
+
+runtime/%.npic.$(O): OC_CFLAGS += $(OC_NATIVE_CPPFLAGS) $(SHAREDLIB_CFLAGS)
+$(DEPDIR)/runtime/%.npic.$(D): \
+ OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS) $(SHAREDLIB_CFLAGS)
+
+## Compilation of runtime C files
+
+# The COMPILE_C_FILE macro below receives as argument the pattern
+# that corresponds to the name of the generated object file
+# (without the extension, which is added by the macro)
+define COMPILE_C_FILE
+ifneq "$(COMPUTE_DEPS)" "false"
+ifneq "$(1)" "%"
+# -MG would ensure that the dependencies are generated even if the files listed
+# in $$(runtime_BUILT_HEADERS) haven't been assembled yet. However,
+# this goes subtly wrong if the user has the headers installed,
+# as gcc will pick up a dependency on those instead and the local
+# ones will not be generated. For this reason, we don't use -MG and
+# instead include $(runtime_BUILT_HEADERS) in the order only dependencies
+# to ensure that they exist before dependencies are computed.
+$(DEPDIR)/$(1).$(D): runtime/%.c | $(DEPDIR)/runtime $(runtime_BUILT_HEADERS)
+ $$(DEP_CC) $$(OC_CPPFLAGS) $$(CPPFLAGS) $$< -MT \
+ 'runtime/$$*$(subst runtime/%,,$(1)).$(O)' -MF $$@
+endif # ifneq "$(1)" "%"
+$(1).$(O): $(2).c
+else
+$(1).$(O): $(2).c \
+ $(runtime_CONFIGURED_HEADERS) $(runtime_BUILT_HEADERS) \
+ $(RUNTIME_HEADERS)
+endif # ifneq "$(COMPUTE_DEPS)" "false"
+ $$(CC) -c $$(OC_CFLAGS) $$(CFLAGS) $$(OC_CPPFLAGS) $$(CPPFLAGS) \
+ $$(OUTPUTOBJ)$$@ $$<
+endef
+
+$(DEPDIR)/runtime:
+ $(MKDIR) $@
+
+runtime_OBJECT_TYPES = % %.b %.bd %.bi %.bpic
+ifneq "$(NATIVE_COMPILER)" "false"
+runtime_OBJECT_TYPES += %.n %.nd %.ni %.np %.npic
+endif
+
+$(foreach runtime_OBJECT_TYPE, $(runtime_OBJECT_TYPES), \
+ $(eval $(call COMPILE_C_FILE,runtime/$(runtime_OBJECT_TYPE),runtime/%)))
+
+runtime/$(UNIX_OR_WIN32)_non_shared.%.$(O): \
+ OC_CPPFLAGS += -DBUILDING_LIBCAMLRUNS
+
+$(eval $(call COMPILE_C_FILE,\
+ runtime/$(UNIX_OR_WIN32)_non_shared.%, runtime/$(UNIX_OR_WIN32)))
+
+$(foreach runtime_OBJECT_TYPE,$(subst %,,$(runtime_OBJECT_TYPES)), \
+ $(eval \
+ runtime/dynlink$(runtime_OBJECT_TYPE).$(O): $(ROOTDIR)/Makefile.config))
+
+## Compilation of runtime assembly files
+
+ASPP_ERROR = \
+ { echo "If your assembler produced syntax errors, it is probably";\
+ echo "unhappy with the preprocessor. Check your assembler, or";\
+ echo "try producing $*.o by hand.";\
+ exit 2; }
+runtime/%.o: runtime/%.S
+ $(ASPP) $(OC_ASPPFLAGS) -o $@ $< || $(ASPP_ERROR)
+
+runtime/%.d.o: runtime/%.S
+ $(ASPP) $(OC_ASPPFLAGS) $(OC_DEBUG_CPPFLAGS) -o $@ $< || $(ASPP_ERROR)
+
+runtime/%.i.o: runtime/%.S
+ $(ASPP) $(OC_ASPPFLAGS) $(OC_INSTR_CPPFLAGS) -o $@ $< || $(ASPP_ERROR)
+
+runtime/%_libasmrunpic.o: runtime/%.S
+ $(ASPP) $(OC_ASPPFLAGS) $(SHAREDLIB_CFLAGS) -o $@ $<
+
+runtime/domain_state64.inc: \
+ runtime/gen_domain_state64_inc.awk runtime/caml/domain_state.tbl
+ $(AWK) -f $^ > $@
+
+runtime/domain_state32.inc: \
+ runtime/gen_domain_state32_inc.awk runtime/caml/domain_state.tbl
+ $(AWK) -f $^ > $@
+
+runtime/amd64nt.obj: runtime/amd64nt.asm runtime/domain_state64.inc
+ $(ASM)$@ $<
+
+runtime/i386nt.obj: runtime/i386nt.asm runtime/domain_state32.inc
+ $(ASM)$@ $<
+
+runtime/amd64nt.d.obj: runtime/amd64nt.asm runtime/domain_state64.inc
+ $(ASM)$@ $(ocamlrund_CPPFLAGS) $<
+
+runtime/i386nt.d.obj: runtime/i386nt.asm runtime/domain_state32.inc
+ $(ASM)$@ $(ocmalrund_CPPFLAGS) $<
+
+runtime/amd64nt.i.obj: runtime/amd64nt.asm runtime/domain_state64.inc
+ $(ASM)$@ $(ocamlruni_CPPFLAGS) $<
+
+runtime/i386nt.i.obj: runtime/i386nt.asm runtime/domain_state32.inc
+ $(ASM)$@ $(ocamlruni_CPPFLAGS) $<
+
+runtime/%_libasmrunpic.obj: runtime/%.asm
+ $(ASM)$@ $<
+
+## Runtime dependencies
+
+runtime_DEP_FILES := $(addsuffix .b, \
+ $(basename $(runtime_BYTECODE_C_SOURCES) runtime/instrtrace))
+ifneq "$(NATIVE_COMPILER)" "false"
+runtime_DEP_FILES += $(addsuffix .n, $(basename $(runtime_NATIVE_C_SOURCES)))
+endif
+runtime_DEP_FILES += $(addsuffix d, $(runtime_DEP_FILES)) \
+ $(addsuffix i, $(runtime_DEP_FILES)) \
+ $(addsuffix pic, $(runtime_DEP_FILES))
+runtime_DEP_FILES := $(addsuffix .$(D), $(runtime_DEP_FILES))
+
+ifeq "$(COMPUTE_DEPS)" "true"
+include $(addprefix $(DEPDIR)/, $(runtime_DEP_FILES))
+endif
.PHONY: runtime
runtime: stdlib/libcamlrun.$(A)
@@ -599,25 +1022,29 @@ endif
.PHONY: makeruntime
makeruntime:
- $(MAKE) -C runtime $(BOOT_FLEXLINK_CMD) all
-runtime/libcamlrun.$(A): makeruntime ;
-stdlib/libcamlrun.$(A): runtime/libcamlrun.$(A)
+ $(MAKE) $(BOOT_FLEXLINK_CMD) runtime-all
+stdlib/libcamlrun.$(A): runtime-all
cd stdlib; $(LN) ../runtime/libcamlrun.$(A) .
clean::
- $(MAKE) -C runtime clean
+ rm -f $(addprefix runtime/, *.o *.obj *.a *.lib *.so *.dll ld.conf)
+ rm -f $(addprefix runtime/, ocamlrun ocamlrund ocamlruni ocamlruns sak)
+ rm -f $(addprefix runtime/, \
+ ocamlrun.exe ocamlrund.exe ocamlruni.exe ocamlruns.exe sak.exe)
+ rm -f runtime/primitives runtime/primitives.new runtime/prims.c \
+ $(runtime_BUILT_HEADERS)
+ rm -f runtime/domain_state*.inc
+ rm -rf $(DEPDIR)/runtime
rm -f stdlib/libcamlrun.a stdlib/libcamlrun.lib
-# The runtime system for the native-code compiler
-
.PHONY: runtimeopt
runtimeopt: stdlib/libasmrun.$(A)
.PHONY: makeruntimeopt
makeruntimeopt:
- $(MAKE) -C runtime $(BOOT_FLEXLINK_CMD) allopt
-runtime/libasmrun.$(A): makeruntimeopt ;
-stdlib/libasmrun.$(A): runtime/libasmrun.$(A)
- cp $< $@
+ $(MAKE) $(BOOT_FLEXLINK_CMD) runtime-allopt
+stdlib/libasmrun.$(A): runtime-allopt
+ cd stdlib; $(LN) ../runtime/libasmrun.$(A) .
+
clean::
rm -f stdlib/libasmrun.a stdlib/libasmrun.lib
@@ -977,7 +1404,7 @@ distclean: clean
$(MAKE) -C ocamldoc distclean
$(MAKE) -C ocamltest distclean
$(MAKE) -C otherlibs distclean
- $(MAKE) -C runtime distclean
+ rm -f $(runtime_CONFIGURED_HEADERS)
$(MAKE) -C stdlib distclean
$(MAKE) -C testsuite distclean
$(MAKE) -C tools distclean
@@ -999,7 +1426,16 @@ install:
$(MKDIR) "$(INSTALL_STUBLIBDIR)"
$(MKDIR) "$(INSTALL_COMPLIBDIR)"
$(MKDIR) "$(INSTALL_DOCDIR)"
- $(MAKE) -C runtime install
+ $(MKDIR) "$(INSTALL_INCDIR)"
+ $(INSTALL_PROG) $(runtime_PROGRAMS) "$(INSTALL_BINDIR)"
+ $(INSTALL_DATA) $(runtime_BYTECODE_STATIC_LIBRARIES) \
+ "$(INSTALL_LIBDIR)"
+ifneq "$(runtime_BYTECODE_SHARED_LIBRARIES)" ""
+ $(INSTALL_PROG) $(runtime_BYTECODE_SHARED_LIBRARIES) \
+ "$(INSTALL_LIBDIR)"
+endif
+ $(INSTALL_DATA) runtime/caml/domain_state.tbl runtime/caml/*.h \
+ "$(INSTALL_INCDIR)"
$(INSTALL_PROG) ocaml$(EXE) "$(INSTALL_BINDIR)"
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
$(INSTALL_PROG) ocamlc$(EXE) "$(INSTALL_BINDIR)/ocamlc.byte$(EXE)"
@@ -1094,7 +1530,10 @@ endif
# Installation of the native-code compiler
.PHONY: installopt
installopt:
- $(MAKE) -C runtime installopt
+ $(INSTALL_DATA) $(runtime_NATIVE_STATIC_LIBRARIES) "$(INSTALL_LIBDIR)"
+ifneq "$(runtime_NATIVE_SHARED_LIBRARIES)" ""
+ $(INSTALL_PROG) $(runtime_NATIVE_SHARED_LIBRARIES) "$(INSTALL_LIBDIR)"
+endif
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
$(INSTALL_PROG) ocamlopt$(EXE) "$(INSTALL_BINDIR)/ocamlopt.byte$(EXE)"
endif
diff --git a/Makefile.build_config.in b/Makefile.build_config.in
index 7a150ba91b..54bfb16232 100644
--- a/Makefile.build_config.in
+++ b/Makefile.build_config.in
@@ -61,7 +61,7 @@ datarootdir = @datarootdir@
DOCDIR=@docdir@
# Platform-dependent assembler files to use to build the runtime
-runtime_ASM_OBJECTS = @runtime_asm_objects@
+runtime_ASM_OBJECTS = $(addprefix runtime/,@runtime_asm_objects@)
# Platform-dependent module for ocamlyacc
ocamlyacc_WSTR_MODULE = @ocamlyacc_wstr_module@
diff --git a/Makefile.common b/Makefile.common
index a557a5d99d..b86854d580 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -31,6 +31,7 @@ SPACE := $(EMPTY) $(EMPTY)
DESTDIR ?=
INSTALL_BINDIR := $(DESTDIR)$(BINDIR)
INSTALL_LIBDIR := $(DESTDIR)$(LIBDIR)
+INSTALL_INCDIR=$(INSTALL_LIBDIR)/caml
INSTALL_STUBLIBDIR := $(DESTDIR)$(STUBLIBDIR)
INSTALL_MANDIR := $(DESTDIR)$(MANDIR)
INSTALL_PROGRAMS_MAN_DIR := $(DESTDIR)$(PROGRAMS_MAN_DIR)
diff --git a/runtime/Makefile b/runtime/Makefile
deleted file mode 100644
index b6b20b77ee..0000000000
--- a/runtime/Makefile
+++ /dev/null
@@ -1,458 +0,0 @@
-#**************************************************************************
-#* *
-#* 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. *
-#* *
-#**************************************************************************
-
-ROOTDIR = ..
-
-include $(ROOTDIR)/Makefile.common
-
-# Lists of source files
-
-COMMON_C_SOURCES := $(addsuffix .c, \
- addrmap \
- afl \
- alloc \
- array \
- backtrace \
- bigarray \
- callback \
- codefrag \
- compare \
- custom \
- debugger \
- domain \
- dynlink \
- eventlog \
- extern \
- fiber \
- finalise \
- floats \
- gc_ctrl \
- gc_stats \
- globroots \
- hash \
- intern \
- ints \
- io \
- lexing \
- lf_skiplist \
- main \
- major_gc \
- md5 \
- memory \
- memprof \
- meta \
- minor_gc \
- misc \
- obj \
- parsing \
- platform \
- printexc \
- prng \
- roots \
- shared_heap \
- signals \
- skiplist \
- startup_aux \
- str \
- sync \
- sys \
- $(UNIX_OR_WIN32) \
- weak \
-)
-
-BYTECODE_ONLY_C_SOURCES := $(addsuffix .c, \
- backtrace_byt \
- fail_byt \
- fix_code \
- interp \
- startup_byt \
-)
-BYTECODE_C_SOURCES := $(COMMON_C_SOURCES) $(BYTECODE_ONLY_C_SOURCES)
-
-NATIVE_ONLY_C_SOURCES := $(addsuffix .c, \
- backtrace_nat \
- clambda_checks \
- dynlink_nat \
- fail_nat \
- frame_descriptors \
- startup_nat \
- signals_nat \
-)
-NATIVE_C_SOURCES := $(COMMON_C_SOURCES) $(NATIVE_ONLY_C_SOURCES)
-
-# Header files generated by configure
-CONFIGURED_HEADERS := caml/m.h caml/s.h caml/version.h
-
-# Header files generated by make
-BUILT_HEADERS := caml/opnames.h caml/jumptbl.h build_config.h
-
-# Targets to build and install
-
-PROGRAMS := ocamlrun$(EXE)
-BYTECODE_STATIC_LIBRARIES := ld.conf libcamlrun.$(A)
-BYTECODE_SHARED_LIBRARIES :=
-NATIVE_STATIC_LIBRARIES := libasmrun.$(A)
-NATIVE_SHARED_LIBRARIES :=
-
-ifeq "$(RUNTIMED)" "true"
-PROGRAMS += ocamlrund$(EXE)
-BYTECODE_STATIC_LIBRARIES += libcamlrund.$(A)
-NATIVE_STATIC_LIBRARIES += libasmrund.$(A)
-endif
-
-ifeq "$(INSTRUMENTED_RUNTIME)" "true"
-PROGRAMS += ocamlruni$(EXE)
-BYTECODE_STATIC_LIBRARIES += libcamlruni.$(A)
-NATIVE_STATIC_LIBRARIES += libasmruni.$(A)
-endif
-
-ifeq "$(UNIX_OR_WIN32)" "unix"
-ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
-BYTECODE_STATIC_LIBRARIES += libcamlrun_pic.$(A)
-BYTECODE_SHARED_LIBRARIES += libcamlrun_shared.$(SO)
-NATIVE_STATIC_LIBRARIES += libasmrun_pic.$(A)
-NATIVE_SHARED_LIBRARIES += libasmrun_shared.$(SO)
-endif
-endif
-
-# List of object files for each target
-
-libcamlrun_OBJECTS := $(BYTECODE_C_SOURCES:.c=.b.$(O))
-
-libcamlrun_non_shared_OBJECTS := \
- $(subst $(UNIX_OR_WIN32).b.$(O),$(UNIX_OR_WIN32)_non_shared.b.$(O), \
- $(libcamlrun_OBJECTS))
-
-libcamlrund_OBJECTS := $(BYTECODE_C_SOURCES:.c=.bd.$(O)) \
- instrtrace.bd.$(O)
-
-libcamlruni_OBJECTS := $(BYTECODE_C_SOURCES:.c=.bi.$(O))
-
-libcamlrunpic_OBJECTS := $(BYTECODE_C_SOURCES:.c=.bpic.$(O))
-
-libasmrun_OBJECTS := $(NATIVE_C_SOURCES:.c=.n.$(O)) $(runtime_ASM_OBJECTS)
-
-libasmrund_OBJECTS := \
- $(NATIVE_C_SOURCES:.c=.nd.$(O)) $(runtime_ASM_OBJECTS:.$(O)=.d.$(O))
-
-libasmruni_OBJECTS := \
- $(NATIVE_C_SOURCES:.c=.ni.$(O)) $(runtime_ASM_OBJECTS:.$(O)=.i.$(O))
-
-libasmrunpic_OBJECTS := $(NATIVE_C_SOURCES:.c=.npic.$(O)) \
- $(runtime_ASM_OBJECTS:.$(O)=_libasmrunpic.$(O))
-
-# General (non target-specific) assembler and compiler flags
-
-OC_CPPFLAGS += -DCAMLDLLIMPORT=
-
-OC_DEBUG_CPPFLAGS=-DDEBUG
-OC_INSTR_CPPFLAGS=-DCAML_INSTR
-
-# Build, install and clean targets
-
-.PHONY: all
-all: $(BYTECODE_STATIC_LIBRARIES) $(BYTECODE_SHARED_LIBRARIES) $(PROGRAMS) \
- sak$(EXE)
-
-.PHONY: allopt
-ifneq "$(NATIVE_COMPILER)" "false"
-allopt: $(NATIVE_STATIC_LIBRARIES) $(NATIVE_SHARED_LIBRARIES)
-else
-allopt:
- $(error The build has been configured with --disable-native-compiler)
-endif
-
-INSTALL_INCDIR=$(INSTALL_LIBDIR)/caml
-.PHONY: install
-install:
- $(INSTALL_PROG) $(PROGRAMS) "$(INSTALL_BINDIR)"
- $(INSTALL_DATA) $(BYTECODE_STATIC_LIBRARIES) "$(INSTALL_LIBDIR)"
-ifneq "$(BYTECODE_SHARED_LIBRARIES)" ""
- $(INSTALL_PROG) $(BYTECODE_SHARED_LIBRARIES) "$(INSTALL_LIBDIR)"
-endif
- mkdir -p "$(INSTALL_INCDIR)"
- $(INSTALL_DATA) caml/domain_state.tbl caml/*.h "$(INSTALL_INCDIR)"
-
-.PHONY: installopt
-installopt:
- $(INSTALL_DATA) $(NATIVE_STATIC_LIBRARIES) "$(INSTALL_LIBDIR)"
-ifneq "$(NATIVE_SHARED_LIBRARIES)" ""
- $(INSTALL_PROG) $(NATIVE_SHARED_LIBRARIES) "$(INSTALL_LIBDIR)"
-endif
-
-.PHONY: clean
-clean:
- rm -f *.o *.obj *.a *.lib *.so *.dll ld.conf
- rm -f ocamlrun ocamlrund ocamlruni ocamlruns sak
- rm -f ocamlrun.exe ocamlrund.exe ocamlruni.exe ocamlruns.exe sak.exe
- rm -f primitives primitives.new prims.c $(BUILT_HEADERS)
- rm -f domain_state*.inc
- rm -rf $(DEPDIR)
-
-.PHONY: distclean
-distclean: clean
- rm -f $(CONFIGURED_HEADERS)
-
-# Generated non-object files
-
-ld.conf: $(ROOTDIR)/Makefile.config
- echo "$(STUBLIBDIR)" > $@
- echo "$(LIBDIR)" >> $@
-
-# If primitives contain duplicated lines (e.g. because the code is defined
-# like
-# #ifdef X
-# CAMLprim value caml_foo() ...
-# #else
-# CAMLprim value caml_foo() ...
-# #endif), horrible things will happen: duplicated entries in Runtimedef ->
-# double registration in Symtable -> empty entry in the PRIM table ->
-# the bytecode interpreter is confused.
-# We sort the primitive file and remove duplicates to avoid this problem.
-
-# Warning: we use "sort | uniq" instead of "sort -u" because in the MSVC
-# port, the "sort" program in the path is Microsoft's and not cygwin's
-
-# Warning: POSIX sort is locale dependent, that's why we set LC_ALL explicitly.
-# Sort is unstable for "is_directory" and "isatty"
-# see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html:
-# "using sort to process pathnames, it is recommended that LC_ALL .. set to C"
-
-# To speed up builds, we avoid changing "primitives" when files
-# containing primitives change but the primitives table does not
-primitives: $(shell ./gen_primitives.sh > primitives.new; \
- cmp -s primitives primitives.new || echo primitives.new)
- cp $^ $@
-
-prims.c : primitives
- (echo '#define CAML_INTERNALS'; \
- echo '#include "caml/mlvalues.h"'; \
- echo '#include "caml/prims.h"'; \
- sed -e 's/.*/extern value &();/' primitives; \
- echo 'c_primitive caml_builtin_cprim[] = {'; \
- sed -e 's/.*/ &,/' primitives; \
- echo ' 0 };'; \
- echo 'char * caml_names_of_builtin_cprim[] = {'; \
- sed -e 's/.*/ "&",/' primitives; \
- echo ' 0 };') > prims.c
-
-caml/opnames.h : caml/instruct.h
- tr -d '\r' < $< | \
- sed -e '/\/\*/d' \
- -e '/^#/d' \
- -e 's/enum /static char * names_of_/' \
- -e 's/{$$/[] = {/' \
- -e 's/\([[:upper:]][[:upper:]_0-9]*\)/"\1"/g' > $@
-
-# caml/jumptbl.h is required only if you have GCC 2.0 or later
-caml/jumptbl.h : caml/instruct.h
- tr -d '\r' < $< | \
- sed -n -e '/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp' \
- -e '/^}/q' > $@
-# These are provided as a temporary shim to allow cross-compilation systems
-# to supply a host C compiler and different flags and a linking macro.
-SAK_CC ?= $(CC)
-SAK_CFLAGS ?= $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS)
-SAK_LINK ?= $(MKEXE_USING_COMPILER)
-
-sak$(EXE): sak.$(O)
- $(call SAK_LINK,$@,$^)
-
-sak.$(O): sak.c caml/misc.h caml/config.h
- $(SAK_CC) -c $(SAK_CFLAGS) $(OUTPUTOBJ)$@ $<
-
-C_LITERAL = $(shell ./sak$(EXE) encode-C-literal '$(1)')
-
-build_config.h: $(ROOTDIR)/Makefile.config sak$(EXE)
- echo '/* This file is generated from $(ROOTDIR)/Makefile.config */' > $@
- echo '#define OCAML_STDLIB_DIR $(call C_LITERAL,$(LIBDIR))' >> $@
- echo '#define HOST "$(HOST)"' >> $@
-
-# Libraries and programs
-
-ocamlrun$(EXE): prims.$(O) libcamlrun.$(A)
- $(MKEXE) -o $@ $^ $(BYTECCLIBS)
-
-ocamlruns$(EXE): prims.$(O) libcamlrun_non_shared.$(A)
- $(call MKEXE_USING_COMPILER,$@,$^ $(BYTECCLIBS))
-
-libcamlrun.$(A): $(libcamlrun_OBJECTS)
- $(call MKLIB,$@, $^)
-
-libcamlrun_non_shared.$(A): $(libcamlrun_non_shared_OBJECTS)
- $(call MKLIB,$@, $^)
-
-ocamlrund$(EXE): prims.$(O) libcamlrund.$(A)
- $(MKEXE) $(MKEXEDEBUGFLAG) -o $@ $^ $(BYTECCLIBS)
-
-libcamlrund.$(A): $(libcamlrund_OBJECTS)
- $(call MKLIB,$@, $^)
-
-ocamlruni$(EXE): prims.$(O) libcamlruni.$(A)
- $(MKEXE) -o $@ $^ $(INSTRUMENTED_RUNTIME_LIBS) $(BYTECCLIBS)
-
-libcamlruni.$(A): $(libcamlruni_OBJECTS)
- $(call MKLIB,$@, $^)
-
-libcamlrun_pic.$(A): $(libcamlrunpic_OBJECTS)
- $(call MKLIB,$@, $^)
-
-libcamlrun_shared.$(SO): $(libcamlrunpic_OBJECTS)
- $(MKDLL) -o $@ $^ $(BYTECCLIBS)
-
-libasmrun.$(A): $(libasmrun_OBJECTS)
- $(call MKLIB,$@, $^)
-
-libasmrund.$(A): $(libasmrund_OBJECTS)
- $(call MKLIB,$@, $^)
-
-libasmruni.$(A): $(libasmruni_OBJECTS)
- $(call MKLIB,$@, $^)
-
-libasmrun_pic.$(A): $(libasmrunpic_OBJECTS)
- $(call MKLIB,$@, $^)
-
-libasmrun_shared.$(SO): $(libasmrunpic_OBJECTS)
- $(MKDLL) -o $@ $^ $(NATIVECCLIBS)
-
-# Target-specific preprocessor and compiler flags
-
-%.bd.$(O): OC_CPPFLAGS += $(OC_DEBUG_CPPFLAGS)
-%.bd.$(D): OC_CPPFLAGS += $(OC_DEBUG_CPPFLAGS)
-
-%.bi.$(O): OC_CPPFLAGS += $(OC_INSTR_CPPFLAGS)
-%.bi.$(D): OC_CPPFLAGS += $(OC_INSTR_CPPFLAGS)
-
-%.bpic.$(O): OC_CFLAGS += $(SHAREDLIB_CFLAGS)
-
-%.n.$(O): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS)
-%.n.$(D): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS)
-
-%.nd.$(O): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS) $(OC_DEBUG_CPPFLAGS)
-%.nd.$(D): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS) $(OC_DEBUG_CPPFLAGS)
-
-%.ni.$(O): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS) $(OC_INSTR_CPPFLAGS)
-%.ni.$(D): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS) $(OC_INSTR_CPPFLAGS)
-
-%.npic.$(O): OC_CFLAGS += $(SHAREDLIB_CFLAGS)
-%.npic.$(O): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS)
-%.npic.$(D): OC_CPPFLAGS += $(OC_NATIVE_CPPFLAGS)
-
-# Compilation of C files
-
-# The COMPILE_C_FILE macro below receives as argument the pattern
-# that corresponds to the name of the generated object file
-# (without the extension, which is added by the macro)
-define COMPILE_C_FILE
-ifneq "$(COMPUTE_DEPS)" "false"
-ifneq "$(1)" "%"
-# -MG would ensure that the dependencies are generated even if the files listed
-# in $$(BUILT_HEADERS) haven't been assembled yet. However, this goes subtly
-# wrong if the user has the headers installed, as gcc will pick up a dependency
-# on those instead and the local ones will not be generated. For this reason, we
-# don't use -MG and instead include $(BUILT_HEADERS) in the order only
-# dependencies to ensure that they exist before dependencies are computed.
-$(DEPDIR)/$(1).$(D): %.c | $(DEPDIR) $(BUILT_HEADERS)
- $$(DEP_CC) $$(OC_CPPFLAGS) $$(CPPFLAGS) $$< -MT \
- '$$*$(subst %,,$(1)).$(O)' -MF $$@
-endif # ifneq "$(1)" "%"
-$(1).$(O): $(2).c
-else
-$(1).$(O): $(2).c $(CONFIGURED_HEADERS) $(BUILT_HEADERS) $(RUNTIME_HEADERS)
-endif # ifneq "$(COMPUTE_DEPS)" "false"
- $$(CC) -c $$(OC_CFLAGS) $$(CFLAGS) $$(OC_CPPFLAGS) $$(CPPFLAGS) \
- $$(OUTPUTOBJ)$$@ $$<
-endef
-
-object_types := % %.b %.bd %.bi %.bpic
-ifneq "$(NATIVE_COMPILER)" "false"
-object_types += %.n %.nd %.ni %.np %.npic
-endif
-
-$(foreach object_type, $(object_types), \
- $(eval $(call COMPILE_C_FILE,$(object_type),%)))
-
-$(UNIX_OR_WIN32)_non_shared.%.$(O): OC_CPPFLAGS += -DBUILDING_LIBCAMLRUNS
-
-$(eval $(call COMPILE_C_FILE,$(UNIX_OR_WIN32)_non_shared.%,$(UNIX_OR_WIN32)))
-
-$(foreach object_type,$(subst %,,$(object_types)), \
- $(eval dynlink$(object_type).$(O): $(ROOTDIR)/Makefile.config))
-
-# Compilation of assembly files
-
-ASPP_ERROR = \
- { echo "If your assembler produced syntax errors, it is probably";\
- echo "unhappy with the preprocessor. Check your assembler, or";\
- echo "try producing $*.o by hand.";\
- exit 2; }
-%.o: %.S
- $(ASPP) $(OC_ASPPFLAGS) -o $@ $< || $(ASPP_ERROR)
-
-%.d.o: %.S
- $(ASPP) $(OC_ASPPFLAGS) $(OC_DEBUG_CPPFLAGS) -o $@ $< || $(ASPP_ERROR)
-
-%.i.o: %.S
- $(ASPP) $(OC_ASPPFLAGS) $(OC_INSTR_CPPFLAGS) -o $@ $< || $(ASPP_ERROR)
-
-%_libasmrunpic.o: %.S
- $(ASPP) $(OC_ASPPFLAGS) $(SHAREDLIB_CFLAGS) -o $@ $<
-
-domain_state64.inc: caml/domain_state.tbl gen_domain_state64_inc.awk
- $(AWK) -f ./gen_domain_state64_inc.awk $< > $@
-
-domain_state32.inc: caml/domain_state.tbl gen_domain_state32_inc.awk
- $(AWK) -f ./gen_domain_state32_inc.awk $< > $@
-
-amd64nt.obj: amd64nt.asm domain_state64.inc
- $(ASM)$@ $<
-
-i386nt.obj: i386nt.asm domain_state32.inc
- $(ASM)$@ $<
-
-amd64nt.d.obj: amd64nt.asm domain_state64.inc
- $(ASM)$@ $(OC_DEBUG_CPPFLAGS) $<
-
-i386nt.d.obj: i386nt.asm domain_state32.inc
- $(ASM)$@ $(OC_DEBUG_CPPFLAGS) $<
-
-amd64nt.i.obj: amd64nt.asm domain_state64.inc
- $(ASM)$@ $(OC_INSTR_CPPFLAGS) $<
-
-i386nt.i.obj: i386nt.asm domain_state32.inc
- $(ASM)$@ $(OC_INSTR_CPPFLAGS) $<
-
-%_libasmrunpic.obj: %.asm
- $(ASM)$@ $<
-
-# Dependencies
-
-DEP_FILES := $(addsuffix .b, $(basename $(BYTECODE_C_SOURCES) instrtrace))
-ifneq "$(NATIVE_COMPILER)" "false"
-DEP_FILES += $(addsuffix .n, $(basename $(NATIVE_C_SOURCES)))
-endif
-DEP_FILES += $(addsuffix d, $(DEP_FILES)) \
- $(addsuffix i, $(DEP_FILES)) \
- $(addsuffix pic, $(DEP_FILES))
-DEP_FILES := $(addsuffix .$(D), $(DEP_FILES))
-
-ifeq "$(COMPUTE_DEPS)" "true"
-include $(addprefix $(DEPDIR)/, $(DEP_FILES))
-endif
-
-# This empty target is here for AppVeyor to allow dependencies to be built
-# without doing anything else.
-.PHONY: setup-depend
-setup-depend:
diff --git a/runtime/gen_primitives.sh b/runtime/gen_primitives.sh
index 4c1d9966e4..9a8d2cb39a 100755
--- a/runtime/gen_primitives.sh
+++ b/runtime/gen_primitives.sh
@@ -28,8 +28,9 @@ export LC_ALL=C
dynlink backtrace_byt backtrace afl \
bigarray eventlog prng
do
- sed -n -e 's/^CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p' "$prim.c"
+ sed -n -e 's/^CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p' \
+ "runtime/$prim.c"
done
sed -n -e 's/^CAMLprim_int64_[0-9](\([a-z0-9_][a-z0-9_]*\)).*/caml_int64_\1\
-caml_int64_\1_native/p' ints.c
+caml_int64_\1_native/p' runtime/ints.c
) | sort | uniq