diff options
| author | Xavier Leroy <xavier.leroy@inria.fr> | 2013-11-29 13:04:38 +0000 |
|---|---|---|
| committer | Xavier Leroy <xavier.leroy@inria.fr> | 2013-11-29 13:04:38 +0000 |
| commit | 33f242aaea3d761fb524c61855f677560c97069a (patch) | |
| tree | 8c4de14b223942cbea6c4e6a6d5ede38bb749807 | |
| parent | 15da6d18042500c6e8f9698bf05bebcec456e9d3 (diff) | |
| download | ocaml-33f242aaea3d761fb524c61855f677560c97069a.tar.gz | |
Reverting the elimination of the ocamlcomp*.sh scripts, namely the following commits:
14278
14277
14276
14176
14175
14173
14172
14171
14169
14168
14167
These changes need to mature on their own branch.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14329 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
37 files changed, 255 insertions, 341 deletions
@@ -5,6 +5,8 @@ expunge ocaml ocamlopt ocamlopt.opt +ocamlcomp.sh +ocamlcompopt.sh package-macosx _boot_log1 _boot_log2 @@ -16,16 +16,16 @@ include config/Makefile include stdlib/StdlibModules CAMLC=boot/ocamlrun boot/ocamlc -nostdlib -I boot -CAMLOPT=$(CAMLOPT_BIN) -nostdlib -I stdlib -I otherlibs/dynlink +CAMLOPT=boot/ocamlrun ./ocamlopt -nostdlib -I stdlib -I otherlibs/dynlink COMPFLAGS=-strict-sequence -w +33..39 -warn-error A $(INCLUDES) LINKFLAGS= -SWITCH_COMPILER=cd $(ROOTDIR)/config && $(MAKE) -f Makefile.switch-compiler CAMLYACC=boot/ocamlyacc YACCFLAGS=-v CAMLLEX=boot/ocamlrun boot/ocamllex CAMLDEP=boot/ocamlrun tools/ocamldep DEPFLAGS=$(INCLUDES) +CAMLRUN=byterun/ocamlrun SHELL=/bin/sh MKDIR=mkdir -p @@ -189,7 +189,7 @@ coldstart: cp byterun/ocamlrun$(EXE) boot/ocamlrun$(EXE) cd yacc; $(MAKE) all cp yacc/ocamlyacc$(EXE) boot/ocamlyacc$(EXE) - cd stdlib; $(MAKE) all CAMLC="../boot/ocamlrun ../boot/ocamlc -nostdlib -I ../boot" + cd stdlib; $(MAKE) COMPILER=../boot/ocamlc all cd stdlib; cp $(LIBFILES) ../boot if test -f boot/libcamlrun.a; then :; else \ ln -s ../byterun/libcamlrun.a boot/libcamlrun.a; fi @@ -377,13 +377,9 @@ partialclean:: ocamlc: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma $(BYTESTART) $(CAMLC) $(LINKFLAGS) -compat-32 -o ocamlc \ compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma $(BYTESTART) - $(SWITCH_COMPILER) enable COMPILER=CAMLC VARIANT=BYTE - $(SWITCH_COMPILER) disable COMPILER=CAMLC VARIANT=OPT - -partialclean:: - if [ -n "$(ROOTDIR)" ]; then \ - $(SWITCH_COMPILER) disable COMPILER=CAMLC VARIANT=BYTE ; \ - fi + @sed -e 's|@compiler@|$$topdir/boot/ocamlrun $$topdir/ocamlc|' \ + driver/ocamlcomp.sh.in > ocamlcomp.sh + @chmod +x ocamlcomp.sh # The native-code compiler @@ -395,14 +391,12 @@ partialclean:: ocamlopt: compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma $(OPTSTART) $(CAMLC) $(LINKFLAGS) -o ocamlopt \ compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma $(OPTSTART) - $(SWITCH_COMPILER) enable COMPILER=CAMLOPT VARIANT=BYTE - $(SWITCH_COMPILER) disable COMPILER=CAMLOPT VARIANT=OPT + @sed -e 's|@compiler@|$$topdir/boot/ocamlrun $$topdir/ocamlopt|' \ + driver/ocamlcomp.sh.in > ocamlcompopt.sh + @chmod +x ocamlcompopt.sh partialclean:: - rm -f ocamlopt - if [ -n "$(ROOTDIR)" ]; then \ - $(SWITCH_COMPILER) disable COMPILER=CAMLOPT VARIANT=BYTE ; \ - fi + rm -f ocamlopt ocamlcompopt.sh # The toplevel @@ -511,13 +505,12 @@ ocamlc.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \ $(CAMLOPT) $(LINKFLAGS) -ccopt "$(BYTECCLINKOPTS)" -o ocamlc.opt \ compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \ $(BYTESTART:.cmo=.cmx) -cclib "$(BYTECCLIBS)" - $(SWITCH_COMPILER) enable COMPILER=CAMLC VARIANT=OPT + @sed -e 's|@compiler@|$$topdir/ocamlc.opt|' \ + driver/ocamlcomp.sh.in > ocamlcomp.sh + @chmod +x ocamlcomp.sh partialclean:: rm -f ocamlc.opt - if [ -n "$(ROOTDIR)" ]; then \ - $(SWITCH_COMPILER) disable COMPILER=CAMLC VARIANT=OPT ; \ - fi # The native-code compiler compiled with itself @@ -531,13 +524,12 @@ ocamlopt.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \ $(CAMLOPT) $(LINKFLAGS) -o ocamlopt.opt \ compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \ $(OPTSTART:.cmo=.cmx) - $(SWITCH_COMPILER) enable COMPILER=CAMLOPT VARIANT=OPT + @sed -e 's|@compiler@|$$topdir/ocamlopt.opt|' \ + driver/ocamlcomp.sh.in > ocamlcompopt.sh + @chmod +x ocamlcompopt.sh partialclean:: rm -f ocamlopt.opt - if [ -n "$(ROOTDIR)" ]; then \ - $(SWITCH_COMPILER) disable COMPILER=CAMLOPT VARIANT=OPT ; \ - fi $(COMMON:.cmo=.cmx) $(BYTECOMP:.cmo=.cmx) $(ASMCOMP:.cmo=.cmx): ocamlopt @@ -625,7 +617,8 @@ partialclean:: beforedepend:: asmcomp/emit.ml tools/cvt_emit: tools/cvt_emit.mll - cd tools; $(MAKE) cvt_emit + cd tools; \ + $(MAKE) CAMLC="../$(CAMLRUN) ../boot/ocamlc -I ../stdlib" cvt_emit # The "expunge" utility @@ -842,7 +835,7 @@ alldepend:: depend distclean: ./build/distclean.sh - rm -f ocaml testsuite/_log + rm -f ocaml ocamlcomp.sh testsuite/_log .PHONY: all backup bootstrap checkstack clean .PHONY: partialclean beforedepend alldepend cleanboot coldstart diff --git a/Makefile.nt b/Makefile.nt index 8fd4547813..f9cbceacef 100644 --- a/Makefile.nt +++ b/Makefile.nt @@ -16,16 +16,15 @@ include config/Makefile include stdlib/StdlibModules CAMLC=boot/ocamlrun boot/ocamlc -nostdlib -I boot -CAMLOPT=$(CAMLOPT_BIN) -nostdlib -I stdlib -I otherlibs/dynlink +CAMLOPT=boot/ocamlrun ./ocamlopt -nostdlib -I stdlib -I otherlibs/dynlink COMPFLAGS=-strict-sequence -warn-error A $(INCLUDES) LINKFLAGS= -SWITCH_COMPILER=make -C $(ROOTDIR)/config -f Makefile.switch-compiler - CAMLYACC=boot/ocamlyacc YACCFLAGS= CAMLLEX=boot/ocamlrun boot/ocamllex CAMLDEP=boot/ocamlrun tools/ocamldep DEPFLAGS=$(INCLUDES) +CAMLRUN=byterun/ocamlrun OCAMLBUILDBYTE=$(WITH_OCAMLBUILD:=.byte) OCAMLBUILDNATIVE=$(WITH_OCAMLBUILD:=.native) @@ -142,15 +141,11 @@ LIBFILES=stdlib.cma std_exit.cmo *.cmi camlheader # Start up the system from the distribution compiler coldstart: - $(SWITCH_COMPILER) disable COMPILER=CAMLC VARIANT=BYTE - $(SWITCH_COMPILER) disable COMPILER=CAMLC VARIANT=OPT - $(SWITCH_COMPILER) disable COMPILER=CAMLOPT VARIANT=BYTE - $(SWITCH_COMPILER) disable COMPILER=CAMLOPT VARIANT=OPT cd byterun ; $(MAKEREC) all cp byterun/ocamlrun.exe boot/ocamlrun.exe cd yacc ; $(MAKEREC) all cp yacc/ocamlyacc.exe boot/ocamlyacc.exe - cd stdlib ; $(MAKEREC) all CAMLC="../boot/ocamlrun ../boot/ocamlc -nostdlib -I ../boot" + cd stdlib ; $(MAKEREC) COMPILER=../boot/ocamlc all cd stdlib ; cp $(LIBFILES) ../boot # Build the core system: the minimum needed to make depend and bootstrap @@ -295,12 +290,12 @@ partialclean:: ocamlc: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma $(BYTESTART) $(CAMLC) $(LINKFLAGS) -compat-32 -o ocamlc compilerlibs/ocamlcommon.cma \ compilerlibs/ocamlbytecomp.cma $(BYTESTART) - $(SWITCH_COMPILER) enable COMPILER=CAMLC VARIANT=BYTE - $(SWITCH_COMPILER) disable COMPILER=CAMLC VARIANT=OPT + @sed -e 's|@compiler@|$$topdir/boot/ocamlrun $$topdir/ocamlc|' \ + driver/ocamlcomp.sh.in > ocamlcomp.sh + @chmod +x ocamlcomp.sh partialclean:: - rm -f ocamlc - $(SWITCH_COMPILER) disable COMPILER=CAMLC VARIANT=BYTE + rm -f ocamlc ocamlcomp.sh # The native-code compiler @@ -312,12 +307,12 @@ partialclean:: ocamlopt: compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma $(OPTSTART) $(CAMLC) $(LINKFLAGS) -o ocamlopt \ compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma $(OPTSTART) - $(SWITCH_COMPILER) enable COMPILER=CAMLOPT VARIANT=BYTE - $(SWITCH_COMPILER) disable COMPILER=CAMLOPT VARIANT=OPT + @sed -e 's|@compiler@|$$topdir/boot/ocamlrun $$topdir/ocamlopt|' \ + driver/ocamlcomp.sh.in > ocamlcompopt.sh + @chmod +x ocamlcompopt.sh partialclean:: - rm -f ocamlopt - $(SWITCH_COMPILER) disable COMPILER=CAMLOPT VARIANT=BYTE + rm -f ocamlopt ocamlcompopt.sh # The toplevel @@ -430,11 +425,12 @@ ocamlc.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \ $(CAMLOPT) $(LINKFLAGS) -ccopt "$(BYTECCLINKOPTS)" -o ocamlc.opt \ compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \ $(BYTESTART:.cmo=.cmx) -cclib "$(BYTECCLIBS)" - $(SWITCH_COMPILER) enable COMPILER=CAMLC VARIANT=OPT + @sed -e 's|@compiler@|$$topdir/ocamlc.opt|' \ + driver/ocamlcomp.sh.in > ocamlcomp.sh + @chmod +x ocamlcomp.sh partialclean:: rm -f ocamlc.opt - $(SWITCH_COMPILER) disable COMPILER=CAMLC VARIANT=OPT # The native-code compiler compiled with itself @@ -448,11 +444,12 @@ ocamlopt.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \ $(CAMLOPT) $(LINKFLAGS) -o ocamlopt.opt \ compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \ $(OPTSTART:.cmo=.cmx) - $(SWITCH_COMPILER) enable COMPILER=CAMLOPT VARIANT=OPT + @sed -e 's|@compiler@|$$topdir/ocamlopt.opt|' \ + driver/ocamlcomp.sh.in > ocamlcompopt.sh + @chmod +x ocamlcompopt.sh partialclean:: rm -f ocamlopt.opt - $(SWITCH_COMPILER) disable COMPILER=CAMLOPT VARIANT=OPT $(COMMON:.cmo=.cmx) $(BYTECOMP:.cmo=.cmx) $(ASMCOMP:.cmo=.cmx): ocamlopt diff --git a/build/fastworld.sh b/build/fastworld.sh index b9fa1248f1..389a8a8d98 100755 --- a/build/fastworld.sh +++ b/build/fastworld.sh @@ -19,7 +19,8 @@ if [ -e ocamlbuild_mixed_mode ]; then echo 'please cleanup and re-launch (make clean ; ./build/distclean.sh)' exit 1 fi -./mk_shell_and_ocamlbuild_config.sh +./mkconfig.sh +./mkmyocamlbuild_config.sh ./boot-c-parts.sh ./boot.sh $@ diff --git a/build/mixed-boot.sh b/build/mixed-boot.sh index 057b523332..133f8cff85 100755 --- a/build/mixed-boot.sh +++ b/build/mixed-boot.sh @@ -17,5 +17,6 @@ cd `dirname $0`/.. touch build/ocamlbuild_mixed_mode mkdir -p _build cp -rf boot _build/ -./build/mk_shell_and_ocamlbuild_config.sh +./build/mkconfig.sh +./build/mkmyocamlbuild_config.sh ./build/boot.sh diff --git a/build/mk_shell_and_ocamlbuild_config.sh b/build/mk_shell_and_ocamlbuild_config.sh deleted file mode 100755 index cdaf8e528e..0000000000 --- a/build/mk_shell_and_ocamlbuild_config.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -eux - -# Generate config.sh and myocamlbuild_config.ml from config/Makefile. -# -# The approach is to create a new Makefile that "include" the config one and has -# a single rule that prints the value of each variable config/Makefile. - -# Replace a variable name like "VAR" with [echo 'VAR="$(VAR)"; \\] for use in a -# Makefile rule. -print_value_shell='s/.*/ echo &="\\"$(&)\\""; \\/' - -# Replace a variable name like "VAR" with [echo 'let var = "$(VAR)";;'; \\] for -# use in a Makefile rule. -# It's fairly annoying to have to rely on tr but there is no portable way to -# get the lowercase value of a variable in make. -print_value_ocaml='s/.*/ echo let $$(echo & | tr "[:upper:]" "[:lower:]") = "\\"$(&)\\";;"; \\/' - -main() { - # Command to run to output a line of code to set a variable to its value. - local print_value="${1}" - - # List the variables in a Makefile except the ones that are commented out. - local list_variables='/[^#].*=/ s/\([^ \t:=]\{1,\}\).*=.*$/\1/ p' - - # Variables we don't want to retrieve. - local exclude='^#|\<CAML(C|OPT)_BIN\>|\<(MKLIB|SYSLIB|FLEXDIR|IFLEXDIR|^SET_LD_PATH)\>' - - # Some variables in the config have a value that is shell script and has to be - # evaluated to make sense for the outputs. - local eval_command='s/\\"\(.*\)\\"/\\"$$(\1)\\"/' - local eval_commands_1='/CAMLC_BIN_CMD_TO_EVAL/ '"${eval_command}" - local eval_commands_2='/CAMLOPT_BIN_CMD_TO_EVAL/ '"${eval_command}" - - printf "include Makefile\n\n" - printf "p:\n\t@true; \\\\\n" - sed -n "${list_variables}" Makefile \ - | grep -v -E "${exclude}" \ - | sed "${print_value}" \ - | sed -e "${eval_commands_1}" -e "${eval_commands_2}" - printf "\ttrue\n\n" - printf ".PHONY: p" -} - -# Unset both MAKEFLAGS and MAKELEVEL which we inherit from the recursive make -# calls in the build system. This prevents (gnu) make from printing the current -# directory [ make[4]: Leaving directory `/foo/ocaml/config' ]. -unset MAKEFLAGS -unset MAKELEVEL - -cd `dirname $0`/../config - -main "${print_value_shell}" > mkconfig.Makefile -make -f mkconfig.Makefile > config.sh - -main "${print_value_ocaml}" > mkconfig.Makefile -# The OCaml code expects bools instead of strings for true and false. -make -f mkconfig.Makefile \ - | sed -e 's/"true"/true/' -e 's/"false"/false/' \ - > ../myocamlbuild_config.ml -# ./configure outputs in config/Makefile some OCaml functions which we need; -# they are commented out and preceded with '#ml '; since they depend on other -# values, output them at the very end of the output. -sed -n 's/^#ml // p' Makefile >> ../myocamlbuild_config.ml - -rm -f mkconfig.Makefile diff --git a/build/mkconfig.sh b/build/mkconfig.sh new file mode 100755 index 0000000000..8cf1773dd9 --- /dev/null +++ b/build/mkconfig.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +######################################################################### +# # +# OCaml # +# # +# Nicolas Pouillard, projet Gallium, INRIA Rocquencourt # +# # +# Copyright 2007 Institut National de Recherche en Informatique et # +# en Automatique. All rights reserved. This file is distributed # +# under the terms of the Q Public License version 1.0. # +# # +######################################################################### + +cd `dirname $0`/.. + +sed -e 's/^\(.*\$([0-9]).*\)$/# \1/' \ + -e 's/\$(\([^)]*\))/${\1}/g' \ + -e 's/^FLEX.*$//g' \ + -e 's/^\([^#=]*\)=\([^"]*\)$/if [ "x$\1" = "x" ]; then \1="\2"; fi/' \ + config/Makefile > config/config.sh + +if [ "x$EXE" = "x.exe" -a "x$SYSTEM" != "xcygwin" ]; then + echo "WINDOWS=true" >> config/config.sh +else + echo "WINDOWS=false" >> config/config.sh +fi diff --git a/build/mkmyocamlbuild_config.sh b/build/mkmyocamlbuild_config.sh new file mode 100755 index 0000000000..75d6e9ca6a --- /dev/null +++ b/build/mkmyocamlbuild_config.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +######################################################################### +# # +# OCaml # +# # +# Nicolas Pouillard, projet Gallium, INRIA Rocquencourt # +# # +# Copyright 2007 Institut National de Recherche en Informatique et # +# en Automatique. All rights reserved. This file is distributed # +# under the terms of the Q Public License version 1.0. # +# # +######################################################################### + +cd `dirname $0`/.. + +sed \ + -e 's/^.*FLEXDIR.*$//g' \ + -e '/^SET_LD_PATH/d' \ + -e 's/^#ml \(.*\)/\1/' \ + -e 's/^\([^"][^"]*\("[^"]*"[^"]*\)*\)#.*$/\1/' \ + -e 's/^\(#.*\)$/(* \1 *)/' \ + -e 's/^\(.*\$([0-9]).*\)$/(* \1 *)/' \ + -e 's/^\([^(=]*\)=\([^"]*\)$/let <:lower<\1>> = "\2";;/' \ + -e 's/\$(AS)/as/g' \ + -e 's/\$(\([^)]*\))/"\^<:lower<\1>>\^"/g' \ + -e 's/""\^//g' \ + -e 's/\^""//g' \ + -e 's/^let <:lower<MAKE.*$//g' \ + -e 's/^let <:lower<DO.*$//g' \ + -e 's/"true"/true/g' \ + -e 's/"false"/false/g' \ + config/Makefile \ + | sed -f build/tolower.sed \ + | sed -f build/tolower.sed \ + | sed -f build/tolower.sed \ + | sed -f build/tolower.sed \ + | sed -f build/tolower.sed \ + | sed -f build/tolower.sed \ + > myocamlbuild_config.ml diff --git a/build/new-build-system b/build/new-build-system index f76f07cebc..60018e40e8 100644 --- a/build/new-build-system +++ b/build/new-build-system @@ -38,7 +38,8 @@ build/ distclean.sh # Clean all generated files myocamlbuild.sh # Regenerate the boot/myocamlbuild program - mk_shell_and_ocamlbuild_config.sh # Generate config/config.sh and myocamlbuild_config.ml + mkconfig.sh # Generate config/config.sh + mkmyocamlbuild_config.sh # Generate myocamlbuild_config.ml # Partial stuffs mixed-boot.sh diff --git a/build/partial-install.sh b/build/partial-install.sh index 7af60188cc..4a8ff502cb 100755 --- a/build/partial-install.sh +++ b/build/partial-install.sh @@ -20,19 +20,8 @@ set -e cd `dirname $0`/.. -# Save the following environment variables before sourcing config.sh since it -# will overwrite them and the user might have set them to emulate $(DESTDIR) -# which is unfortunately not supported. -SAVED_BINDIR="${BINDIR}" -SAVED_LIBDIR="${LIBDIR}" -SAVED_MANDIR="${MANDIR}" - . config/config.sh -BINDIR="${SAVED_BINDIR:-${BINDIR}}" -LIBDIR="${SAVED_LIBDIR:-${LIBDIR}}" -MANDIR="${SAVED_MANDIR:-${MANDIR}}" - not_installed=$PWD/_build/not_installed rm -f "$not_installed" @@ -115,12 +104,21 @@ installlibdir() { mkdir -p $BINDIR mkdir -p $LIBDIR mkdir -p $LIBDIR/ocamlbuild +mkdir -p $STUBLIBDIR mkdir -p $MANDIR/man1 mkdir -p $MANDIR/man3 +mkdir -p $MANDIR/man$MANEXT cd _build -if [ -n "${WITH_OCAMLBUILD}" ]; then +# I would have liked to test the value of ${WITH_OCAMLBUILD} instead of using +# "test -d". However, the config.sh script that gets sourced near the top of +# the file does: WITH_CAMLP4=${WITH_CAMLP4:-camlp4}, effectly destroying the +# information that camlp4, ocamlbuild and others might have been disabled. +# Of course, I tried to fix that. The config.sh file is created by mkconfig.sh +# through an awful set of sed expressions which I don't feel confident to +# change. -- Adrien Nader +if test -d ocamlbuild; then echo "Installing ocamlbuild..." cd ocamlbuild installbin ocamlbuild.byte$EXE $BINDIR/ocamlbuild.byte$EXE diff --git a/build/tolower.sed b/build/tolower.sed new file mode 100644 index 0000000000..ce0eb1651b --- /dev/null +++ b/build/tolower.sed @@ -0,0 +1,23 @@ +######################################################################### +# # +# OCaml # +# # +# Nicolas Pouillard, projet Gallium, INRIA Rocquencourt # +# # +# Copyright 2007 Institut National de Recherche en Informatique et # +# en Automatique. All rights reserved. This file is distributed # +# under the terms of the Q Public License version 1.0. # +# # +######################################################################### + +# tolower.sed expands one ...<:lower<FOO>>... to ...foo... per line +h +s/.*<:lower<\(.*\)>>.*/\1/ +t cont +b end +:cont +y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ +s/$/|/ +G +s/\(.*\)|\n\(.*\)<:lower<\(.*\)>>/\2\1/ +:end diff --git a/build/world.sh b/build/world.sh index 6475a9fca0..3b08dc78d2 100755 --- a/build/world.sh +++ b/build/world.sh @@ -28,7 +28,8 @@ case "$1" in exit 1;; esac shift -./mk_shell_and_ocamlbuild_config.sh +./mkconfig.sh +./mkmyocamlbuild_config.sh ./boot-c-parts.sh ./boot.sh "$@" ./world."$mode".sh "$@" diff --git a/config/.ignore b/config/.ignore index 24fdb45cad..9fc1c014fc 100644 --- a/config/.ignore +++ b/config/.ignore @@ -2,4 +2,3 @@ m.h s.h Makefile config.sh -ocamlcomp diff --git a/config/Makefile.mingw b/config/Makefile.mingw index 78f5228c21..0589e59bb3 100644 --- a/config/Makefile.mingw +++ b/config/Makefile.mingw @@ -173,23 +173,3 @@ CYGPATH=cygpath -m DIFF=diff -q --strip-trailing-cr CANKILL=false SET_LD_PATH=PATH="$(PATH):$(LD_PATH)" - -THIS_MAKEFILE=$(filter %config/Makefile,$(MAKEFILE_LIST)) -ifeq ($(filter /%,$(THIS_MAKEFILE)),) -ROOTDIR:=$(abspath $(dir $(CURDIR)/$(THIS_MAKEFILE))/..) -else -ROOTDIR:=$(abspath $(dir $(THIS_MAKEFILE))/..) -endif -CAMLRUN:=$(ROOTDIR)/boot/ocamlrun$(EXE) -OCAMLRUN:=$(CAMLRUN) -ROOTDIR_COMPAT:=$(shell $(CYGPATH) $(ROOTDIR)) -CAMLC_BIN_BOOT = $(CAMLRUN) $(ROOTDIR_COMPAT)/boot/ocamlc -CAMLC_BIN_BYTE = $(CAMLRUN) $(ROOTDIR_COMPAT)/ocamlc -CAMLC_BIN_OPT = $(ROOTDIR_COMPAT)/ocamlc.opt -CAMLOPT_BIN_BYTE = $(CAMLRUN) $(ROOTDIR_COMPAT)/ocamlopt -CAMLOPT_BIN_OPT = $(ROOTDIR_COMPAT)/ocamlopt.opt - -CAMLC_BIN = @ . $(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; $${CAMLC_BIN} -CAMLOPT_BIN = @ . $(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; $${CAMLOPT_BIN} -CAMLC_BIN_CMD_TO_EVAL = . $(ROOTDIR)/config/ocamlcomp; echo $${CAMLC_BIN} -CAMLOPT_BIN_CMD_TO_EVAL = . $(ROOTDIR)/config/ocamlcomp; echo $${CAMLOPT_BIN} diff --git a/config/Makefile.mingw64 b/config/Makefile.mingw64 index 2c3ecfe506..cb470e3f73 100644 --- a/config/Makefile.mingw64 +++ b/config/Makefile.mingw64 @@ -173,23 +173,3 @@ CYGPATH=cygpath -m DIFF=diff -q --strip-trailing-cr CANKILL=false SET_LD_PATH=PATH="$(PATH):$(LD_PATH)" - -THIS_MAKEFILE=$(filter %config/Makefile,$(MAKEFILE_LIST)) -ifeq ($(filter /%,$(THIS_MAKEFILE)),) -ROOTDIR:=$(abspath $(dir $(CURDIR)/$(THIS_MAKEFILE))/..) -else -ROOTDIR:=$(abspath $(dir $(THIS_MAKEFILE))/..) -endif -CAMLRUN:=$(ROOTDIR)/boot/ocamlrun$(EXE) -OCAMLRUN:=$(CAMLRUN) -ROOTDIR_COMPAT:=$(shell $(CYGPATH) $(ROOTDIR)) -CAMLC_BIN_BOOT = $(CAMLRUN) $(ROOTDIR_COMPAT)/boot/ocamlc -CAMLC_BIN_BYTE = $(CAMLRUN) $(ROOTDIR_COMPAT)/ocamlc -CAMLC_BIN_OPT = $(ROOTDIR_COMPAT)/ocamlc.opt -CAMLOPT_BIN_BYTE = $(CAMLRUN) $(ROOTDIR_COMPAT)/ocamlopt -CAMLOPT_BIN_OPT = $(ROOTDIR_COMPAT)/ocamlopt.opt - -CAMLC_BIN = @ . $(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; $${CAMLC_BIN} -CAMLOPT_BIN = @ . $(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; $${CAMLOPT_BIN} -CAMLC_BIN_CMD_TO_EVAL = . $(ROOTDIR)/config/ocamlcomp; echo $${CAMLC_BIN} -CAMLOPT_BIN_CMD_TO_EVAL = . $(ROOTDIR)/config/ocamlcomp; echo $${CAMLOPT_BIN} diff --git a/config/Makefile.msvc b/config/Makefile.msvc index f7124ec8cf..ede394c220 100644 --- a/config/Makefile.msvc +++ b/config/Makefile.msvc @@ -176,23 +176,3 @@ CANKILL=false FIND=/usr/bin/find SORT=/usr/bin/sort SET_LD_PATH=PATH="$(PATH):$(LD_PATH)" - -THIS_MAKEFILE=$(filter %config/Makefile,$(MAKEFILE_LIST)) -ifeq ($(filter /%,$(THIS_MAKEFILE)),) -ROOTDIR:=$(abspath $(dir $(CURDIR)/$(THIS_MAKEFILE))/..) -else -ROOTDIR:=$(abspath $(dir $(THIS_MAKEFILE))/..) -endif -CAMLRUN:=$(ROOTDIR)/boot/ocamlrun$(EXE) -OCAMLRUN:=$(CAMLRUN) -ROOTDIR_COMPAT:=$(shell $(CYGPATH) $(ROOTDIR)) -CAMLC_BIN_BOOT = $(CAMLRUN) $(ROOTDIR_COMPAT)/boot/ocamlc -CAMLC_BIN_BYTE = $(CAMLRUN) $(ROOTDIR_COMPAT)/ocamlc -CAMLC_BIN_OPT = $(ROOTDIR_COMPAT)/ocamlc.opt -CAMLOPT_BIN_BYTE = $(CAMLRUN) $(ROOTDIR_COMPAT)/ocamlopt -CAMLOPT_BIN_OPT = $(ROOTDIR_COMPAT)/ocamlopt.opt - -CAMLC_BIN = @ . $(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; $${CAMLC_BIN} -CAMLOPT_BIN = @ . $(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; $${CAMLOPT_BIN} -CAMLC_BIN_CMD_TO_EVAL = . $(ROOTDIR)/config/ocamlcomp; echo $${CAMLC_BIN} -CAMLOPT_BIN_CMD_TO_EVAL = . $(ROOTDIR)/config/ocamlcomp; echo $${CAMLOPT_BIN} diff --git a/config/Makefile.msvc64 b/config/Makefile.msvc64 index e3617b5778..e3f45949d7 100644 --- a/config/Makefile.msvc64 +++ b/config/Makefile.msvc64 @@ -180,23 +180,3 @@ CANKILL=false FIND=/usr/bin/find SORT=/usr/bin/sort SET_LD_PATH=PATH="$(PATH):$(LD_PATH)" - -THIS_MAKEFILE=$(filter %config/Makefile,$(MAKEFILE_LIST)) -ifeq ($(filter /%,$(THIS_MAKEFILE)),) -ROOTDIR:=$(abspath $(dir $(CURDIR)/$(THIS_MAKEFILE))/..) -else -ROOTDIR:=$(abspath $(dir $(THIS_MAKEFILE))/..) -endif -CAMLRUN:=$(ROOTDIR)/boot/ocamlrun$(EXE) -OCAMLRUN:=$(CAMLRUN) -ROOTDIR_COMPAT:=$(shell $(CYGPATH) $(ROOTDIR)) -CAMLC_BIN_BOOT = $(CAMLRUN) $(ROOTDIR_COMPAT)/boot/ocamlc -CAMLC_BIN_BYTE = $(CAMLRUN) $(ROOTDIR_COMPAT)/ocamlc -CAMLC_BIN_OPT = $(ROOTDIR_COMPAT)/ocamlc.opt -CAMLOPT_BIN_BYTE = $(CAMLRUN) $(ROOTDIR_COMPAT)/ocamlopt -CAMLOPT_BIN_OPT = $(ROOTDIR_COMPAT)/ocamlopt.opt - -CAMLC_BIN = @ . $(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; $${CAMLC_BIN} -CAMLOPT_BIN = @ . $(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; $${CAMLOPT_BIN} -CAMLC_BIN_CMD_TO_EVAL = . $(ROOTDIR)/config/ocamlcomp; echo $${CAMLC_BIN} -CAMLOPT_BIN_CMD_TO_EVAL = . $(ROOTDIR)/config/ocamlcomp; echo $${CAMLOPT_BIN} diff --git a/config/Makefile.switch-compiler b/config/Makefile.switch-compiler deleted file mode 100644 index b7cb2c7a70..0000000000 --- a/config/Makefile.switch-compiler +++ /dev/null @@ -1,22 +0,0 @@ -include Makefile - -enable disable: - @case "$@" in \ - "enable") C1="#"; C2=" ";; \ - "disable") C1=" "; C2="#";; \ - *) echo "Unknown action." 1>&2 ; exit 1;; \ - esac; \ - \ - if ! test -e "ocamlcomp"; then \ - echo ' CAMLC_BIN="$(CAMLC_BIN_BOOT)" # BOOT' >> "ocamlcomp"; \ - echo '# CAMLC_BIN="$(CAMLC_BIN_BYTE)" # BYTE' >> "ocamlcomp"; \ - echo '# CAMLC_BIN="$(CAMLC_BIN_OPT)" # OPT ' >> "ocamlcomp"; \ - echo ' CAMLOPT_BIN="no-opt-compiler-available" # NONE' >> "ocamlcomp"; \ - echo '# CAMLOPT_BIN="$(CAMLOPT_BIN_BYTE)" # BYTE' >> "ocamlcomp"; \ - echo '# CAMLOPT_BIN="$(CAMLOPT_BIN_OPT)" # OPT ' >> "ocamlcomp"; \ - fi; \ - \ - sed -e "/^$${C1} \($(COMPILER)_BIN\).*# $(VARIANT)/ s/$${C1}/$${C2}/" \ - "ocamlcomp" \ - > "ocamlcomp.tmp" ; \ - mv "ocamlcomp.tmp" "ocamlcomp" @@ -445,25 +445,26 @@ esac # "ocamlrun" executable must be available on the system. if test x"$target" != x"$host"; then if ! sh ./searchpath ocamlrun; then - err "Cross-compilation requires an ocaml runtime environment (the ocamlrun binary). Moreover, its version must be the same as the one you're trying to build (`cut -f1 -d+ < ../../VERSION`)." + err "Cross-compilation requires an ocaml runtime environment\n" \ + "(the ocamlrun binary). Moreover, its version must be the same\n" \ + "as the one you're trying to build (`cut -f1 -d+ < ../../VERSION`)." else - # Make sure the version of the system ocaml and the version of these - # sources match. Don't compare "+devXX" on purpose as it would be too - # annoying during development and people using SVN are expected to know - # what they're doing and how to handle basic issues. - ocaml_system_version=`ocamlc -version | cut -f1 -d+` + ocaml_system_version=`ocamlrun -version | sed 's/[^0-9]*\([0-9.]\+\).*/\1/'` ocaml_source_version=`sed -n '1 s/\([0-9\.]\+\).*/\1/ p' < ../../VERSION` if test x"$ocaml_system_version" != x"$ocaml_source_version"; then - err "The system OCaml toolchain is $ocaml_system_version but these sources are $ocaml_source_version.\nBuilding a cross-compiler requires versions to match." + err "While you have an ocaml runtime environment, its version\n" \ + "($ocaml_system_version) doesn't match the version of these sources\n" \ + "($ocaml_source_version)." else - camlrun="ocamlrun" + CAMLRUN="ocamlrun" fi fi else - rootdir=`cd ../.. && pwd` - camlrun=$rootdir/boot/ocamlrun + CAMLRUN=`cd ../.. && pwd`/boot/ocamlrun fi +echo "CAMLRUN=$CAMLRUN" >> Makefile + # Check the sizes of data types # OCaml needs a 32 or 64bit architectue and a 32-bit integer type. @@ -1712,29 +1713,11 @@ if [ "$ostype" = Cygwin ]; then echo "DIFF=diff -q --strip-trailing-cr" >>Makefile fi -cat >> Makefile << EOF -ROOTDIR=$rootdir -CAMLRUN=${camlrun}\$(EXE) -OCAMLRUN=\$(CAMLRUN) -CAMLC_BIN_BOOT = \$(CAMLRUN) \$(ROOTDIR)/boot/ocamlc -CAMLC_BIN_BYTE = \$(CAMLRUN) \$(ROOTDIR)/ocamlc -CAMLC_BIN_OPT = \$(ROOTDIR)/ocamlc.opt -CAMLOPT_BIN_BYTE = \$(CAMLRUN) \$(ROOTDIR)/ocamlopt -CAMLOPT_BIN_OPT = \$(ROOTDIR)/ocamlopt.opt - -CAMLC_BIN = @ . \$(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; \$\${CAMLC_BIN} -CAMLOPT_BIN = @ . \$(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; \$\${CAMLOPT_BIN} -CAMLC_BIN_CMD_TO_EVAL = . \$(ROOTDIR)/config/ocamlcomp; echo \$\${CAMLC_BIN} -CAMLOPT_BIN_CMD_TO_EVAL = . \$(ROOTDIR)/config/ocamlcomp; echo \$\${CAMLOPT_BIN} -EOF rm -f tst hasgot.c rm -f ../m.h ../s.h ../Makefile mv m.h s.h Makefile .. -rm -f ../ocamlcomp -cd .. && make -f Makefile.switch-compiler disable COMPILER="CAMLC" VARIANT="BYTE" - # Print a summary inf diff --git a/debugger/Makefile.shared b/debugger/Makefile.shared index 815ab3258b..d85419eb0c 100644 --- a/debugger/Makefile.shared +++ b/debugger/Makefile.shared @@ -12,9 +12,9 @@ include ../config/Makefile -CAMLC=$(CAMLC_BIN) -nostdlib -I ../stdlib -COMPFLAGS=-g -warn-error A $(INCLUDES) -LINKFLAGS=-g -linkall -I $(UNIXDIR) +CAMLC=../ocamlcomp.sh +COMPFLAGS=-warn-error A $(INCLUDES) +LINKFLAGS=-linkall -I $(UNIXDIR) CAMLYACC=../boot/ocamlyacc YACCFLAGS= CAMLLEX=../boot/ocamlrun ../boot/ocamllex diff --git a/driver/ocamlcomp.sh.in b/driver/ocamlcomp.sh.in new file mode 100644 index 0000000000..fc0a8e113f --- /dev/null +++ b/driver/ocamlcomp.sh.in @@ -0,0 +1,17 @@ +#!/bin/sh + +######################################################################### +# # +# OCaml # +# # +# Jacques Garrigue, Kyoto University RIMS # +# # +# Copyright 2002 Institut National de Recherche en Informatique et # +# en Automatique. All rights reserved. This file is distributed # +# under the terms of the Q Public License version 1.0. # +# # +######################################################################### + +topdir=`dirname $0` + +exec @compiler@ -nostdlib -I $topdir/stdlib "$@" diff --git a/lex/Makefile b/lex/Makefile index 6da5f0c576..debad6e619 100644 --- a/lex/Makefile +++ b/lex/Makefile @@ -11,9 +11,6 @@ ######################################################################### # The lexer generator - -include ../config/Makefile - CAMLC=../boot/ocamlrun ../boot/ocamlc -strict-sequence -nostdlib -I ../boot CAMLOPT=../boot/ocamlrun ../ocamlopt -nostdlib -I ../stdlib COMPFLAGS=-w +33..39 -warn-error A diff --git a/myocamlbuild.ml b/myocamlbuild.ml index 7d08b07e54..0bf0e476d7 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -122,35 +122,27 @@ let systhreads_obj f = "otherlibs/systhreads"/f-.-C.o let systhreads_lib f = "otherlibs/systhreads"/f-.-C.a let systhreads_dll f = "otherlibs/systhreads"/f-.-C.so -let test_nt native byte = - (Ocamlbuild_pack.My_std.sys_command (sprintf "test '%s' -nt '%s'" native byte)) = 0 - let ocamlc_solver = - let common_deps = [ "../stdlib/stdlib.cma"; "../stdlib/std_exit.cmo"] in - let byte = "../ocamlc" in - let native = byte ^ ".opt" in + let native_deps = ["ocamlc.opt"; "stdlib/stdlib.cmxa"; + "stdlib/std_exit.cmx"; "stdlib/std_exit"-.-C.o] in + let byte_deps = ["ocamlc"; "stdlib/stdlib.cma"; "stdlib/std_exit.cmo"] in fun () -> - if List.for_all Pathname.exists (byte :: common_deps) then ( - if Pathname.exists native && test_nt native byte then - S[A native; A"-I"; A"../stdlib"; A"-nostdlib"] - else - S[ocamlrun; A byte; A"-I"; A"../stdlib"; A"-nostdlib"] - ) + if Pathname.exists "../ocamlcomp.sh" then S[A"../ocamlcomp.sh"] else + if List.for_all Pathname.exists native_deps then + S[A"./ocamlc.opt"; A"-nostdlib"] + else if List.for_all Pathname.exists byte_deps then + S[ocamlrun; A"./ocamlc"; A"-nostdlib"] else boot_ocamlc;; Command.setup_virtual_command_solver "OCAMLC" ocamlc_solver;; Command.setup_virtual_command_solver "OCAMLCWIN" (convert_for_windows_shell ocamlc_solver);; let ocamlopt_solver () = - let byte = "../ocamlopt" in - let native = byte ^ ".opt" in - if List.for_all Pathname.exists [ byte; "../stdlib/stdlib.cmxa" ] then - if Pathname.exists native && test_nt native byte then - S[A native ; A"-I"; A"../stdlib"; A"-nostdlib"] - else - S[ocamlrun; A byte; A"-I"; A"../stdlib"; A"-nostdlib"] - else - failwith "Native compiler is not available.";; + S[if Pathname.exists "../ocamlcompopt.sh" then S[A"../ocamlcompopt.sh"] else + if Pathname.exists "ocamlopt.opt" && Pathname.exists ("stdlib/stdlib.cmxa") + then A"./ocamlopt.opt" + else S[ocamlrun; A"./ocamlopt"]; + A"-nostdlib"];; Command.setup_virtual_command_solver "OCAMLOPT" ocamlopt_solver;; Command.setup_virtual_command_solver "OCAMLOPTWIN" (convert_for_windows_shell ocamlopt_solver);; diff --git a/ocamlbuild/Makefile.noboot b/ocamlbuild/Makefile.noboot index 2543c585e1..0679e0ccd7 100644 --- a/ocamlbuild/Makefile.noboot +++ b/ocamlbuild/Makefile.noboot @@ -17,8 +17,9 @@ include ../config/Makefile # Various commands and dir ########################## -OCAMLC = $(CAMLC_BIN) -nostdlib -I ../stdlib -OCAMLOPT = $(CAMLOPT_BIN) -nostdlib -I ../stdlib +CAMLRUN = ../boot/ocamlrun +OCAMLC = ../ocamlcomp.sh +OCAMLOPT = ../ocamlcompopt.sh OCAMLDEP = $(CAMLRUN) ../tools/ocamldep OCAMLLEX = $(CAMLRUN) ../boot/ocamllex OCAMLLIB = $(LIBDIR) diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile index 36fbd82de9..6de33180de 100644 --- a/ocamldoc/Makefile +++ b/ocamldoc/Makefile @@ -14,8 +14,9 @@ include ../config/Makefile # Various commands and dir ########################## -OCAMLC = $(CAMLC_BIN) -nostdlib -I ../stdlib -OCAMLOPT = $(CAMLOPT_BIN) -nostdlib -I ../stdlib +CAMLRUN=../boot/ocamlrun +OCAMLC = ../ocamlcomp.sh +OCAMLOPT = ../ocamlcompopt.sh OCAMLDEP = $(CAMLRUN) ../tools/ocamldep OCAMLLEX = $(CAMLRUN) ../boot/ocamllex OCAMLYACC= ../boot/ocamlyacc diff --git a/ocamldoc/Makefile.nt b/ocamldoc/Makefile.nt index 328a37489c..ff4b3fdc24 100644 --- a/ocamldoc/Makefile.nt +++ b/ocamldoc/Makefile.nt @@ -14,8 +14,9 @@ include ../config/Makefile # Various commands and dir ########################## -OCAMLC = $(CAMLC_BIN) -nostdlib -I ../stdlib -OCAMLOPT = $(CAMLOPT_BIN) -nostdlib -I ../stdlib +CAMLRUN=../boot/ocamlrun +OCAMLC = ../ocamlcomp.sh +OCAMLOPT = ../ocamlcompopt.sh OCAMLDEP = $(CAMLRUN) ../tools/ocamldep OCAMLLEX = $(CAMLRUN) ../boot/ocamllex OCAMLYACC= ../boot/ocamlyacc diff --git a/otherlibs/Makefile b/otherlibs/Makefile index 274b9583ad..6c3e58aa65 100644 --- a/otherlibs/Makefile +++ b/otherlibs/Makefile @@ -13,11 +13,9 @@ # Common Makefile for otherlibs on the Unix ports -CAMLC=$(CAMLC_BIN) -nostdlib -I ../../stdlib -CAMLOPT=$(CAMLOPT_BIN) -nostdlib -I ../../stdlib -CAMLC_BIN_CMD=$$($(CAMLC_BIN_CMD_TO_EVAL) -nostdlib -I ../../stdlib) -CAMLOPT_BIN_CMD=$$($(CAMLOPT_BIN_CMD_TO_EVAL) -nostdlib -I ../../stdlib) -CFLAGS=-I../../byterun -O $(SHAREDCCCOMPOPTS) $(EXTRACFLAGS) +CAMLC=$(ROOTDIR)/ocamlcomp.sh +CAMLOPT=$(ROOTDIR)/ocamlcompopt.sh +CFLAGS=-I$(ROOTDIR)/byterun -O $(SHAREDCCCOMPOPTS) $(EXTRACFLAGS) include ../Makefile.shared # Note .. is the current directory (this makefile is included from diff --git a/otherlibs/Makefile.nt b/otherlibs/Makefile.nt index f3e7f200da..aafb4217cb 100644 --- a/otherlibs/Makefile.nt +++ b/otherlibs/Makefile.nt @@ -13,11 +13,9 @@ # Common Makefile for otherlibs on the Win32/MinGW ports -CAMLC=$(CAMLC_BIN) -nostdlib -I ../../stdlib -w s -CAMLOPT=$(CAMLOPT_BIN) -nostdlib -I ../../stdlib -w s -CAMLC_BIN_CMD=$(shell cygpath -m $(shell $(CAMLC_BIN_CMD_TO_EVAL))) -nostdlib -I ../../stdlib -CAMLOPT_BIN_CMD=$(shell cygpath -m $(shell $(CAMLOPT_BIN_CMD_TO_EVAL))) -nostdlib -I ../../stdlib -CFLAGS=-I../../byterun $(SHAREDCCCOMPOPTS) $(EXTRACFLAGS) +CAMLC=$(CAMLRUN) $(ROOTDIR)/ocamlc -nostdlib -I $(ROOTDIR)/stdlib -w s +CAMLOPT=$(CAMLRUN) $(ROOTDIR)/ocamlopt -nostdlib -I $(ROOTDIR)/stdlib -w s +CFLAGS=-I$(ROOTDIR)/byterun $(SHAREDCCCOMPOPTS) $(EXTRACFLAGS) include ../Makefile.shared # Note .. is the current directory (this makefile is included from diff --git a/otherlibs/Makefile.shared b/otherlibs/Makefile.shared index 1163f9e6c2..4e8092f9ba 100644 --- a/otherlibs/Makefile.shared +++ b/otherlibs/Makefile.shared @@ -13,12 +13,14 @@ # Common Makefile for otherlibs -include ../../config/Makefile +ROOTDIR=../.. +include $(ROOTDIR)/config/Makefile # Compilation options CC=$(BYTECC) +CAMLRUN=$(ROOTDIR)/boot/ocamlrun COMPFLAGS=-w +33..39 -warn-error A -g $(EXTRACAMLFLAGS) -MKLIB=$(CAMLRUN) ../../tools/ocamlmklib +MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib # Variables to be defined by individual libraries: #LIBNAME= @@ -41,12 +43,12 @@ all: lib$(CLIBNAME).$(A) $(LIBNAME).cma $(CMIFILES) allopt: lib$(CLIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).$(CMXS) $(CMIFILES) $(LIBNAME).cma: $(CAMLOBJS) - $(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlc "$(CAMLC_BIN_CMD)" \ - -linkall $(CAMLOBJS) $(LINKOPTS) + $(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlc '$(CAMLC)' -linkall \ + $(CAMLOBJS) $(LINKOPTS) $(LIBNAME).cmxa: $(CAMLOBJS_NAT) - $(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlopt "$(CAMLOPT_BIN_CMD)" \ - -linkall $(CAMLOBJS_NAT) $(LINKOPTS) + $(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlopt '$(CAMLOPT)' -linkall \ + $(CAMLOBJS_NAT) $(LINKOPTS) $(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A) $(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa diff --git a/otherlibs/dynlink/Makefile b/otherlibs/dynlink/Makefile index ab03704903..cb55c50cf5 100644 --- a/otherlibs/dynlink/Makefile +++ b/otherlibs/dynlink/Makefile @@ -15,10 +15,10 @@ include ../../config/Makefile -CAMLC=$(CAMLC_BIN) -nostdlib -I ../../stdlib -CAMLOPT=$(CAMLOPT_BIN) -nostdlib -I ../../stdlib +CAMLC=../../boot/ocamlrun ../../ocamlc +CAMLOPT=../../ocamlcompopt.sh INCLUDES=-I ../../utils -I ../../typing -I ../../bytecomp -I ../../asmcomp -COMPFLAGS=-w +33..39 -warn-error A $(INCLUDES) +COMPFLAGS=-w +33..39 -warn-error A -I ../../stdlib $(INCLUDES) OBJS=dynlinkaux.cmo dynlink.cmo diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile index 138d056946..d6b8686bcb 100644 --- a/otherlibs/systhreads/Makefile +++ b/otherlibs/systhreads/Makefile @@ -13,11 +13,10 @@ include ../../config/Makefile -CAMLC=$(CAMLC_BIN) -nostdlib -I ../../stdlib -I ../unix -CAMLOPT=$(CAMLOPT_BIN) -nostdlib -I ../../stdlib -I ../unix +CAMLC=../../ocamlcomp.sh -I ../unix +CAMLOPT=../../ocamlcompopt.sh -I ../unix MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib COMPFLAGS=-w +33..39 -warn-error A -g -CAMLC_BIN_CMD=$(CAMLC_BIN_CMD_TO_EVAL) -nostdlib -I ../../stdlib BYTECODE_C_OBJS=st_stubs_b.o NATIVECODE_C_OBJS=st_stubs_n.o @@ -48,7 +47,7 @@ st_stubs_n.o: st_stubs.c st_posix.h mv st_stubs.o st_stubs_n.o threads.cma: $(THREAD_OBJS) - $(MKLIB) -ocamlc "$$($(CAMLC_BIN_CMD))" -o threads $(THREAD_OBJS) \ + $(MKLIB) -ocamlc '$(CAMLC)' -o threads $(THREAD_OBJS) \ -cclib -lunix $(PTHREAD_LINK) # See remark above: force static linking of libthreadsnat.a diff --git a/otherlibs/systhreads/Makefile.nt b/otherlibs/systhreads/Makefile.nt index 2d86f84c0f..225146cced 100644 --- a/otherlibs/systhreads/Makefile.nt +++ b/otherlibs/systhreads/Makefile.nt @@ -14,10 +14,9 @@ include ../../config/Makefile # Compilation options -CAMLC=$(CAMLC_BIN) -nostdlib -I ../../stdlib -I ../win32unix -CAMLOPT=$(CAMLOPT_BIN) -nostdlib -I ../../stdlib -I ../win32unix +CAMLC=../../boot/ocamlrun ../../ocamlc -I ../../stdlib -I ../win32unix +CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib -I ../win32unix COMPFLAGS=-w +33 -warn-error A -g -CAMLC_BIN_CMD=$(CAMLC_BIN_CMD_TO_EVAL) -nostdlib -I ../../stdlib MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib CFLAGS=-I../../byterun $(EXTRACFLAGS) diff --git a/otherlibs/threads/Makefile b/otherlibs/threads/Makefile index 359f2d4298..311373bbbb 100644 --- a/otherlibs/threads/Makefile +++ b/otherlibs/threads/Makefile @@ -15,10 +15,9 @@ include ../../config/Makefile CC=$(BYTECC) CFLAGS=-I../../byterun -O $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS) -g -CAMLC=$(CAMLC_BIN) -nostdlib -I ../../stdlib -I ../unix +CAMLC=../../ocamlcomp.sh -I ../unix MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib COMPFLAGS=-w +33..39 -warn-error A -CAMLC_BIN_CMD=$(CAMLC_BIN_CMD_TO_EVAL) -nostdlib -I ../../stdlib C_OBJS=scheduler.o @@ -54,13 +53,13 @@ libvmthreads.a: $(C_OBJS) $(MKLIB) -o threads -oc vmthreads $(C_OBJS) threads.cma: $(CAML_OBJS) - $(MKLIB) -ocamlc "$$($(CAMLC_BIN_CMD))" -o threads -oc vmthreads $(CAML_OBJS) + $(MKLIB) -ocamlc '$(CAMLC)' -o threads -oc vmthreads $(CAML_OBJS) stdlib.cma: $(LIB_OBJS) $(CAMLC) -a -o stdlib.cma $(LIB_OBJS) unix.cma: $(UNIXLIB_OBJS) - $(MKLIB) -ocamlc "$$($(CAMLC_BIN_CMD))" -o unix -linkall $(UNIXLIB_OBJS) + $(MKLIB) -ocamlc '$(CAMLC)' -o unix -linkall $(UNIXLIB_OBJS) pervasives.cmo: pervasives.mli pervasives.cmi pervasives.ml $(CAMLC) ${COMPFLAGS} -nopervasives -c pervasives.ml @@ -117,7 +116,6 @@ installopt: $(CAMLC) -c $(COMPFLAGS) $< .ml.cmx: - exit 1 $(CAMLOPT) -c $(COMPFLAGS) $< depend: diff --git a/stdlib/Makefile.shared b/stdlib/Makefile.shared index bb2ef88fda..e9d5940a91 100755 --- a/stdlib/Makefile.shared +++ b/stdlib/Makefile.shared @@ -12,9 +12,12 @@ ######################################################################### include ../config/Makefile -CAMLC=$(CAMLC_BIN) +RUNTIME=../boot/ocamlrun +COMPILER=../ocamlc +CAMLC=$(RUNTIME) $(COMPILER) COMPFLAGS=-strict-sequence -w +33..39 -g -warn-error A -nostdlib -CAMLOPT=$(CAMLOPT_BIN) +OPTCOMPILER=../ocamlopt +CAMLOPT=$(RUNTIME) $(OPTCOMPILER) OPTCOMPFLAGS=-warn-error A -nostdlib -g CAMLDEP=../boot/ocamlrun ../tools/ocamldep @@ -75,6 +78,12 @@ clean:: .ml.p.cmx: $(CAMLOPT) $(OPTCOMPFLAGS) `./Compflags $@` -p -c -o $*.p.cmx $< +# Dependencies on the compiler +$(OBJS) std_exit.cmo: $(COMPILER) +$(OBJS:.cmo=.cmi) std_exit.cmi: $(COMPILER) +$(OBJS:.cmo=.cmx) std_exit.cmx: $(OPTCOMPILER) +$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: $(OPTCOMPILER) + # Dependencies on Pervasives (not tracked by ocamldep) $(OBJS) std_exit.cmo: pervasives.cmi $(OTHERS:.cmo=.cmi) std_exit.cmi: pervasives.cmi diff --git a/testsuite/makefiles/Makefile.common b/testsuite/makefiles/Makefile.common index 20af7ea4b9..54a0811db7 100644 --- a/testsuite/makefiles/Makefile.common +++ b/testsuite/makefiles/Makefile.common @@ -43,13 +43,15 @@ SET_LD_PATH=CAML_LD_LIBRARY_PATH="$(LD_PATH)" include $(TOPDIR)/config/Makefile +OCAMLRUN=$(TOPDIR)/boot/ocamlrun$(EXE) + OCFLAGS=-nostdlib -I $(OTOPDIR)/stdlib $(COMPFLAGS) OCOPTFLAGS= OCAML=$(OCAMLRUN) $(OTOPDIR)/ocaml $(OCFLAGS) \ -init $(OTOPDIR)/testsuite/lib/empty -OCAMLC=$$($(CAMLC_BIN_CMD_TO_EVAL)) $(OCFLAGS) -OCAMLOPT=$$($(CAMLOPT_BIN_CMD_TO_EVAL)) $(OCFLAGS) $(OCOPTFLAGS) +OCAMLC=$(OCAMLRUN) $(OTOPDIR)/ocamlc $(OCFLAGS) +OCAMLOPT=$(OCAMLRUN) $(OTOPDIR)/ocamlopt $(OCFLAGS) OCAMLDOC=$(OCAMLRUN) $(OTOPDIR)/ocamldoc/ocamldoc OCAMLLEX=$(OCAMLRUN) $(OTOPDIR)/lex/ocamllex OCAMLMKLIB=$(OCAMLRUN) $(OTOPDIR)/tools/ocamlmklib \ @@ -84,23 +86,23 @@ defaultclean: .SUFFIXES: .mli .ml .mly .mll .cmi .cmo .cmx .cmm .cmxa .s .S .o .so .c .f .mli.cmi: - $(OCAMLC) -c $(ADD_COMPFLAGS) $< + @$(OCAMLC) -c $(ADD_COMPFLAGS) $< .ml.cmi: - $(OCAMLC) -c $(ADD_COMPFLAGS) $< + @$(OCAMLC) -c $(ADD_COMPFLAGS) $< .ml.cmo: @if [ -f $<i ]; then $(OCAMLC) -c $(ADD_COMPFLAGS) $<i; fi - $(OCAMLC) -c $(ADD_COMPFLAGS) $< + @$(OCAMLC) -c $(ADD_COMPFLAGS) $< .ml.cmx: - $(OCAMLOPT) -c $(ADD_COMPFLAGS) $< + @$(OCAMLOPT) -c $(ADD_COMPFLAGS) $< .cmx.so: - $(OCAMLOPT) -o $@ -shared $(ADD_COMPFLAGS) $< + @$(OCAMLOPT) -o $@ -shared $(ADD_COMPFLAGS) $< .cmxa.so: - $(OCAMLOPT) -o $@ -shared -linkall $(ADD_COMPFLAGS) $< + @$(OCAMLOPT) -o $@ -shared -linkall $(ADD_COMPFLAGS) $< .mly.ml: @$(OCAMLYACC) -q $< 2> /dev/null diff --git a/testsuite/makefiles/Makefile.several b/testsuite/makefiles/Makefile.several index d3cf3b1e59..d4a5caac34 100644 --- a/testsuite/makefiles/Makefile.several +++ b/testsuite/makefiles/Makefile.several @@ -44,7 +44,7 @@ run-all: CANKILL=$(CANKILL) sh `basename $$file ml`precheck || continue; \ fi; \ printf " ... testing '$$file':"; \ - $(MAKE) run-file DESC=ocamlc COMP="$(OCAMLC)" \ + $(MAKE) run-file DESC=ocamlc COMP='$(OCAMLC)' \ RUNTIME='$(MYRUNTIME)' \ COMPFLAGS='-w a $(ADD_COMPFLAGS) $(ADD_CFLAGS) $(O_FILES) \ $(CMA_FILES) -I $(OTOPDIR)/testsuite/lib \ @@ -52,7 +52,7 @@ run-all: FILE=$$file PROGRAM_ARGS=$(PROGRAM_ARGS) \ && \ if $(BYTECODE_ONLY); then : ; else \ - $(MAKE) run-file DESC=ocamlopt COMP="$(OCAMLOPT)" \ + $(MAKE) run-file DESC=ocamlopt COMP='$(OCAMLOPT)' \ RUNTIME= \ COMPFLAGS='-w a $(ADD_COMPFLAGS) $(ADD_OPTFLAGS) \ $(O_FILES) $(CMXA_FILES) \ @@ -61,7 +61,7 @@ run-all: fi \ && \ if [ -n "$(UNSAFE)" ]; then \ - $(MAKE) run-file DESC=ocamlc-unsafe COMP="$(OCAMLC)" \ + $(MAKE) run-file DESC=ocamlc-unsafe COMP='$(OCAMLC)' \ RUNTIME='$(MYRUNTIME)' \ COMPFLAGS='-w a -unsafe $(ADD_COMPFLAGS) $(ADD_CFLAGS) \ $(O_FILES) $(CMA_FILES) \ @@ -69,7 +69,7 @@ run-all: FILE=$$file \ && \ if $(BYTECODE_ONLY); then : ; else \ - $(MAKE) run-file DESC=ocamlopt-unsafe COMP="$(OCAMLOPT)" \ + $(MAKE) run-file DESC=ocamlopt-unsafe COMP='$(OCAMLOPT)' \ RUNTIME= \ COMPFLAGS='-w a -unsafe $(ADD_COMPFLAGS) $(ADD_OPTFLAGS)\ $(O_FILES) $(CMXA_FILES) \ diff --git a/tools/Makefile.shared b/tools/Makefile.shared index 28ecac8288..84b6741226 100644 --- a/tools/Makefile.shared +++ b/tools/Makefile.shared @@ -12,12 +12,13 @@ include ../config/Makefile -CAMLC=../boot/ocamlrun ../boot/ocamlc -strict-sequence -nostdlib -I ../boot -CAMLOPT=../boot/ocamlrun ../ocamlopt -nostdlib -I ../stdlib +CAMLRUN=../boot/ocamlrun +CAMLC=$(CAMLRUN) ../boot/ocamlc -strict-sequence -nostdlib -I ../boot +CAMLOPT=$(CAMLRUN) ../ocamlopt -nostdlib -I ../stdlib CAMLLEX=$(CAMLRUN) ../boot/ocamllex INCLUDES=-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp \ -I ../driver -I ../toplevel -COMPFLAGS= -w +33..39 -warn-error A $(INCLUDES) +COMPFLAGS= -w +32..39 -warn-error A $(INCLUDES) LINKFLAGS=$(INCLUDES) all: ocamldep ocamlprof ocamlcp ocamloptp ocamlmktop ocamlmklib dumpobj \ @@ -100,8 +101,8 @@ ocamlmklib.cmo: myocamlbuild_config.cmi myocamlbuild_config.cmi: myocamlbuild_config.cmo -myocamlbuild_config.ml: ../config/Makefile ../build/mk_shell_and_ocamlbuild_config.sh - ../build/mk_shell_and_ocamlbuild_config.sh +myocamlbuild_config.ml: ../config/Makefile ../build/mkmyocamlbuild_config.sh + ../build/mkmyocamlbuild_config.sh cp ../myocamlbuild_config.ml . install:: |
