Introduce Makefile.build_config.in

This moves the configure-generated parts of Makefile.common to a
separate (generated) Makefile, allowing Makefile.common to be a normal
Makefile.

OCaml's build system Makefile's now include Makefile.build_config (which
itself includes Makefile.config) but Makefile.config is still installed
as before. This allows configure to generate variables which are
specific to the build process and are not intended to be exported to the
installation.
David Allsopp 2020-04-17 13:53:49 +01:00
parent 42b8c20cce
commit 3a40b2fd94
18 changed files with 59 additions and 40 deletions

2
.gitignore vendored
View File

@ -40,7 +40,7 @@ _build
# local to root directory
/Makefile.common
/Makefile.build_config
/Makefile.config
/autom4te.cache
/ocamlc

View File

@ -26,12 +26,11 @@ CAN_BE_UNCONFIGURED := $(strip \
$(if $(MAKECMDGOALS),$(MAKECMDGOALS),defaultentry)))
ifeq "$(CAN_BE_UNCONFIGURED)" ""
-include Makefile.config
-include Makefile.common
-include Makefile.build_config
else
include Makefile.config
include Makefile.common
include Makefile.build_config
endif
include Makefile.common
.PHONY: defaultentry
ifeq "$(NATIVE_COMPILER)" "true"
@ -1078,7 +1077,8 @@ depend: beforedepend
distclean: clean
rm -f boot/ocamlrun boot/ocamlrun boot/ocamlrun.exe boot/camlheader \
boot/*.cm* boot/libcamlrun.a boot/libcamlrun.lib boot/ocamlc.opt
rm -f Makefile.config Makefile.common runtime/caml/m.h runtime/caml/s.h
rm -f Makefile.config Makefile.build_config
rm -f runtime/caml/m.h runtime/caml/s.h
rm -rf autom4te.cache
rm -f config.log config.status libtool
rm -f tools/eventlog_metadata
@ -1090,7 +1090,7 @@ include .depend
ifneq "$(strip $(CAN_BE_UNCONFIGURED))" ""
Makefile.config Makefile.common: config.status
Makefile.config Makefile.build_config: config.status
config.status:
@echo "Please refer to the installation instructions:"

25
Makefile.build_config.in Normal file
View File

@ -0,0 +1,25 @@
# @configure_input@
#**************************************************************************
#* *
#* OCaml *
#* *
#* David Allsopp, OCaml Labs, Cambridge. *
#* *
#* Copyright 2020 MetaStack Solutions Ltd. *
#* *
#* 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. *
#* *
#**************************************************************************
# This Makefile contains configuration gleaned by configure but which should not
# be installed in Makefile.config. The file is designed to be included in
# OCaml's build system and so itself includes Makefile.config. It assumes that
# $(ROOTDIR) has been defined.
include $(ROOTDIR)/Makefile.config
INSTALL ?= @INSTALL@
INSTALL_DATA ?= $(INSTALL) -m u=rw,g=rw,o=r
INSTALL_PROG ?= $(INSTALL) -m u=rwx,g=rwx,o=rx

View File

@ -1,5 +1,3 @@
# @configure_input@
#**************************************************************************
#* *
#* OCaml *
@ -19,10 +17,6 @@
# other Makefiles
# We assume that Makefile.config has already been included
INSTALL ?= @INSTALL@
INSTALL_DATA ?= $(INSTALL) -m u=rw,g=rw,o=r
INSTALL_PROG ?= $(INSTALL) -m u=rwx,g=rwx,o=rx
# note: these are defined by lazy expansions
# as some parts of the makefiles change BINDIR, etc.
# and expect INSTALL_BINDIR, etc. to stay in synch

4
configure vendored
View File

@ -2900,7 +2900,7 @@ VERSION=4.12.0+dev0-2020-04-22
## Generated files
ac_config_files="$ac_config_files Makefile.common"
ac_config_files="$ac_config_files Makefile.build_config"
ac_config_files="$ac_config_files Makefile.config"
@ -18074,7 +18074,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"Makefile.common") CONFIG_FILES="$CONFIG_FILES Makefile.common" ;;
"Makefile.build_config") CONFIG_FILES="$CONFIG_FILES Makefile.build_config" ;;
"Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;;
"tools/eventlog_metadata") CONFIG_FILES="$CONFIG_FILES tools/eventlog_metadata" ;;
"runtime/caml/m.h") CONFIG_HEADERS="$CONFIG_HEADERS runtime/caml/m.h" ;;

View File

@ -170,7 +170,7 @@ AC_SUBST([stdlib_manpages])
## Generated files
AC_CONFIG_FILES([Makefile.common])
AC_CONFIG_FILES([Makefile.build_config])
AC_CONFIG_FILES([Makefile.config])
AC_CONFIG_FILES([tools/eventlog_metadata])
AC_CONFIG_HEADERS([runtime/caml/m.h])

View File

@ -15,8 +15,8 @@
ROOTDIR = ..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
include $(ROOTDIR)/Makefile.best_binaries
DYNLINKDIR=$(ROOTDIR)/otherlibs/dynlink

View File

@ -17,8 +17,8 @@
ROOTDIR = ..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
CAMLYACC ?= $(ROOTDIR)/yacc/ocamlyacc

View File

@ -15,8 +15,8 @@
ROOTDIR = ..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
include $(ROOTDIR)/Makefile.best_binaries
OCAMLRUN ?= $(ROOTDIR)/boot/ocamlrun

View File

@ -17,8 +17,8 @@
ROOTDIR = ..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
include $(ROOTDIR)/Makefile.best_binaries
ifeq "$(filter str,$(OTHERLIBRARIES))" ""

View File

@ -14,8 +14,8 @@
#**************************************************************************
ROOTDIR=..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
OTHERLIBRARIES ?= bigarray dynlink raw_spacetime_lib str systhreads \
unix win32unix

View File

@ -16,8 +16,8 @@
# Common Makefile for otherlibs
ROOTDIR=../..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
include $(ROOTDIR)/Makefile.best_binaries
CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun

View File

@ -21,8 +21,8 @@
ROOTDIR = ../..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
include $(ROOTDIR)/Makefile.best_binaries
CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun

View File

@ -15,8 +15,8 @@
ROOTDIR=../..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
include $(ROOTDIR)/Makefile.best_binaries
OC_CFLAGS += $(SHAREDLIB_CFLAGS)

View File

@ -15,8 +15,8 @@
ROOTDIR = ..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
# Lists of source files

View File

@ -15,8 +15,8 @@
ROOTDIR = ..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
TARGET_BINDIR ?= $(BINDIR)

View File

@ -16,8 +16,8 @@
MAKEFLAGS := -r -R
ROOTDIR = ..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
ifeq ($(SYSTEM),unix)
override define shellquote

View File

@ -17,8 +17,8 @@
ROOTDIR = ..
-include $(ROOTDIR)/Makefile.config
-include $(ROOTDIR)/Makefile.common
-include $(ROOTDIR)/Makefile.build_config
include $(ROOTDIR)/Makefile.common
OC_CPPFLAGS += -I$(ROOTDIR)/runtime