Skip to content

Commit

Permalink
Some changes to the build system
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7829 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
ertai committed Feb 7, 2007
1 parent 2049a98 commit 2a85980
Show file tree
Hide file tree
Showing 13 changed files with 212 additions and 88 deletions.
9 changes: 9 additions & 0 deletions INSTALL
Expand Up @@ -185,6 +185,11 @@ An alternative, and faster approach to steps 2 to 5 is
The result is equivalent to "make world opt opt.opt", but this may
fail if anything goes wrong in native-code generation.

Another alternative, is to use the experimental build system that use
ocamlbuild instead of make (it replaces steps 2 to 5):

./build/fastworld.sh

6- You can now install the Objective Caml system. This will create the
following commands (in the binary directory selected during
autoconfiguration):
Expand Down Expand Up @@ -214,6 +219,10 @@ From the top directory, become superuser and do:
umask 022 # make sure to give read & execute permission to all
make install

In the ocamlbuild setting instead of make install do:

./build/install.sh

7- Installation is complete. Time to clean up. From the toplevel
directory, do "make clean".

Expand Down
40 changes: 20 additions & 20 deletions Makefile
Expand Up @@ -124,7 +124,7 @@ defaultentry:

# Recompile the system using the bootstrap compiler
all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml \
otherlibraries camlp4out $(DEBUGGER) ocamldoc
otherlibraries ocamlbuild.byte camlp4out $(DEBUGGER) ocamldoc

# The compilation of ocaml will fail if the runtime has changed.
# Never mind, just do make bootstrap to reach fixpoint again.
Expand Down Expand Up @@ -228,8 +228,8 @@ opt: runtimeopt ocamlopt libraryopt otherlibrariesopt

# Native-code versions of the tools
opt.opt: checkstack runtime core ocaml opt-core ocamlc.opt otherlibraries \
camlp4out $(DEBUGGER) ocamldoc ocamlopt.opt otherlibrariesopt \
ocamllex.opt ocamltoolsopt.opt camlp4opt ocamldoc.opt
ocamlbuild.byte camlp4out $(DEBUGGER) ocamldoc ocamlopt.opt otherlibrariesopt \
ocamllex.opt ocamltoolsopt.opt ocamlbuild.native camlp4opt ocamldoc.opt

# Installation
install: FORCE
Expand Down Expand Up @@ -258,10 +258,10 @@ install: FORCE
done
cd ocamldoc; $(MAKE) install
if test -f ocamlopt; then $(MAKE) installopt; else :; fi
cd camlp4; $(MAKE) install
if test -f debugger/ocamldebug; then (cd debugger; $(MAKE) install); \
else :; fi
cp config/Makefile $(LIBDIR)/Makefile.config
./build/partial-install.sh

# Installation of the native-code compiler
installopt:
Expand Down Expand Up @@ -605,25 +605,25 @@ alldepend::

# Camlp4

camlp4/build/camlp4_config.ml: config/Makefile utils/config.ml
(echo 'let prefix = "$(PREFIX)"'; \
echo 'let bindir = "$(BINDIR)"'; \
echo 'let mandir = "$(MANDIR)"'; \
echo 'let libdir = "$(LIBDIR)"'; \
grep ast utils/config.ml) > camlp4/build/camlp4_config.ml

camlp4out: ocamlc otherlibraries ocamlbuild-partial-boot ocamlbuild.byte
./build/camlp4-byte-only.sh
camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-partial-boot ocamlbuild.native
./build/camlp4-native-only.sh
partialclean::
rm -f camlp4/build/camlp4_config.ml
beforedepend:: camlp4/build/camlp4_config.ml
rm -rf _build/camlp4

# Ocamlbuild

camlp4out: ocamlc camlp4/build/camlp4_config.ml
cd camlp4; $(MAKE) all
camlp4opt: ocamlopt
cd camlp4; $(MAKE) opt
ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-partial-boot
./build/ocamlbuild-byte-only.sh
ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
./build/ocamlbuild-native-only.sh
partialclean::
cd camlp4; $(MAKE) clean
alldepend::
cd camlp4; $(MAKE) depend
rm -rf _build/ocamlbuild

.PHONY: ocamlbuild-partial-boot
ocamlbuild-partial-boot:
./build/partial-boot.sh

# Check that the stack limit is reasonable.

Expand Down
38 changes: 19 additions & 19 deletions Makefile.nt
Expand Up @@ -114,7 +114,7 @@ defaultentry:
@echo "Please refer to the installation instructions in file README.win32."

# Recompile the system using the bootstrap compiler
all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml otherlibraries ocamldoc.byte camlp4out win32gui
all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml otherlibraries ocamldoc.byte ocamlbuild.byte camlp4out win32gui

