diff --git a/Changes b/Changes index 5e769337d..b02f77bb9 100644 --- a/Changes +++ b/Changes @@ -45,6 +45,10 @@ Working version ### Compiler distribution build system: +- GPR#1776: add -no-install-bytecode-programs and related configure options to + control (non-)installation of ".byte" executables + (Mark Shinwell, review by Sébastien Hinderer and Gabriel Scherer) + - GPR#1777: add -no-install-source-artifacts and related configure options to control installation of .cmt, .cmti, .mli and .ml files (Mark Shinwell, review by Nicolas Ojeda Bar and Sébastien Hinderer) diff --git a/Makefile b/Makefile index 9e2a40f9e..18238de3e 100644 --- a/Makefile +++ b/Makefile @@ -606,9 +606,13 @@ install: "$(INSTALL_LIBDIR)" $(MAKE) -C byterun install $(INSTALL_PROG) ocaml "$(INSTALL_BINDIR)/ocaml$(EXE)" +ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" $(INSTALL_PROG) ocamlc "$(INSTALL_BINDIR)/ocamlc.byte$(EXE)" +endif $(MAKE) -C stdlib install +ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" $(INSTALL_PROG) lex/ocamllex "$(INSTALL_BINDIR)/ocamllex.byte$(EXE)" +endif $(INSTALL_PROG) yacc/ocamlyacc$(EXE) "$(INSTALL_BINDIR)/ocamlyacc$(EXE)" $(INSTALL_DATA) \ utils/*.cmi \ @@ -666,17 +670,23 @@ ifeq "$(UNIX_OR_WIN32)" "win32" fi endif $(INSTALL_DATA) config/Makefile "$(INSTALL_LIBDIR)/Makefile.config" +ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" if test -f ocamlopt; then $(MAKE) installopt; else \ cd "$(INSTALL_BINDIR)"; \ $(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \ $(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \ fi +else + if test -f ocamlopt; then $(MAKE) installopt; fi +endif # Installation of the native-code compiler .PHONY: installopt installopt: $(MAKE) -C asmrun install +ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" $(INSTALL_PROG) ocamlopt "$(INSTALL_BINDIR)/ocamlopt.byte$(EXE)" +endif $(MAKE) -C stdlib installopt $(INSTALL_DATA) \ middle_end/*.cmi \ @@ -710,12 +720,16 @@ endif for i in $(OTHERLIBRARIES); do \ $(MAKE) -C otherlibs/$$i installopt || exit $$?; \ done +ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" if test -f ocamlopt.opt ; then $(MAKE) installoptopt; else \ cd "$(INSTALL_BINDIR)"; \ $(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \ $(LN) ocamlopt.byte$(EXE) ocamlopt$(EXE); \ $(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \ fi +else + if test -f ocamlopt.opt ; then $(MAKE) installoptopt; fi +endif $(MAKE) -C tools installopt if test -f ocamlopt.opt -a -f flexdll/flexlink.opt ; then \ $(INSTALL_PROG) \ diff --git a/config/Makefile-templ b/config/Makefile-templ index 34af691ed..f5eccebc6 100644 --- a/config/Makefile-templ +++ b/config/Makefile-templ @@ -153,6 +153,9 @@ RANLIBCMD=ranlib # On Solaris: #ASPP=as -P +### Set to "true" to install ".byte" executables (ocamlc.byte, etc.) +#INSTALL_BYTECODE_PROGRAMS=true + ### Extra flags to use for assembling .S files in profiling mode #ASPPPROFFLAGS=-DPROFILING diff --git a/config/Makefile.mingw b/config/Makefile.mingw index 3f1eb9b42..2020ba734 100644 --- a/config/Makefile.mingw +++ b/config/Makefile.mingw @@ -190,6 +190,9 @@ OCAMLOPT_CFLAGS=-O -mms-bitfields ### Build partially-linked object file PACKLD=$(TOOLPREF)ld -r -o # must have a space after '-o' +### Set to "true" to install ".byte" executables (ocamlc.byte, etc.) +INSTALL_BYTECODE_PROGRAMS=true + ############# Configuration for the contributed libraries OTHERLIBRARIES=win32unix str win32graph dynlink bigarray systhreads diff --git a/config/Makefile.mingw64 b/config/Makefile.mingw64 index df605a9f5..51ecfe768 100644 --- a/config/Makefile.mingw64 +++ b/config/Makefile.mingw64 @@ -190,6 +190,9 @@ OCAMLOPT_CFLAGS=-O -mms-bitfields ### Build partially-linked object file PACKLD=$(TOOLPREF)ld -r -o # must have a space after '-o' +### Set to "true" to install ".byte" executables (ocamlc.byte, etc.) +INSTALL_BYTECODE_PROGRAMS=true + ############# Configuration for the contributed libraries OTHERLIBRARIES=win32unix str win32graph dynlink bigarray systhreads diff --git a/config/Makefile.msvc b/config/Makefile.msvc index 743d36879..b5d3e962b 100644 --- a/config/Makefile.msvc +++ b/config/Makefile.msvc @@ -186,6 +186,9 @@ OCAMLOPT_CPPFLAGS=-D_CRT_SECURE_NO_DEPRECATE ### Build partially-linked object file PACKLD=link -lib -nologo -out:# there must be no space after this '-out:' +### Set to "true" to install ".byte" executables (ocamlc.byte, etc.) +INSTALL_BYTECODE_PROGRAMS=true + ### Clear this to disable compiling ocamldebug WITH_DEBUGGER=ocamldebugger diff --git a/config/Makefile.msvc64 b/config/Makefile.msvc64 index 67bf16a22..6089eca1a 100644 --- a/config/Makefile.msvc64 +++ b/config/Makefile.msvc64 @@ -189,6 +189,9 @@ OCAMLOPT_CPPFLAGS=-D_CRT_SECURE_NO_DEPRECATE ### Build partially-linked object file PACKLD=link -lib -nologo -machine:AMD64 -out:# must have no space after '-out:' +### Set to "true" to install ".byte" executables (ocamlc.byte, etc.) +INSTALL_BYTECODE_PROGRAMS=true + ### Clear this to disable compiling ocamldebug WITH_DEBUGGER=ocamldebugger diff --git a/configure b/configure index 9cb0c3b11..08892e638 100755 --- a/configure +++ b/configure @@ -59,6 +59,7 @@ no_naked_pointers=false native_compiler=true TOOLPREF="" with_cfi=true +install_bytecode_programs=true install_source_artifacts=true flambda=false force_safe_string=false @@ -214,6 +215,10 @@ while : ; do install_source_artifacts=false;; -no-native-compiler|--no-native-compiler) native_compiler=false;; + -install-bytecode-programs|--install-bytecode-programs) + install_bytecode_programs=true;; + -no-install-bytecode-programs|--no-install-bytecode-programs) + install_bytecode_programs=false;; -flambda|--flambda) flambda=true;; -with-flambda-invariants|--with-flambda-invariants) @@ -2055,6 +2060,7 @@ if $flat_float_array; then echo "#define FLAT_FLOAT_ARRAY" >> m.h fi +echo "INSTALL_BYTECODE_PROGRAMS=$install_bytecode_programs" >> Makefile echo "INSTALL_SOURCE_ARTIFACTS=$install_source_artifacts" >> Makefile # Finish generated files @@ -2306,6 +2312,10 @@ if $with_instrumented_runtime; then inf "Instrumented runtime will be compiled and installed" fi +if ! $install_bytecode_programs; then + inf "Bytecode programs will not be installed" +fi + if ! $install_source_artifacts; then inf ".cmt, .cmti, .ml and .mli files will not be installed" fi diff --git a/tools/Makefile b/tools/Makefile index 6e2b7a865..ac8463094 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -236,9 +236,10 @@ LN := cp -pf endif install:: +ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" for i in $(install_files); \ do \ - $(INSTALL_PROG) "$$i" "$(INSTALL_BINDIR)/$$i.byte$(EXE)" && \ + $(INSTALL_PROG) "$$i" "$(INSTALL_BINDIR)/$$i.byte$(EXE)"; \ if test -f "$$i".opt; then \ $(INSTALL_PROG) "$$i.opt" "$(INSTALL_BINDIR)/$$i.opt$(EXE)" && \ (cd "$(INSTALL_BINDIR)/" && $(LN) "$$i.opt$(EXE)" "$$i$(EXE)"); \ @@ -246,6 +247,14 @@ install:: (cd "$(INSTALL_BINDIR)/" && $(LN) "$$i.byte$(EXE)" "$$i$(EXE)"); \ fi; \ done +else + for i in $(install_files); \ + do \ + if test -f "$$i".opt; then \ + $(INSTALL_PROG) "$$i.opt" "$(INSTALL_BINDIR)/$$i.opt$(EXE)"; \ + fi; \ + done +endif clean:: rm -f addlabels