Move config/Makefile to Makefile.config

In order to prepare the transition to autoconf, this commit moves the
configuration Makefile out of the config directory which will disappear
and gives it the name it will have once intstalled, namely Makefile.config.
master
Sébastien Hinderer 2018-09-12 16:32:44 +02:00
parent 7b28143ecb
commit ba6362a07d
29 changed files with 79 additions and 76 deletions

3
.gitignore vendored
View File

@ -47,6 +47,7 @@ _ocamltestd
# specific files and patterns in sub-directories
/Makefile.config
/asmcomp/emit.ml
/asmcomp/arch.ml
/asmcomp/proc.ml
@ -61,8 +62,6 @@ _ocamltestd
/bytecomp/runtimedef.ml
/bytecomp/opcodes.ml
/config/Makefile
/debugger/lexer.ml
/debugger/parser.ml
/debugger/parser.mli

View File

@ -25,7 +25,7 @@
./configure
+
This generates the three configuration files `config/Makefile`,
This generates the three configuration files `Makefile.config`,
`runtime/caml/m.h` and `runtime/caml/s.h`.
+
The `configure` script accepts the following options:

View File

@ -17,7 +17,7 @@
ROOTDIR = .
include config/Makefile
include Makefile.config
include Makefile.common
# For users who don't read the INSTALL file
@ -306,7 +306,7 @@ SUBST=-e 's|%%$1%%|$(call SUBST_ESCAPE,$1,$2)|'
SUBST_QUOTE2=-e 's|%%$1%%|$(if $2,"$2")|'
SUBST_QUOTE=$(call SUBST_QUOTE2,$1,$(call SUBST_ESCAPE,$1,$2))
FLEXLINK_LDFLAGS=$(if $(OC_LDFLAGS), -link "$(OC_LDFLAGS)")
utils/config.ml: utils/config.mlp config/Makefile Makefile
utils/config.ml: utils/config.mlp Makefile.config Makefile
sed $(call SUBST,AFL_INSTRUMENT) \
$(call SUBST,ARCH) \
$(call SUBST,ARCMD) \
@ -523,7 +523,7 @@ flexdll/Makefile:
.PHONY: flexdll
flexdll: flexdll/Makefile flexlink
$(MAKE) -C flexdll \
OCAML_CONFIG_FILE=../config/Makefile \
OCAML_CONFIG_FILE=../Makefile.config \
MSVC_DETECT=0 CHAINS=$(FLEXDLL_CHAIN) NATDYNLINK=false support
# Bootstrapping flexlink - leaves a bytecode image of flexlink.exe in flexdll/
@ -533,7 +533,7 @@ flexlink: flexdll/Makefile
cp runtime/ocamlrun$(EXE) boot/ocamlrun$(EXE)
$(MAKE) -C stdlib COMPILER=../boot/ocamlc stdlib.cma std_exit.cmo
cd stdlib && cp stdlib.cma std_exit.cmo *.cmi ../boot
$(MAKE) -C flexdll MSVC_DETECT=0 OCAML_CONFIG_FILE=../config/Makefile \
$(MAKE) -C flexdll MSVC_DETECT=0 OCAML_CONFIG_FILE=../Makefile.config \
CHAINS=$(FLEXDLL_CHAIN) NATDYNLINK=false \
OCAMLOPT="../boot/ocamlrun ../boot/ocamlc -I ../boot" \
flexlink.exe
@ -545,7 +545,7 @@ flexlink.opt:
cd flexdll && \
mv flexlink.exe flexlink && \
($(MAKE) OCAML_FLEXLINK="../boot/ocamlrun ./flexlink" MSVC_DETECT=0 \
OCAML_CONFIG_FILE=../config/Makefile \
OCAML_CONFIG_FILE=../Makefile.config \
OCAMLOPT="../ocamlopt.opt -I ../stdlib" flexlink.exe || \
(mv flexlink flexlink.exe && false)) && \
mv flexlink.exe flexlink.opt && \
@ -642,7 +642,7 @@ ifeq "$(UNIX_OR_WIN32)" "win32"
$(MAKE) install-flexdll; \
fi
endif
$(INSTALL_DATA) config/Makefile "$(INSTALL_LIBDIR)/Makefile.config"
$(INSTALL_DATA) Makefile.config "$(INSTALL_LIBDIR)/Makefile.config"
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
if test -f ocamlopt; then $(MAKE) installopt; else \
cd "$(INSTALL_BINDIR)"; \
@ -1374,7 +1374,7 @@ depend: beforedepend
distclean: clean
rm -f boot/ocamlrun boot/ocamlrun$(EXE) boot/camlheader \
boot/*.cm* boot/libcamlrun.$(A)
rm -f config/Makefile runtime/caml/m.h runtime/caml/s.h
rm -f Makefile.config runtime/caml/m.h runtime/caml/s.h
rm -f tools/*.bak
rm -f ocaml ocamlc
rm -f testsuite/_log*

View File

@ -14,7 +14,7 @@
#**************************************************************************
# This makefile contains common definitions shared by other Makefiles
# We assume that config/Makefile has already been included
# We assume that Makefile.config has already been included
INSTALL ?= install
INSTALL_DATA ?= $(INSTALL) -m u=rw,g=rw,o=r

View File

@ -33,7 +33,7 @@ DIFF=diff -q
SORT=sort
SET_LD_PATH=CAML_LD_LIBRARY_PATH="$(LD_PATH)"
# The variables above may be overridden by .../config/Makefile
# The variables above may be overridden by .../Makefile.config
# OTOPDIR is either TOPDIR or WINTOPDIR, whichever is appropriate for
# arguments given to the OCaml compiler.
# CTOPDIR is either TOPDIR or WINTOPDIR, whichever is appropriate for
@ -48,7 +48,7 @@ SET_LD_PATH=CAML_LD_LIBRARY_PATH="$(LD_PATH)"
# variable. Note that for Windows we add Unix-syntax directory names in
# PATH, and Cygwin will translate it to Windows syntax.
include $(TOPDIR)/config/Makefile
include $(TOPDIR)/Makefile.config
ifneq ($(USE_RUNTIME),)
#Check USE_RUNTIME value

View File

@ -201,13 +201,13 @@ Now run:
followed by:
cp config/Makefile.msvc config/Makefile
cp config/Makefile.msvc Makefile.config
for 32-bit, or:
cp config/Makefile.msvc64 config/Makefile
cp config/Makefile.msvc64 Makefile.config
for 64-bit. Then, edit `config/Makefile` as needed, following the comments in
for 64-bit. Then, edit `Makefile.config` as needed, following the comments in
this file. Normally, the only variable that needs to be changed is `PREFIX`,
which indicates where to install everything.
@ -273,13 +273,13 @@ Now run:
followed by:
cp config/Makefile.mingw config/Makefile
cp config/Makefile.mingw Makefile.config
for 32-bit, or:
cp config/Makefile.mingw64 config/Makefile
cp config/Makefile.mingw64 Makefile.config
for 64-bit. Then, edit `config/Makefile` as needed, following the comments in
for 64-bit. Then, edit `Makefile.config` as needed, following the comments in
this file. Normally, the only variable that needs to be changed is `PREFIX`,
which indicates where to install everything.
@ -353,7 +353,7 @@ are UTF-8 encoded strings. In addition to filenames,
this applies to environment variables and command-line arguments.
The mode must be decided before building the system, by tweaking
the `WINDOWS_UNICODE` variable in `config/Makefile`. A value of 1
the `WINDOWS_UNICODE` variable in `Makefile.config`. A value of 1
enables the the new "Unicode" mode, while a value of 0 maintains
the legacy mode.

39
configure vendored
View File

@ -302,13 +302,14 @@ esac
# Generate the files
cd config/auto-aux
rm -f s.h m.h Makefile
touch s.h m.h Makefile
conffile=Makefile.config
rm -f s.h m.h ${conffile}
touch s.h m.h ${conffile}
# Write options to Makefile
# Write options to ${conffile}
config() {
# This function hardens the generated Makefile against '#' symbols
# This function hardens the generated Makefile.config against '#' symbols
# present in a source path (opam-compiler-conf may pick such directory
# names if working from a branch named 'PR#4242-answer-all-questions')
# by escaping them into '\#'.
@ -325,10 +326,10 @@ config() {
# $(PREFIX) is also injected in C code where this escape is invalid
# -- see the definition of the OCAML_STDLIB_DIR macro below.
echo "$1=$2" | sed 's/#/\\#/g' >> Makefile
echo "$1=$2" | sed 's/#/\\#/g' >> ${conffile}
}
echo "# generated by ./configure $configure_options" >> Makefile
echo "# generated by ./configure $configure_options" >> ${conffile}
config CONFIGURE_ARGS "$configure_options"
# Where to install
@ -1750,8 +1751,8 @@ else
otherlibraries="$otherlibraries graph"
fi
fi
echo "X11_INCLUDES=$x11_include" >> Makefile
echo "X11_LINK=$x11_link" >> Makefile
config X11_INCLUDES "$x11_include"
config X11_LINK "$x11_link"
# Look for BFD library
@ -1777,8 +1778,8 @@ if $shared_libraries_supported && ./hasgot -DPACKAGE=ocaml -i bfd.h ; then
wrn "Could not determine link options for the BFD library"
LIBBFD_LINK=
fi
echo "LIBBFD_LINK=$LIBBFD_LINK" >> Makefile
echo LIBBFD_INCLUDE= >>Makefile
config LIBBFD_LINK "$LIBBFD_LINK"
config LIBBFD_INCLUDE ""
elif sh ./hasgot -DPACKAGE=ocaml -I/opt/local/include -i bfd.h && \
sh ./hasgot -DPACKAGE=ocaml -L/opt/local/lib -lbfd -ldl \
-liberty -lz -lintl bfd_openr
@ -1786,13 +1787,13 @@ then
# MacOSX with binutils from MacPorts
inf "BFD library found."
echo "#define HAS_LIBBFD" >> s.h
echo "LIBBFD_LINK=-L/opt/local/lib -lbfd -ldl -liberty -lz -lintl" >> Makefile
echo LIBBFD_INCLUDE=-I/opt/local/include >>Makefile
config LIBBFD_LINK "-L/opt/local/lib -lbfd -ldl -liberty -lz -lintl"
config LIBBFD_INCLUDE "-I/opt/local/include"
else
wrn "BFD library not found, 'objinfo' will be unable to display info" \
" on .cmxs files."
echo "LIBBFD_LINK=" >> Makefile
echo "LIBBFD_INCLUDE=" >> Makefile
config LIBBFD_LINK ""
config LIBBFD_INCLUDE ""
fi
# Check whether assembler supports CFI directives
@ -1961,8 +1962,8 @@ 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
config INSTALL_BYTECODE_PROGRAMS "$install_bytecode_programs"
config INSTALL_SOURCE_ARTIFACTS "$install_source_artifacts"
# Finish generated files
@ -1984,7 +1985,7 @@ config SUPPORTS_SHARED_LIBRARIES "$shared_libraries_supported"
config SHAREDLIB_CFLAGS "$sharedlib_cflags"
config MKSHAREDLIBRPATH "$mksharedlibrpath"
config NATDYNLINKOPTS "$natdynlinkopts"
cat >> Makefile <<EOF
cat >> ${conffile} <<EOF
SYSLIB=-l\$(1)
#ml let syslib x = "-l"^x;;
@ -2060,9 +2061,9 @@ config AS_HAS_DEBUG_PREFIX_MAP "$as_has_debug_prefix_map"
rm -f tst hasgot.c
rm -f ../../runtime/caml/m.h ../../runtime/caml/s.h ../Makefile
rm -f ../../runtime/caml/m.h ../../runtime/caml/s.h ../${conffile}
mv m.h s.h ../../runtime/caml/
mv Makefile ..
mv ${conffile} ../..
# Print a summary

View File

@ -13,7 +13,7 @@
#* *
#**************************************************************************
include ../config/Makefile
include ../Makefile.config
include ../Makefile.common
UNIXDIR=../otherlibs/$(UNIXLIB)

View File

@ -12,7 +12,7 @@
#* *
#**************************************************************************
include ../config/Makefile
include ../Makefile.config
include ../Makefile.common
# Files to install

View File

@ -17,7 +17,7 @@
ROOTDIR = ..
include $(ROOTDIR)/config/Makefile
include $(ROOTDIR)/Makefile.config
include $(ROOTDIR)/Makefile.common
CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun

View File

@ -13,7 +13,7 @@
#* *
#**************************************************************************
include ../config/Makefile
include ../Makefile.config
INSTALL_DIR=$(DESTDIR)$(MANDIR)/man$(PROGRAMS_MAN_SECTION)

View File

@ -1593,7 +1593,7 @@ With "ocamlopt", you should do:
\paragraph{Warning:} On some ports, special options are required on the final
linking phase that links together the object file produced by the
"-output-obj" option and the remainder of the program. Those options
are shown in the configuration file "config/Makefile" generated during
are shown in the configuration file "Makefile.config" generated during
compilation of OCaml, as the variable "OC_LDFLAGS".
\begin{itemize}
\item Windows with the MSVC compiler: the object file produced by

View File

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

View File

@ -15,7 +15,7 @@
# Define the lists of mli file used by ocamldoc to generate the stdlib
# + otherlibs + compilerlibs + plugin hooks documentation
include $(SRC)/config/Makefile
include $(SRC)/Makefile.config
include $(SRC)/stdlib/StdlibModules
PARSING_MLIS := $(wildcard $(SRC)/parsing/*.mli)
UTILS_MLIS := $(wildcard $(SRC)/utils/*.mli)

View File

@ -17,7 +17,7 @@
ROOTDIR = ..
include $(ROOTDIR)/config/Makefile
include $(ROOTDIR)/Makefile.config
include $(ROOTDIR)/Makefile.common
ifeq "$(UNIX_OR_WIN32)" "win32"

View File

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

View File

@ -17,7 +17,7 @@
# FIXME reduce redundancy by including ../Makefile
include ../../config/Makefile
include ../../Makefile.config
include ../../Makefile.common
CAMLRUN ?= ../../boot/ocamlrun

View File

@ -15,7 +15,7 @@
ROOTDIR=../..
include $(ROOTDIR)/config/Makefile
include $(ROOTDIR)/Makefile.config
include $(ROOTDIR)/Makefile.common
CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun

View File

@ -15,7 +15,7 @@
# FIXME reduce redundancy by including ../Makefile
include ../../config/Makefile
include ../../Makefile.config
include ../../Makefile.common
CAMLRUN ?= ../../boot/ocamlrun

View File

@ -13,7 +13,7 @@
#* *
#**************************************************************************
include ../config/Makefile
include ../Makefile.config
include ../Makefile.common
# Lists of source files
@ -224,7 +224,7 @@ distclean: clean
# Generated non-object files
ld.conf: ../config/Makefile
ld.conf: ../Makefile.config
echo "$(STUBLIBDIR)" > $@
echo "$(LIBDIR)" >> $@

View File

@ -13,7 +13,7 @@
#* *
#**************************************************************************
include ../config/Makefile
include ../Makefile.config
include ../Makefile.common
CAMLRUN ?= ../boot/ocamlrun
@ -150,7 +150,7 @@ CAMLHEADERS =\
camlheaderi target_camlheaderi
ifeq "$(HASHBANGSCRIPTS)" "true"
$(CAMLHEADERS): ../config/Makefile
$(CAMLHEADERS): ../Makefile.config
for suff in '' d i; do \
echo '#!$(BINDIR)/ocamlrun'$$suff > camlheader$$suff && \
echo '#!$(TARGET_BINDIR)/ocamlrun'$$suff >target_camlheader$$suff; \
@ -158,7 +158,7 @@ $(CAMLHEADERS): ../config/Makefile
echo '#!' | tr -d '\012' > camlheader_ur;
else # Hashbang scripts not supported
$(CAMLHEADERS): $(HEADERPROGRAM) ../config/Makefile
$(CAMLHEADERS): $(HEADERPROGRAM) ../Makefile.config
ifeq "$(UNIX_OR_WIN32)" "unix"
$(CAMLHEADERS):

View File

@ -2,7 +2,7 @@
if ! which gfortran > /dev/null 2>&1; then
echo "gfortran not available" > ${ocamltest_response}
test_result=${TEST_SKIP}
elif ! grep -q '^CC=gcc' ${ocamlsrcdir}/config/Makefile; then
elif ! grep -q '^CC=gcc' ${ocamlsrcdir}/Makefile.config; then
echo "OCaml was not compiled with gcc" > ${ocamltest_response}
test_result=${TEST_SKIP}
else

View File

@ -13,7 +13,7 @@
#**************************************************************************
BASEDIR=..
include $(BASEDIR)/../config/Makefile
include $(BASEDIR)/../Makefile.config
expect_MAIN=expect_test
expect_PROG=$(expect_MAIN)$(EXE)
expect_COMPFLAGS=-I $(OTOPDIR)/parsing -I $(OTOPDIR)/utils \

View File

@ -16,7 +16,7 @@
MAKEFLAGS := -r -R
ROOTDIR = ..
include $(ROOTDIR)/config/Makefile
include $(ROOTDIR)/Makefile.config
include $(ROOTDIR)/Makefile.common
ifeq ($(SYSTEM),unix)
@ -149,13 +149,13 @@ $(call byte_and_opt,ocamlmklib,ocamlmklibconfig.cmo config.cmo \
build_path_prefix_map.cmo misc.cmo ocamlmklib.cmo,)
ocamlmklibconfig.ml: $(ROOTDIR)/config/Makefile Makefile
ocamlmklibconfig.ml: $(ROOTDIR)/Makefile.config Makefile
(echo 'let bindir = "$(BINDIR)"'; \
echo 'let supports_shared_libraries = $(SUPPORTS_SHARED_LIBRARIES)';\
echo 'let default_rpath = "$(RPATH)"'; \
echo 'let mksharedlibrpath = "$(MKSHAREDLIBRPATH)"'; \
echo 'let toolpref = "$(TOOLPREF)"'; \
sed -n -e 's/^#ml //p' $(ROOTDIR)/config/Makefile) \
sed -n -e 's/^#ml //p' $(ROOTDIR)/Makefile.config) \
> ocamlmklibconfig.ml
beforedepend:: ocamlmklibconfig.ml

View File

@ -37,13 +37,13 @@ function set_configuration {
cp config/m-nt.h runtime/caml/m.h
cp config/s-nt.h runtime/caml/s.h
FILE=$(pwd | cygpath -f - -m)/config/Makefile
FILE=$(pwd | cygpath -f - -m)/Makefile.config
echo "Edit $FILE to set PREFIX=$2"
sed -e "/PREFIX=/s|=.*|=$2|" \
-e "/RUNTIMED=/s|=.*|=true|" \
-e "/^ *OC_CFLAGS *=/s/\r\?$/ $3\0/" \
config/Makefile.$1 > config/Makefile
# run "Content of $FILE" cat config/Makefile
config/Makefile.$1 > Makefile.config
# run "Content of $FILE" cat Makefile.config
}
APPVEYOR_BUILD_FOLDER=$(echo $APPVEYOR_BUILD_FOLDER| cygpath -f -)

View File

@ -229,11 +229,11 @@ case $configure in
nt)
cp config/m-nt.h runtime/caml/m.h
cp config/s-nt.h runtime/caml/s.h
cp config/Makefile.${OCAML_ARCH} config/Makefile
sed -i "s%PREFIX=\(.\+\)%PREFIX=${instdir}%" config/Makefile
sed -i 's%RUNTIMED=.\+%RUNTIMED=true%' config/Makefile
cp config/Makefile.${OCAML_ARCH} Makefile.config
sed -i "s%PREFIX=\(.\+\)%PREFIX=${instdir}%" Makefile.config
sed -i 's%RUNTIMED=.\+%RUNTIMED=true%' Makefile.config
if $flambda; then
sed -i 's%FLAMBDA=.\+%FLAMBDA=true%' config/Makefile
sed -i 's%FLAMBDA=.\+%FLAMBDA=true%' Makefile.config
fi
;;
*) error "internal error";;

View File

@ -48,12 +48,14 @@ arch_error() {
error "$msg"
}
# Change a variable in config/Makefile
# Change a variable in Makefile.config
# Usage: set_config_var <variable name> <new value>
set_config_var() {
mv config/Makefile config/Makefile.bak
(grep -v "^$1=" config/Makefile.bak; echo "$1=$2") > config/Makefile
conffile=Makefile.config
mv ${conffile} ${conffile}.bak
(grep -v "^$1=" ${conffile}.bak; echo "$1=$2") > ${conffile}
}
# Undefine a macro in a C header file

View File

@ -103,6 +103,7 @@ set -ex
# set up variables
# default values
conffile=Makefile.config
make=make
instdir="$HOME/ocaml-tmp-install"
configure=unix
@ -206,11 +207,11 @@ case $configure in
nt)
cp config/m-nt.h runtime/caml/m.h
cp config/s-nt.h runtime/caml/s.h
cp config/Makefile.${OCAML_ARCH} config/Makefile
sed -i "s%PREFIX=\(.\+\)%PREFIX=${instdir}%" config/Makefile
sed -i 's%RUNTIMED=.\+%RUNTIMED=true%' config/Makefile
cp config/Makefile.${OCAML_ARCH} ${conffile}
sed -i "s%PREFIX=\(.\+\)%PREFIX=${instdir}%" ${conffile}
sed -i 's%RUNTIMED=.\+%RUNTIMED=true%' ${conffile}
if $flambda; then
sed -i 's%FLAMBDA=.\+%FLAMBDA=true%' config/Makefile
sed -i 's%FLAMBDA=.\+%FLAMBDA=true%' ${conffile}
fi
;;
*) error "internal error";;

View File

@ -15,7 +15,7 @@
# Makefile for the parser generator.
include ../config/Makefile
include ../Makefile.config
OBJS= closure.$(O) error.$(O) lalr.$(O) lr0.$(O) main.$(O) \
mkpar.$(O) output.$(O) reader.$(O) \