# The compilation of ocaml will fail if the runtime has changed.
# Never mind, just do make bootstrap to reach fixpoint again.
Expand Down Expand Up @@ -202,7 +202,7 @@ opt: runtimeopt ocamlopt libraryopt otherlibrariesopt

# Native-code versions of the tools
opt.opt: ocamlc.opt ocamlopt.opt ocamllex.opt ocamltoolsopt.opt \
camlp4opt ocamldoc.opt
ocamlbuild.native camlp4opt ocamldoc.opt

# Installation
install: installbyt installopt
Expand All @@ -228,7 +228,7 @@ installbyt:
mkdir -p $(STUBLIBDIR)
for i in $(OTHERLIBRARIES); do $(MAKEREC) -C otherlibs/$$i install; done
cd win32caml ; $(MAKE) install
cd camlp4 ; make install
./build/partial-install.sh
cp config/Makefile $(LIBDIR)/Makefile.config
cp README $(DISTRIB)/Readme.general.txt
cp README.win32 $(DISTRIB)/Readme.windows.txt
Expand Down Expand Up @@ -564,25 +564,25 @@ alldepend::

# Camlp4

camlp4/build/camlp4_config.ml: config/Makefile utils/config.ml
(echo 'let prefix = "$(PREFIX)"'; \
echo 'and bindir = "$(BINDIR)"'; \
echo 'and mandir = "$(MANDIR)"'; \
echo 'and libdir = "$(LIBDIR)"'; \
grep 'ast.*magic_number' utils/config.ml) > camlp4/build/camlp4_config.ml

camlp4out: ocamlc otherlibraries ocamlbuild-partial-boot ocamlbuild.byte
./build/camlp4-byte-only.sh
camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-partial-boot ocamlbuild.native
./build/camlp4-native-only.sh
partialclean::
rm -f camlp4/build/camlp4_config.ml
beforedepend:: camlp4/build/camlp4_config.ml
rm -rf _build/camlp4

# Ocamlbuild

camlp4out: ocamlc camlp4/build/camlp4_config.ml
cd camlp4; $(MAKE) all
camlp4opt: ocamlopt
cd camlp4; $(MAKE) opt
ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-partial-boot
./build/ocamlbuild-byte-only.sh
ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
./build/ocamlbuild-native-only.sh
partialclean::
cd camlp4; $(MAKE) clean
alldepend::
cd camlp4; $(MAKE) depend
rm -rf _build/ocamlbuild

.PHONY: ocamlbuild-partial-boot
ocamlbuild-partial-boot:
./build/partial-boot.sh

# The Win32 toplevel GUI

Expand Down
6 changes: 5 additions & 1 deletion README.win32
Expand Up @@ -124,14 +124,18 @@ Normally, the only variables that need to be changed are
PREFIX where to install everything
TK_ROOT where TCL/TK was installed

Finally, use "make -f Makefile.nt" to build the system, e.g.
Finally, use "make -f Makefile.nt" to build the system, e.g.

make -f Makefile.nt world
make -f Makefile.nt bootstrap
make -f Makefile.nt opt
make -f Makefile.nt opt.opt
make -f Makefile.nt install

Alternatively you can use the experimental build procdure using ocamlbuild:

./build/fastworld.sh
./build/install.sh

NOTES:

Expand Down
32 changes: 32 additions & 0 deletions config/Makefile.mingw
Expand Up @@ -41,6 +41,33 @@ S=s
SO=s.o
DO=d.o
EXE=.exe
EXT_DLL=.dll
EXT_OBJ=.$(O)
EXT_LIB=.$(A)
EXT_ASM=.$(S)
MANEXT=1
SHARPBANGSCRIPTS=false
PTHREAD_LINK=
X11_INCLUDES=
X11_LINK=
DBM_INCLUDES=
DBM_LINK=
BYTECCRPATH=
SUPPORTS_SHARED_LIBRARIES=true
SHAREDCCCOMPOPTS=
MKSHAREDLIBRPATH=
NATIVECCPROFOPTS=
NATIVECCRPATH=
ASFLAGS=
ASPP=
ASPPFLAGS=
ASPPPROFFLAGS=
PROFILING=noprof
DYNLINKOPTS=
DEBUGGER=
CC_PROFILE=
SYSTHREAD_SUPPORT=true
EXTRALIBS=

########## Configuration for the bytecode compiler

Expand All @@ -65,17 +92,22 @@ CPP=$(BYTECC) -E

### How to build an EXE
MKEXE=$(BYTECC) -o $(1) $(2)
#ml let mkexe out files opts = Printf.sprintf "%s -o %s %s %s" bytecc out opts files;;

