diff options
author | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2020-07-07 14:08:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-07 14:08:24 +0200 |
commit | 9af28924713d14d833dcaf95cd3338ef68fbfc97 (patch) | |
tree | 4be68320227ebe6acb4a11a3397596ee118de3e5 /Makefile.extr | |
parent | 3b1f3dd57d8c10c1c29f67f0f745e3263d9d3daf (diff) | |
download | compcert-kvx-9af28924713d14d833dcaf95cd3338ef68fbfc97.tar.gz compcert-kvx-9af28924713d14d833dcaf95cd3338ef68fbfc97.zip |
Bytecode-only build (#243)
If ocamlopt (the native-code OCaml compiler) is not available,
fall back to building with ocamlc (the bytecode OCaml compiler).
Fixes: #359
Diffstat (limited to 'Makefile.extr')
-rw-r--r-- | Makefile.extr | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Makefile.extr b/Makefile.extr index 5948bfc6..b417945b 100644 --- a/Makefile.extr +++ b/Makefile.extr @@ -19,7 +19,8 @@ include Makefile.config # # Variables from Makefile.config: -# -OCAML_OPT_COMP: can we use the native version +# -OCAML_NATIVE_COMP: native-code compilation is supported +# -OCAML_OPT_COMP: can we use the natively-compiled compilers # -COMPFLAGS: compile options # -LINK_OPT: additional linker flags for the native binary # @@ -71,6 +72,7 @@ OCAMLDEP=ocamldep$(DOTOPT) -slash $(INCLUDES) OCAMLLEX=ocamllex -q MODORDER=tools/modorder .depend.extr +COPY=cp PARSERS=cparser/pre_parser.mly LEXERS=cparser/Lexer.mll lib/Tokenize.mll \ @@ -88,9 +90,15 @@ ifeq ($(wildcard .depend.extr),.depend.extr) CCOMP_OBJS:=$(shell $(MODORDER) driver/Driver.cmx) +ifeq ($(OCAML_NATIVE_COMP),true) ccomp: $(CCOMP_OBJS) @echo "Linking $@" @$(OCAMLOPT) -o $@ $(LIBS) $(LINK_OPT) $+ +else +ccomp: ccomp.byte + @echo "Copying to $@" + @$(COPY) $+ $@ +endif ccomp.byte: $(CCOMP_OBJS:.cmx=.cmo) @echo "Linking $@" @@ -98,9 +106,15 @@ ccomp.byte: $(CCOMP_OBJS:.cmx=.cmo) CLIGHTGEN_OBJS:=$(shell $(MODORDER) exportclight/Clightgen.cmx) +ifeq ($(OCAML_NATIVE_COMP),true) clightgen: $(CLIGHTGEN_OBJS) @echo "Linking $@" @$(OCAMLOPT) -o $@ $(LIBS) $(LINK_OPT) $+ +else +clightgen: clightgen.byte + @echo "Copying to $@" + @$(COPY) $+ $@ +endif clightgen.byte: $(CLIGHTGEN_OBJS:.cmx=.cmo) @echo "Linking $@" |