### How to build a DLL
MKDLL=$(BYTECC) -shared -o $(1) -Wl,--out-implib,$(2) $(3)
#ml let mkdll out implib files opts = Printf.sprintf "%s -shared -o %s -Wl,--out-implib,%s %s %s" bytecc out implib files opts;;

### How to build a static library
MKLIB=rm -f $(1); ar rcs $(1) $(2)
#ml let mklib out files opts = Printf.sprintf "rm -f %s && ar rcs %s %s %s" out opts out files;;

### Canonicalize the name of a system library
SYSLIB=-l$(1)
#ml let syslib x = "-l"^x;;

### The ranlib command
RANLIB=ranlib
RANLIBCMD=ranlib

############# Configuration for the native-code compiler
Expand Down
38 changes: 34 additions & 4 deletions config/Makefile.msvc
Expand Up @@ -41,6 +41,32 @@ S=asm
SO=s.obj
DO=d.obj
EXE=.exe
EXT_DLL=.dll
EXT_OBJ=.$(O)
EXT_LIB=.$(A)
EXT_ASM=.$(S)
MANEXT=1
SHARPBANGSCRIPTS=false
PTHREAD_LINK=
X11_INCLUDES=
X11_LINK=
DBM_INCLUDES=
DBM_LINK=
BYTECCRPATH=
SUPPORTS_SHARED_LIBRARIES=true
SHAREDCCCOMPOPTS=
NATIVECCPROFOPTS=
NATIVECCRPATH=
ASFLAGS=
ASPP=
ASPPFLAGS=
ASPPPROFFLAGS=
PROFILING=noprof
DYNLINKOPTS=
DEBUGGER=
CC_PROFILE=
SYSTHREAD_SUPPORT=true
EXTRALIBS=

########## Configuration for the bytecode compiler

Expand All @@ -64,24 +90,28 @@ NATIVECCLIBS=advapi32.lib
CPP=cl /nologo /EP

### How to merge a .manifest (if any) in a .exe or .dll
MERGEMANIFEST=\
test ! -f $(1).manifest || \
mt -nologo -outputresource:$(1) -manifest $(1).manifest && \
rm -f $(1).manifest
MERGEMANIFEST=test ! -f $(1).manifest || mt -nologo -outputresource:$(1) -manifest $(1).manifest && rm -f $(1).manifest
#ml let mergemanifest out = Printf.sprintf "test ! -f %s.manifest || mt -nologo -outputresource:%s -manifest %s.manifest && rm -f %s.manifest" out out out out;;

### How to build an EXE
MKEXE=$(BYTECC) /Fe$(1) $(2) && ($(MERGEMANIFEST))
#ml let mkexe out files opts = Printf.sprintf "%s /Fe%s %s %s && (%s)" bytecc out opts files (mergemanifest out);;

### How to build a DLL
MKDLL=link /nologo /dll /out:$(1) /implib:$(2) $(3) && ($(MERGEMANIFEST))
#ml let mkdll out implib files opts = Printf.sprintf "link /nologo /dll /out:%s /implib:%s %s %s && (%s)" out implib opts files (mergemanifest out);;

### How to build a static library
MKLIB=link /lib /nologo /out:$(1) $(2)
#ml let mklib out files opts = Printf.sprintf "link /lib /nologo /out:%s %s %s" out opts files;;
MKSHAREDLIBRPATH=

### Canonicalize the name of a system library
SYSLIB=$(1).lib
#ml let syslib x = x ^ ".lib";;

### The ranlib command
RANLIB=
RANLIBCMD=

############# Configuration for the native-code compiler
Expand Down
25 changes: 25 additions & 0 deletions config/Makefile.msvc64
Expand Up @@ -42,6 +42,31 @@ SO=s.obj
DO=d.obj
DBGO=dbg.obj
EXE=.exe
EXT_DLL=.dll
EXT_OBJ=.$(O)
EXT_LIB=.$(A)
EXT_ASM=.$(S)
MANEXT=1
SHARPBANGSCRIPTS=false
PTHREAD_LINK=
X11_INCLUDES=
X11_LINK=
DBM_INCLUDES=
DBM_LINK=
BYTECCRPATH=
SUPPORTS_SHARED_LIBRARIES=true
SHAREDCCCOMPOPTS=
NATIVECCPROFOPTS=
NATIVECCRPATH=
ASFLAGS=
ASPP=
ASPPFLAGS=
ASPPPROFFLAGS=
PROFILING=noprof
DYNLINKOPTS=
DEBUGGER=
CC_PROFILE=
SYSTHREAD_SUPPORT=true

########## Configuration for the bytecode compiler

Expand Down

0 comments on commit 2a85980

Please sign in to comment.