Merge branch 'trunk' into liberal-cr

master
Xavier Leroy 2017-02-19 12:27:15 +01:00 committed by GitHub
commit 141ac5408d
49 changed files with 1710 additions and 1683 deletions

View File

@ -60,6 +60,7 @@ EOF
make install)
git clone git://github.com/ocaml/camlp4
(cd camlp4 &&
sed -i -e "s/5 /6 /" configure &&
./configure --bindir=$PREFIX/bin --libdir=$PREFIX/lib/ocaml \
--pkgdir=$PREFIX/lib/ocaml && \
make && make install)

45
Changes
View File

@ -1,3 +1,21 @@
Working version
---------------
(Changes that can break existing programs are marked with a "*")
### Tools:
- GPR#1045: ocamldep, add a "-shared" option to generate dependencies
for native plugin files (i.e. .cmxs files)
(Florian Angeletti, suggestion by Sébastien Hinderer)
### Bug fixes
- PR#7468: possible GC problem in caml_alloc_sprintf
(Xavier Leroy, discovery by Olivier Andrieu)
Next version (4.05.0):
----------------------
@ -116,6 +134,10 @@ Next version (4.05.0):
### Debugging and profiling:
- PR#7258: ocamldebug's "install_printer" command had problems with
module aliases
(Xavier Leroy)
- GPR#378: Add [Printexc.raise_with_backtrace] raise an exception using
an explicit backtrace
(François Bobot, review by Gabriel Scherer, Xavier Leroy, Damien Doligez,
@ -150,6 +172,15 @@ Next version (4.05.0):
`O_KEEPEXEC` flag for `openfile` by symmetry with `O_CLOEXEC`.
(Xavier Leroy)
- PR#7158: Event.sync, Mutex.create, Condition.create cause too many GCs.
The fix is to no longer consider mutexes and condition variables
as rare kernel resources.
(Xavier Leroy)
- PR#7264: document the different behaviors of Unix.lockf under POSIX
and under Win32.
(Xavier Leroy, report by David Allsopp)
- MPR#7339, GPR#787: Support the '0 dimension' case for bigarrays
(see Bigarray documentation)
(Laurent Mazare,
@ -183,6 +214,10 @@ Next version (4.05.0):
a short description in overviews.
(Florian Angeletti)
- PR#7488: ocamldoc, wrong Latex output for variant types
with constructors without arguments.
(Florian Angeletti, report by Xavier Leroy)
- GPR#848: ocamldoc, escape link targets in HTML output
(Etienne Millon, review by Gabriel Scherer, Florian Angeletti and
Daniel Bünzli)
@ -251,6 +286,9 @@ Next version (4.05.0):
opcode information from C headers.
(Nicolas Ojeda Bar)
- GPR#1033: merge Unix and Windows build systems in the root directory
(Sébastien Hinderer, review by Damien Doligez and Adrien Nader)
### Internal/compiler-libs changes:
- GPR#673: distinguish initialization of block fields from mutation in lambda.
@ -324,6 +362,8 @@ Next version (4.05.0):
- GPR#881: short-paths did not apply to some polymorphic variants
(Valentin Gatien-Baron, review by Leo White)
- GPR#886: Fix Ctype.moregeneral's handling of row_name (Leo White)
- GPR#934: check for integer overflow in Bytes.extend
(Jeremy Yallop, review by Gabriel Scherer)
@ -366,6 +406,11 @@ Next version (4.05.0):
- GPR#1019: Fix fatal error in Flambda mode "[functions] does not map set of
closures ID" (Pierre Chambart, code review by Mark Shinwell and Leo White)
- GPR#1042: Fix escaping of command-line arguments in
Unix.create_process{,_env} under Windows. Arguments with tabs should now
be received verbatim by the child process.
(Nicolas Ojeda Bar, Andreas Hauptmann review by Xavier Leroy)
- GPR#1043: Allow Windows CRLF line-endings in ocamlyacc on Unix and Cygwin.
(David Allsopp, review by Damien Doligez and Xavier Leroy)

View File

@ -152,7 +152,7 @@ has excellent documentation.
INSTALL.adoc:: instructions for installation
LICENSE:: license and copyright notice
Makefile:: main Makefile
Makefile.nt:: Windows Makefile
Makefile.nt:: Windows Makefile (deprecated)
Makefile.shared:: common Makefile
Makefile.tools:: used by manual/ and testsuite/ Makefiles
README.adoc:: general information on the compiler distribution

1293
Makefile

File diff suppressed because it is too large Load Diff

View File

@ -13,760 +13,4 @@
#* *
#**************************************************************************
# The main Makefile
include Makefile.shared
# For users who don't read the INSTALL file
defaultentry:
@echo "Please refer to the instructions in file README.win32.adoc."
FLEXDLL_SUBMODULE_PRESENT:=$(wildcard flexdll/Makefile)
ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" ""
BOOT_FLEXLINK_CMD=
else
BOOT_FLEXLINK_CMD=FLEXLINK_CMD="../boot/ocamlrun ../flexdll/flexlink.exe"
CAMLOPT:=OCAML_FLEXLINK="boot/ocamlrun flexdll/flexlink.exe" $(CAMLOPT)
endif
# FlexDLL sources missing error messages
# Different git mechanism displayed depending on whether this source tree came
# from a git clone or a source tarball.
flexdll/Makefile:
@echo In order to bootstrap FlexDLL, you need to place the sources in
@echo flexdll.
@echo This can either be done by downloading a source tarball from
@echo \ http://alain.frisch.fr/flexdll.html
@if [ -d .git ]; then \
echo or by checking out the flexdll submodule with; \
echo \ git submodule update --init; \
else \
echo or by cloning the git repository; \
echo \ git clone https://github.com/alainfrisch/flexdll.git; \
fi
@false
# Bootstrapping FlexDLL - leaves a bytecode image of flexlink.exe in flexdll/
flexdll: flexdll/Makefile
cd byterun && $(MAKEREC) BOOTSTRAPPING_FLEXLINK=yes ocamlrun$(EXE)
cp byterun/ocamlrun.exe boot/ocamlrun.exe
cd stdlib && $(MAKEREC) COMPILER=../boot/ocamlc stdlib.cma std_exit.cmo
cd stdlib && cp stdlib.cma std_exit.cmo *.cmi ../boot
cd flexdll && \
$(MAKECMD) MSVC_DETECT=0 TOOLCHAIN=$(TOOLCHAIN) TOOLPREF=$(TOOLPREF) \
CHAINS=$(FLEXDLL_CHAIN) NATDYNLINK=false \
OCAMLOPT="../boot/ocamlrun ../boot/ocamlc -I ../boot" \
flexlink.exe support
cd byterun && $(MAKEREC) clean
$(MAKEREC) partialclean
flexlink.opt:
cd flexdll && \
mv flexlink.exe flexlink && \
$(MAKECMD) OCAML_FLEXLINK="../boot/ocamlrun ./flexlink" MSVC_DETECT=0 \
TOOLCHAIN=$(TOOLCHAIN) TOOLPREF=$(TOOLPREF) \
OCAMLOPT="../ocamlopt.opt -I ../stdlib" flexlink.exe && \
mv flexlink.exe flexlink.opt && \
mv flexlink flexlink.exe
# Recompile the system using the bootstrap compiler
all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml \
otherlibraries $(WITH_DEBUGGER) $(WITH_OCAMLDOC)
# The compilation of ocaml will fail if the runtime has changed.
# Never mind, just do make bootstrap to reach fixpoint again.
# Compile everything the first time
world: coldstart all
# Core bootstrapping cycle
coreboot:
# Save the original bootstrap compiler
$(MAKEREC) backup
# Promote the new compiler but keep the old runtime
# This compiler runs on boot/ocamlrun and produces bytecode for
# byterun/ocamlrun
$(MAKEREC) promote-cross
# Rebuild ocamlc and ocamllex (run on byterun/ocamlrun)
$(MAKEREC) partialclean
$(MAKEREC) ocamlc ocamllex ocamltools
# Rebuild the library (using byterun/ocamlrun ./ocamlc)
$(MAKEREC) library-cross
# Promote the new compiler and the new runtime
$(MAKEREC) promote
# Rebuild the core system
$(MAKEREC) partialclean
$(MAKEREC) core
# Check if fixpoint reached
$(MAKEREC) compare
# Do a complete bootstrapping cycle
bootstrap:
$(MAKEREC) coreboot
$(MAKEREC) all
$(MAKEREC) compare
LIBFILES=stdlib.cma std_exit.cmo *.cmi camlheader
# Start up the system from the distribution compiler
coldstart:
cd byterun ; $(MAKEREC) $(BOOT_FLEXLINK_CMD) all
cp byterun/ocamlrun.exe boot/ocamlrun.exe
cd yacc ; $(MAKEREC) $(BOOT_FLEXLINK_CMD) all
cp yacc/ocamlyacc.exe boot/ocamlyacc.exe
cd stdlib ; \
$(MAKEREC) $(BOOT_FLEXLINK_CMD) \
COMPILER="../boot/ocamlc -use-prims ../byterun/primitives"\
all
cd stdlib ; cp $(LIBFILES) ../boot
# Build the core system: the minimum needed to make depend and bootstrap
core:
$(MAKEREC) runtime
$(MAKEREC) coreall
# Recompile the core system using the bootstrap compiler
coreall:
$(MAKEREC) ocamlc
$(MAKEREC) ocamllex ocamlyacc ocamltools library
# Save the current bootstrap compiler
MAXSAVED=boot/Saved/Saved.prev/Saved.prev/Saved.prev/Saved.prev/Saved.prev
backup:
mkdir -p boot/Saved
if test -d $(MAXSAVED); then rm -r $(MAXSAVED); fi
mv boot/Saved boot/Saved.prev
mkdir boot/Saved
mv boot/Saved.prev boot/Saved/Saved.prev
cp boot/ocamlrun.exe boot/Saved/ocamlrun.exe
cd boot ; mv ocamlc ocamllex ocamldep ocamlyacc.exe Saved
cd boot ; cp $(LIBFILES) Saved
# Promote the newly compiled system to the rank of cross compiler
# (Runs on the old runtime, produces code for the new runtime)
promote-cross:
$(CAMLRUN) tools/stripdebug ocamlc boot/ocamlc
$(CAMLRUN) tools/stripdebug lex/ocamllex boot/ocamllex
cp yacc/ocamlyacc.exe boot/ocamlyacc.exe
$(CAMLRUN) tools/stripdebug tools/ocamldep boot/ocamldep
cd stdlib ; cp $(LIBFILES) ../boot
# Promote the newly compiled system to the rank of bootstrap compiler
# (Runs on the new runtime, produces code for the new runtime)
promote: promote-cross
cp byterun/ocamlrun.exe boot/ocamlrun.exe
# Restore the saved bootstrap compiler if a problem arises
restore:
cd boot/Saved ; mv * ..
rmdir boot/Saved
mv boot/Saved.prev boot/Saved
# Check if fixpoint reached
compare:
@if $(CAMLRUN) tools/cmpbyt boot/ocamlc ocamlc \
&& $(CAMLRUN) tools/cmpbyt boot/ocamllex lex/ocamllex \
&& $(CAMLRUN) tools/cmpbyt boot/ocamldep tools/ocamldep; \
then echo "Fixpoint reached, bootstrap succeeded."; \
else echo "Fixpoint not reached, try one more bootstrapping cycle."; \
fi
# Remove old bootstrap compilers
cleanboot:
rm -rf boot/Saved/Saved.prev/*
# Compile the native-code compiler
opt-core:
$(MAKEREC) runtimeopt
$(MAKEREC) ocamlopt
$(MAKEREC) libraryopt
opt:
$(MAKEREC) opt-core
$(MAKEREC) otherlibrariesopt ocamltoolsopt
# Native-code versions of the tools
# If the submodule is initialised, then opt.opt will build a native flexlink
opt.opt: core opt-core ocamlc.opt all ocamlopt.opt ocamllex.opt \
ocamltoolsopt ocamltoolsopt.opt otherlibrariesopt $(OCAMLDOC_OPT) \
$(if $(wildcard flexdll/Makefile),flexlink.opt)
# Complete build using fast compilers
world.opt: coldstart opt.opt
# Installation
COMPLIBDIR=$(LIBDIR)/compiler-libs
INSTALL_BINDIR=$(DESTDIR)$(BINDIR)
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
INSTALL_COMPLIBDIR=$(DESTDIR)$(COMPLIBDIR)
INSTALL_STUBLIBDIR=$(DESTDIR)$(STUBLIBDIR)
INSTALL_MANDIR=$(DESTDIR)$(MANDIR)
INSTALL_DISTRIB=$(DESTDIR)$(PREFIX)
install:
mkdir -p "$(INSTALL_BINDIR)"
mkdir -p "$(INSTALL_LIBDIR)"
mkdir -p "$(INSTALL_STUBLIBDIR)"
mkdir -p "$(INSTALL_COMPLIBDIR)"
cp VERSION "$(INSTALL_LIBDIR)/"
cd byterun ; $(MAKEREC) install
cp ocamlc "$(INSTALL_BINDIR)/ocamlc.exe"
cp ocaml "$(INSTALL_BINDIR)/ocaml.exe"
cp ocamlc "$(INSTALL_BINDIR)/ocamlc.byte.exe"
cd stdlib ; $(MAKEREC) install
cp lex/ocamllex "$(INSTALL_BINDIR)/ocamllex.exe"
cp yacc/ocamlyacc.exe "$(INSTALL_BINDIR)/ocamlyacc.exe"
cp lex/ocamllex "$(INSTALL_BINDIR)/ocamllex.byte.exe"
cp utils/*.cmi utils/*.cmt utils/*.cmti \
parsing/*.cmi parsing/*.cmt parsing/*.cmti \
typing/*.cmi typing/*.cmt typing/*.cmti \
bytecomp/*.cmi bytecomp/*.cmt bytecomp/*.cmti \
driver/*.cmi driver/*.cmt driver/*.cmti \
toplevel/*.cmi toplevel/*.cmt toplevel/*.cmti "$(INSTALL_COMPLIBDIR)"
cp compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma \
compilerlibs/ocamltoplevel.cma $(BYTESTART) $(TOPLEVELSTART) \
"$(INSTALL_COMPLIBDIR)"
cp expunge "$(INSTALL_LIBDIR)/expunge.exe"
cp toplevel/topdirs.cmi "$(INSTALL_LIBDIR)"
cd tools ; $(MAKEREC) install
for i in $(OTHERLIBRARIES); do \
$(MAKEREC) -C otherlibs/$$i install || exit $$?; \
done
if test -n "$(WITH_OCAMLDOC)"; then \
(cd ocamldoc; $(MAKEREC) install); \
fi
if test -n "$(WITH_DEBUGGER)"; then \
(cd debugger; $(MAKEREC) install); \
fi
if test -n "$(FLEXDLL_SUBMODULE_PRESENT)"; then \
$(MAKEREC) install-flexdll; \
fi
cp config/Makefile "$(INSTALL_LIBDIR)/Makefile.config"
if test -n "$(INSTALL_DISTRIB)"; then \
cp README.adoc "$(INSTALL_DISTRIB)/Readme.general.txt"; \
cp README.win32.adoc "$(INSTALL_DISTRIB)/Readme.windows.txt"; \
cp LICENSE "$(INSTALL_DISTRIB)/License.txt"; \
cp Changes "$(INSTALL_DISTRIB)/Changes.txt"; \
fi
if test -f ocamlopt; then $(MAKEREC) installopt; else \
cd "$(INSTALL_BINDIR)"; \
cp ocamlc.byte$(EXE) ocamlc$(EXE); \
cp ocamllex.byte$(EXE) ocamllex$(EXE); \
fi
install-flexdll:
# The $(if ...) installs the correct .manifest file for MSVC and MSVC64
# (GNU make doesn't have ifeq as a function, hence slightly convoluted use of
# filter-out)
cp flexdll/flexlink.exe \
$(if $(filter-out mingw,$(TOOLCHAIN)),\
flexdll/default$(filter-out _i386,_$(ARCH)).manifest) \
$(INSTALL_BINDIR)/
cp flexdll/flexdll_*.$(O) $(INSTALL_LIBDIR)
# Installation of the native-code compiler
installopt:
cd asmrun && $(MAKEREC) install
cp ocamlopt "$(INSTALL_BINDIR)/ocamlopt.exe"
cp ocamlopt "$(INSTALL_BINDIR)/ocamlopt.byte.exe"
cd stdlib && $(MAKEREC) installopt
cp middle_end/*.cmi middle_end/*.cmt middle_end/*.cmti \
"$(INSTALL_COMPLIBDIR)"
cp middle_end/base_types/*.cmi middle_end/base_types/*.cmt \
middle_end/base_types/*.cmti "$(INSTALL_COMPLIBDIR)"
cp asmcomp/*.cmi asmcomp/*.cmt asmcomp/*.cmti "$(INSTALL_COMPLIBDIR)"
cp compilerlibs/ocamloptcomp.cma $(OPTSTART) "$(INSTALL_COMPLIBDIR)"
if test -n "$(WITH_OCAMLDOC)"; then \
(cd ocamldoc && $(MAKEREC) installopt); \
fi
for i in $(OTHERLIBRARIES); do \
$(MAKEREC) -C otherlibs/$$i installopt || exit $$?; \
done
if test -f ocamlopt.opt ; then $(MAKEREC) installoptopt; fi
cd tools; $(MAKEREC) installopt
if test -f ocamlopt.opt -a -f flexdll/flexlink.opt ; then \
cp -f flexdll/flexlink.opt $(INSTALL_BINDIR)/flexlink.exe ; \
fi
installoptopt:
cp ocamlc.opt "$(INSTALL_BINDIR)/ocamlc.opt$(EXE)"
cp ocamlopt.opt "$(INSTALL_BINDIR)/ocamlopt.opt$(EXE)"
cp lex/ocamllex.opt "$(INSTALL_BINDIR)/ocamllex.opt$(EXE)"
cp ocamlc.opt "$(INSTALL_BINDIR)/ocamlc$(EXE)"
cp ocamlopt.opt "$(INSTALL_BINDIR)/ocamlopt$(EXE)"
cp lex/ocamllex.opt "$(INSTALL_BINDIR)/ocamllex$(EXE)"
cp utils/*.cmx parsing/*.cmx typing/*.cmx bytecomp/*.cmx \
driver/*.cmx asmcomp/*.cmx "$(INSTALL_COMPLIBDIR)"
cp compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlcommon.$(A) \
compilerlibs/ocamlbytecomp.cmxa compilerlibs/ocamlbytecomp.$(A) \
compilerlibs/ocamloptcomp.cmxa compilerlibs/ocamloptcomp.$(A) \
$(BYTESTART:.cmo=.cmx) $(BYTESTART:.cmo=.$(O)) \
$(OPTSTART:.cmo=.cmx) $(OPTSTART:.cmo=.$(O)) \
"$(INSTALL_COMPLIBDIR)"
# Run all tests
tests: opt.opt
cd testsuite && $(MAKE) clean && $(MAKE) all
# The clean target
clean:: partialclean
# The compiler
compilerlibs/ocamlcommon.cma: $(COMMON)
$(CAMLC) -a -o $@ $(COMMON)
partialclean::
rm -f compilerlibs/ocamlcommon.cma
# The bytecode compiler
compilerlibs/ocamlbytecomp.cma: $(BYTECOMP)
$(CAMLC) -a -o $@ $(BYTECOMP)
partialclean::
rm -f compilerlibs/ocamlbytecomp.cma
ocamlc: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma $(BYTESTART)
$(CAMLC) $(LINKFLAGS) -compat-32 -o ocamlc \
compilerlibs/ocamlcommon.cma \
compilerlibs/ocamlbytecomp.cma $(BYTESTART)
partialclean::
rm -f ocamlc
# The native-code compiler
compilerlibs/ocamloptcomp.cma: $(MIDDLE_END) $(ASMCOMP)
$(CAMLC) -a -o $@ $(MIDDLE_END) $(ASMCOMP)
partialclean::
rm -f compilerlibs/ocamloptcomp.cma
ocamlopt: compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma \
compilerlibs/ocamlbytecomp.cma $(OPTSTART)
$(CAMLC) $(LINKFLAGS) -o ocamlopt \
compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma \
compilerlibs/ocamlbytecomp.cma $(OPTSTART)
partialclean::
rm -f ocamlopt
# The toplevel
compilerlibs/ocamltoplevel.cma: $(TOPLEVEL)
$(CAMLC) -a -o $@ $(TOPLEVEL)
partialclean::
rm -f compilerlibs/ocamltoplevel.cma
ocaml: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma \
compilerlibs/ocamltoplevel.cma $(TOPLEVELSTART) expunge
$(CAMLC) $(LINKFLAGS) -linkall -o ocaml.tmp \
compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma \
compilerlibs/ocamltoplevel.cma $(TOPLEVELSTART)
- $(CAMLRUN) ./expunge ocaml.tmp ocaml $(PERVASIVES)
rm -f ocaml.tmp
partialclean::
rm -f ocaml
RUNTOP=./byterun/ocamlrun ./ocaml -nostdlib -I stdlib -noinit $(TOPFLAGS) -I otherlibs/win32unix
NATRUNTOP=./ocamlnat$(EXE) -nostdlib -I stdlib -noinit $(TOPFLAGS)
EXTRAPATH=PATH=otherlibs/win32unix:"$(PATH)"
runtop:
$(MAKEREC) core
$(MAKEREC) ocaml
@rlwrap --help 2>/dev/null && $(EXTRAPATH) rlwrap $(RUNTOP) || $(EXTRAPATH) $(RUNTOP)
natruntop:
$(MAKEREC) runtime
$(MAKEREC) coreall
$(MAKEREC) opt.opt
$(MAKEREC) ocamlnat
@rlwrap --help 2>/dev/null && $(EXTRAPATH) rlwrap $(NATRUNTOP) || $(EXTRAPATH) $(NATRUNTOP)
# Native dynlink
otherlibs/dynlink/dynlink.cmxa: otherlibs/dynlink/natdynlink.ml
cd otherlibs/dynlink && $(MAKEREC) allopt
# The configuration file
utils/config.ml: utils/config.mlp config/Makefile
@rm -f utils/config.ml
sed -e "s|%%LIBDIR%%|$(LIBDIR)|" \
-e "s|%%BYTERUN%%|ocamlrun|" \
-e 's|%%CCOMPTYPE%%|$(CCOMPTYPE)|' \
-e "s|%%BYTECC%%|$(BYTECC)|" \
-e "s|%%NATIVECC%%|$(NATIVECC)|" \
-e "s|%%PARTIALLD%%|$(PARTIALLD)|" \
-e "s|%%PACKLD%%|$(PACKLD)|" \
-e "s|%%BYTECCLIBS%%|$(BYTECCLIBS)|" \
-e "s|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|" \
-e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \
-e 's|%%ARCMD%%|$(ARCMD)|' \
-e 's|%%BINUTILS_NM%%|$(BINUTILS_NM)|' \
-e 's|%%BINUTILS_OBJCOPY%%|$(BINUTILS_OBJCOPY)|' \
-e "s|%%ARCH%%|$(ARCH)|" \
-e "s|%%MODEL%%|$(MODEL)|" \
-e "s|%%SYSTEM%%|$(SYSTEM)|" \
-e "s|%%EXT_EXE%%|$(EXE)|" \
-e "s|%%EXT_OBJ%%|.$(O)|" \
-e "s|%%EXT_ASM%%|.$(S)|" \
-e "s|%%EXT_LIB%%|.$(A)|" \
-e "s|%%EXT_DLL%%|.dll|" \
-e "s|%%SYSTHREAD_SUPPORT%%|true|" \
-e 's|%%ASM%%|$(ASM)|' \
-e 's|%%ASM_CFI_SUPPORTED%%|false|' \
-e 's|%%WITH_FRAME_POINTERS%%|false|' \
-e 's|%%WITH_PROFINFO%%|$(WITH_PROFINFO)|' \
-e 's|%%WITH_SPACETIME%%|$(WITH_SPACETIME)|' \
-e 's|%%PROFINFO_WIDTH%%|$(PROFINFO_WIDTH)|' \
-e 's|%%LIBUNWIND_AVAILABLE%%|false|' \
-e 's|%%LIBUNWIND_LINK_FLAGS%%||' \
-e 's|%%MKDLL%%|$(MKDLL)|' \
-e 's|%%MKEXE%%|$(MKEXE)|' \
-e 's|%%MKMAINDLL%%|$(MKMAINDLL)|' \
-e 's|%%CC_PROFILE%%||' \
-e 's|%%HOST%%|$(HOST)|' \
-e 's|%%TARGET%%|$(TARGET)|' \
-e 's|%%PROFILING%%|$(PROFILING)|' \
-e 's|%%FLAMBDA%%|$(FLAMBDA)|' \
-e 's|%%SAFE_STRING%%|$(SAFE_STRING)|' \
-e 's|%%AFL_INSTRUMENT%%|$(AFL_INSTRUMENT)|' \
-e 's|%%FLEXLINK_FLAGS%%|$(FLEXLINK_FLAGS)|' \
utils/config.mlp > utils/config.ml
partialclean::
rm -f utils/config.ml
beforedepend:: utils/config.ml
# The parser
parsing/parser.mli parsing/parser.ml: parsing/parser.mly
$(CAMLYACC) $(YACCFLAGS) parsing/parser.mly
partialclean::
rm -f parsing/parser.mli parsing/parser.ml parsing/parser.output
beforedepend:: parsing/parser.mli parsing/parser.ml
# The lexer
parsing/lexer.ml: parsing/lexer.mll
$(CAMLLEX) parsing/lexer.mll
partialclean::
rm -f parsing/lexer.ml
beforedepend:: parsing/lexer.ml
# Shared parts of the system compiled with the native-code compiler
compilerlibs/ocamlcommon.cmxa: $(COMMON:.cmo=.cmx)
$(CAMLOPT) -a -o $@ $(COMMON:.cmo=.cmx)
partialclean::
rm -f compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlcommon.$(A)
# The bytecode compiler compiled with the native-code compiler
compilerlibs/ocamlbytecomp.cmxa: $(BYTECOMP:.cmo=.cmx)
$(CAMLOPT) -a -o $@ $(BYTECOMP:.cmo=.cmx)
partialclean::
rm -f compilerlibs/ocamlbytecomp.cmxa compilerlibs/ocamlbytecomp.$(A)
ocamlc.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \
$(BYTESTART:.cmo=.cmx)
$(CAMLOPT) $(LINKFLAGS) -ccopt "$(BYTECCLINKOPTS)" -o ocamlc.opt \
compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \
$(BYTESTART:.cmo=.cmx) -cclib "$(BYTECCLIBS)"
partialclean::
rm -f ocamlc.opt
# The native-code compiler compiled with itself
compilerlibs/ocamloptcomp.cmxa: $(MIDDLE_END:.cmo=.cmx) $(ASMCOMP:.cmo=.cmx)
$(CAMLOPT) -a -o $@ $(MIDDLE_END:.cmo=.cmx) $(ASMCOMP:.cmo=.cmx)
partialclean::
rm -f compilerlibs/ocamloptcomp.cmxa compilerlibs/ocamloptcomp.$(A)
ocamlopt.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \
compilerlibs/ocamlbytecomp.cmxa \
$(OPTSTART:.cmo=.cmx)
$(CAMLOPT) $(LINKFLAGS) -o ocamlopt.opt \
compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \
compilerlibs/ocamlbytecomp.cmxa \
$(OPTSTART:.cmo=.cmx)
partialclean::
rm -f ocamlopt.opt
$(COMMON:.cmo=.cmx) $(BYTECOMP:.cmo=.cmx) $(MIDDLE_END:.cmo=.cmx) \
$(ASMCOMP:.cmo=.cmx): ocamlopt
# The predefined exceptions and primitives
byterun/primitives:
cd byterun ; $(MAKEREC) primitives
bytecomp/runtimedef.ml: byterun/primitives byterun/caml/fail.h
(echo 'let builtin_exceptions = [|'; \
sed -n -e 's|.*/\* \("[A-Za-z_]*"\) \*/$$| \1;|p' \
byterun/caml/fail.h; \
echo '|]'; \
echo 'let builtin_primitives = [|'; \
sed -e 's/.*/ "&";/' byterun/primitives; \
echo '|]') > bytecomp/runtimedef.ml
partialclean::
rm -f bytecomp/runtimedef.ml
beforedepend:: bytecomp/runtimedef.ml
# Choose the right machine-dependent files
asmcomp/arch.ml: asmcomp/$(ARCH)/arch.ml
cp asmcomp/$(ARCH)/arch.ml asmcomp/arch.ml
partialclean::
rm -f asmcomp/arch.ml
beforedepend:: asmcomp/arch.ml
asmcomp/proc.ml: asmcomp/$(ARCH)/proc.ml
cp asmcomp/$(ARCH)/proc.ml asmcomp/proc.ml
partialclean::
rm -f asmcomp/proc.ml
beforedepend:: asmcomp/proc.ml
asmcomp/selection.ml: asmcomp/$(ARCH)/selection.ml
cp asmcomp/$(ARCH)/selection.ml asmcomp/selection.ml
partialclean::
rm -f asmcomp/selection.ml
beforedepend:: asmcomp/selection.ml
asmcomp/CSE.ml: asmcomp/$(ARCH)/CSE.ml
cp asmcomp/$(ARCH)/CSE.ml asmcomp/CSE.ml
partialclean::
rm -f asmcomp/CSE.ml
beforedepend:: asmcomp/CSE.ml
asmcomp/reload.ml: asmcomp/$(ARCH)/reload.ml
cp asmcomp/$(ARCH)/reload.ml asmcomp/reload.ml
partialclean::
rm -f asmcomp/reload.ml
beforedepend:: asmcomp/reload.ml
asmcomp/scheduling.ml: asmcomp/$(ARCH)/scheduling.ml
cp asmcomp/$(ARCH)/scheduling.ml asmcomp/scheduling.ml
partialclean::
rm -f asmcomp/scheduling.ml
beforedepend:: asmcomp/scheduling.ml
# Preprocess the code emitters
asmcomp/emit.ml: asmcomp/$(ARCH)/emit.mlp tools/cvt_emit
$(CAMLRUN) tools/cvt_emit < asmcomp/$(ARCH)/emit.mlp > asmcomp/emit.ml
partialclean::
rm -f asmcomp/emit.ml
beforedepend:: asmcomp/emit.ml
tools/cvt_emit: tools/cvt_emit.mll
cd tools ; $(MAKEREC) cvt_emit
# The "expunge" utility
expunge: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma \
toplevel/expunge.cmo
$(CAMLC) $(LINKFLAGS) -o expunge compilerlibs/ocamlcommon.cma \
compilerlibs/ocamlbytecomp.cma toplevel/expunge.cmo
partialclean::
rm -f expunge
# The runtime system for the bytecode compiler
runtime: makeruntime stdlib/libcamlrun.$(A)
makeruntime:
cd byterun ; $(MAKEREC) $(BOOT_FLEXLINK_CMD) all
stdlib/libcamlrun.$(A): byterun/libcamlrun.$(A)
cp byterun/libcamlrun.$(A) stdlib/libcamlrun.$(A)
clean::
cd byterun ; $(MAKEREC) clean
rm -f stdlib/libcamlrun.$(A)
alldepend::
cd byterun ; $(MAKEREC) depend
# The runtime system for the native-code compiler
runtimeopt: makeruntimeopt stdlib/libasmrun.$(A)
makeruntimeopt:
cd asmrun ; $(MAKEREC) $(BOOT_FLEXLINK_CMD) all
stdlib/libasmrun.$(A): asmrun/libasmrun.$(A)
cp asmrun/libasmrun.$(A) stdlib/libasmrun.$(A)
clean::
cd asmrun ; $(MAKEREC) clean
rm -f stdlib/libasmrun.$(A)
alldepend::
cd asmrun ; $(MAKEREC) depend
# The library
library:
cd stdlib && $(MAKEREC) $(BOOT_FLEXLINK_CMD) all
library-cross:
cd stdlib \
&& $(MAKEREC) $(BOOT_FLEXLINK_CMD) CAMLRUN=../byterun/ocamlrun all
libraryopt:
cd stdlib && $(MAKEREC) $(BOOT_FLEXLINK_CMD) allopt
partialclean::
cd stdlib && $(MAKEREC) clean
alldepend::
cd stdlib && $(MAKEREC) depend
# The lexer and parser generators
ocamllex:
cd lex ; $(MAKEREC) all
ocamllex.opt:
cd lex ; $(MAKEREC) allopt
partialclean::
cd lex ; $(MAKEREC) clean
alldepend::
cd lex ; $(MAKEREC) depend
ocamlyacc:
cd yacc ; $(MAKEREC) $(BOOT_FLEXLINK_CMD) all
clean::
cd yacc ; $(MAKEREC) clean
# OCamldoc
ocamldoc:
cd ocamldoc ; $(MAKEREC) all
ocamldoc.opt:
cd ocamldoc ; $(MAKEREC) opt.opt
partialclean::
cd ocamldoc ; $(MAKEREC) clean
alldepend::
cd ocamldoc ; $(MAKEREC) depend
# The extra libraries
otherlibraries:
for i in $(OTHERLIBRARIES); do \
$(MAKEREC) -C otherlibs/$$i all || exit $$?; \
done
otherlibrariesopt:
for i in $(OTHERLIBRARIES); \
do $(MAKEREC) -C otherlibs/$$i allopt || exit $$?; \
done
partialclean::
for i in $(OTHERLIBRARIES); \
do $(MAKEREC) -C otherlibs/$$i partialclean || exit $$?; \
done
clean::
for i in $(OTHERLIBRARIES); do \
$(MAKEREC) -C otherlibs/$$i clean || exit $$?; \
done
alldepend::
for i in $(OTHERLIBRARIES); do \
$(MAKEREC) -C otherlibs/$$i depend || exit $$?; \
done
# The replay debugger
ocamldebugger: ocamlc ocamlyacc ocamllex
cd debugger; $(MAKEREC) all
partialclean::
cd debugger; $(MAKEREC) clean
alldepend::
cd debugger; $(MAKEREC) depend
# Make clean in the test suite
clean::
cd testsuite; $(MAKE) clean
# Default rules
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.ml.cmo:
$(CAMLC) $(COMPFLAGS) -c $<
.mli.cmi:
$(CAMLC) $(COMPFLAGS) -c $<
.ml.cmx:
$(CAMLOPT) $(COMPFLAGS) -c $<
partialclean::
rm -f utils/*.cm* utils/*.$(O) utils/*.$(S)
rm -f parsing/*.cm* parsing/*.$(O) parsing/*.$(S)
rm -f typing/*.cm* typing/*.$(O) typing/*.$(S)
rm -f bytecomp/*.cm* bytecomp/*.$(O) bytecomp/*.$(S)
rm -f asmcomp/*.cm* asmcomp/*.$(O) asmcomp/*.$(S)
rm -f middle_end/*.cm* middle_end/*.$(O) middle_end/*.$(S)
rm -f middle_end/base_types/*.cm* middle_end/base_types/*.$(O) \
middle_end/base_types/*.$(S)
rm -f driver/*.cm* driver/*.$(O) driver/*.$(S)
rm -f toplevel/*.cm* toplevel/*.$(O) toplevel/*.$(S)
rm -f tools/*.cm* tools/*.$(O) tools/*.$(S)
depend: beforedepend
(for d in utils parsing typing bytecomp asmcomp middle_end \
middle_end/base_types driver toplevel; \
do $(CAMLDEP) -slash $(DEPFLAGS) $$d/*.mli $$d/*.ml; \
done) > .depend
$(CAMLDEP) -slash $(DEPFLAGS) -native \
-impl driver/compdynlink.mlopt >> .depend
$(CAMLDEP) -slash $(DEPFLAGS) -bytecode \
-impl driver/compdynlink.mlbyte >> .depend
alldepend:: depend
distclean:
$(MAKEREC) clean
rm -f asmrun/.depend.nt byterun/.depend.nt \
otherlibs/bigarray/.depend.nt \
otherlibs/str/.depend.nt
rm -f boot/ocamlrun boot/ocamlrun.exe boot/camlheader boot/ocamlyacc \
boot/*.cm* boot/libcamlrun.a
rm -f config/Makefile config/m.h config/s.h
rm -f tools/*.bak
rm -f ocaml ocamlc
rm -f testsuite/_log
.PHONY: all backup bootstrap checkstack clean
.PHONY: partialclean beforedepend alldepend cleanboot coldstart
.PHONY: compare core coreall
.PHONY: coreboot defaultentry depend distclean install installopt
.PHONY: library library-cross libraryopt
.PHONY: ocamldebugger ocamldoc
.PHONY: ocamldoc.opt ocamllex ocamllex.opt ocamltools ocamltoolsopt
.PHONY: ocamltoolsopt.opt ocamlyacc opt-core opt opt.opt otherlibraries
.PHONY: otherlibrariesopt promote promote-cross
.PHONY: restore runtime runtimeopt makeruntimeopt world world.opt
.PHONY: flexdll flexlink.opt flexdll-common-err flexdll-repo
include .depend
include Makefile

View File

@ -1,361 +0,0 @@
#**************************************************************************
#* *
#* OCaml *
#* *
#* Xavier Leroy, projet Cristal, INRIA Rocquencourt *
#* *
#* Copyright 1999 Institut National de Recherche en Informatique et *
#* en Automatique. *
#* *
#* 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. *
#* *
#**************************************************************************
# For users who don't read the INSTALL file
defaultentry:
# The main Makefile, fragments shared between Makefile and Makefile.nt
include config/Makefile
CAMLRUN ?= boot/ocamlrun
CAMLYACC ?= boot/ocamlyacc
include stdlib/StdlibModules
CAMLC=$(CAMLRUN) boot/ocamlc -g -nostdlib -I boot -use-prims byterun/primitives
CAMLOPT=$(CAMLRUN) ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink
COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-41-42-44-45-48 \
-warn-error A \
-bin-annot -safe-string -strict-formats $(INCLUDES)
LINKFLAGS=
YACCFLAGS=-v --strict
CAMLLEX=$(CAMLRUN) boot/ocamllex
CAMLDEP=$(CAMLRUN) tools/ocamldep
DEPFLAGS=$(INCLUDES)
OCAMLBUILDBYTE=$(WITH_OCAMLBUILD:=.byte)
OCAMLBUILDNATIVE=$(WITH_OCAMLBUILD:=.native)
OCAMLDOC_OPT=$(WITH_OCAMLDOC:=.opt)
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I middle_end \
-I middle_end/base_types -I asmcomp -I driver -I toplevel
UTILS=utils/config.cmo utils/misc.cmo \
utils/identifiable.cmo utils/numbers.cmo utils/arg_helper.cmo \
utils/clflags.cmo utils/tbl.cmo utils/timings.cmo \
utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \
utils/consistbl.cmo \
utils/strongly_connected_components.cmo \
utils/targetint.cmo
PARSING=parsing/location.cmo parsing/longident.cmo \
parsing/docstrings.cmo parsing/syntaxerr.cmo \
parsing/ast_helper.cmo parsing/parser.cmo \
parsing/lexer.cmo parsing/parse.cmo parsing/printast.cmo \
parsing/pprintast.cmo \
parsing/ast_mapper.cmo parsing/ast_iterator.cmo parsing/attr_helper.cmo \
parsing/builtin_attributes.cmo parsing/ast_invariants.cmo parsing/depend.cmo
TYPING=typing/ident.cmo typing/path.cmo \
typing/primitive.cmo typing/types.cmo \
typing/btype.cmo typing/oprint.cmo \
typing/subst.cmo typing/predef.cmo \
typing/datarepr.cmo typing/cmi_format.cmo typing/env.cmo \
typing/typedtree.cmo typing/printtyped.cmo typing/ctype.cmo \
typing/printtyp.cmo typing/includeclass.cmo \
typing/mtype.cmo typing/envaux.cmo typing/includecore.cmo \
typing/typedtreeIter.cmo typing/typedtreeMap.cmo \
typing/tast_mapper.cmo \
typing/cmt_format.cmo typing/untypeast.cmo \
typing/includemod.cmo typing/typetexp.cmo typing/parmatch.cmo \
typing/stypes.cmo typing/typedecl.cmo typing/typecore.cmo \
typing/typeclass.cmo \
typing/typemod.cmo
COMP=bytecomp/lambda.cmo bytecomp/printlambda.cmo \
bytecomp/semantics_of_primitives.cmo \
bytecomp/typeopt.cmo bytecomp/switch.cmo bytecomp/matching.cmo \
bytecomp/translobj.cmo bytecomp/translattribute.cmo \
bytecomp/translcore.cmo \
bytecomp/translclass.cmo bytecomp/translmod.cmo \
bytecomp/simplif.cmo bytecomp/runtimedef.cmo \
driver/pparse.cmo driver/main_args.cmo \
driver/compenv.cmo driver/compmisc.cmo
COMMON=$(UTILS) $(PARSING) $(TYPING) $(COMP)
BYTECOMP=bytecomp/meta.cmo bytecomp/instruct.cmo bytecomp/bytegen.cmo \
bytecomp/printinstr.cmo bytecomp/opcodes.cmo bytecomp/emitcode.cmo \
bytecomp/bytesections.cmo bytecomp/dll.cmo bytecomp/symtable.cmo \
bytecomp/bytelink.cmo bytecomp/bytelibrarian.cmo bytecomp/bytepackager.cmo \
driver/compdynlink.cmo driver/compplugin.cmo \
driver/errors.cmo driver/compile.cmo
INTEL_ASM=\
asmcomp/x86_proc.cmo \
asmcomp/x86_dsl.cmo \
asmcomp/x86_gas.cmo \
asmcomp/x86_masm.cmo
ARCH_SPECIFIC_ASMCOMP=
ifeq ($(ARCH),i386)
ARCH_SPECIFIC_ASMCOMP=$(INTEL_ASM)
endif
ifeq ($(ARCH),amd64)
ARCH_SPECIFIC_ASMCOMP=$(INTEL_ASM)
endif
ASMCOMP=\
$(ARCH_SPECIFIC_ASMCOMP) \
asmcomp/arch.cmo \
asmcomp/cmm.cmo asmcomp/printcmm.cmo \
asmcomp/reg.cmo asmcomp/mach.cmo asmcomp/proc.cmo \
asmcomp/clambda.cmo asmcomp/printclambda.cmo \
asmcomp/export_info.cmo \
asmcomp/export_info_for_pack.cmo \
asmcomp/compilenv.cmo \
asmcomp/closure.cmo \
asmcomp/build_export_info.cmo \
asmcomp/closure_offsets.cmo \
asmcomp/flambda_to_clambda.cmo \
asmcomp/import_approx.cmo \
asmcomp/un_anf.cmo \
asmcomp/afl_instrument.cmo \
asmcomp/strmatch.cmo asmcomp/cmmgen.cmo \
asmcomp/printmach.cmo asmcomp/selectgen.cmo \
asmcomp/spacetime_profiling.cmo asmcomp/selection.cmo \
asmcomp/comballoc.cmo \
asmcomp/CSEgen.cmo asmcomp/CSE.cmo \
asmcomp/liveness.cmo \
asmcomp/spill.cmo asmcomp/split.cmo \
asmcomp/interf.cmo asmcomp/coloring.cmo \
asmcomp/reloadgen.cmo asmcomp/reload.cmo \
asmcomp/deadcode.cmo \
asmcomp/printlinear.cmo asmcomp/linearize.cmo \
asmcomp/schedgen.cmo asmcomp/scheduling.cmo \
asmcomp/branch_relaxation_intf.cmo \
asmcomp/branch_relaxation.cmo \
asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \
asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo \
driver/opterrors.cmo driver/optcompile.cmo
MIDDLE_END=\
middle_end/debuginfo.cmo \
middle_end/base_types/tag.cmo \
middle_end/base_types/linkage_name.cmo \
middle_end/base_types/compilation_unit.cmo \
middle_end/base_types/variable.cmo \
middle_end/base_types/mutable_variable.cmo \
middle_end/base_types/id_types.cmo \
middle_end/base_types/set_of_closures_id.cmo \
middle_end/base_types/set_of_closures_origin.cmo \
middle_end/base_types/closure_element.cmo \
middle_end/base_types/closure_id.cmo \
middle_end/base_types/var_within_closure.cmo \
middle_end/base_types/static_exception.cmo \
middle_end/base_types/export_id.cmo \
middle_end/base_types/symbol.cmo \
middle_end/pass_wrapper.cmo \
middle_end/allocated_const.cmo \
middle_end/projection.cmo \
middle_end/flambda.cmo \
middle_end/flambda_iterators.cmo \
middle_end/flambda_utils.cmo \
middle_end/inlining_cost.cmo \
middle_end/effect_analysis.cmo \
middle_end/freshening.cmo \
middle_end/simple_value_approx.cmo \
middle_end/lift_code.cmo \
middle_end/closure_conversion_aux.cmo \
middle_end/closure_conversion.cmo \
middle_end/initialize_symbol_to_let_symbol.cmo \
middle_end/lift_let_to_initialize_symbol.cmo \
middle_end/find_recursive_functions.cmo \
middle_end/invariant_params.cmo \
middle_end/inconstant_idents.cmo \
middle_end/alias_analysis.cmo \
middle_end/lift_constants.cmo \
middle_end/share_constants.cmo \
middle_end/simplify_common.cmo \
middle_end/remove_unused_arguments.cmo \
middle_end/remove_unused_closure_vars.cmo \
middle_end/remove_unused_program_constructs.cmo \
middle_end/simplify_boxed_integer_ops.cmo \
middle_end/simplify_primitives.cmo \
middle_end/inlining_stats_types.cmo \
middle_end/inlining_stats.cmo \
middle_end/inline_and_simplify_aux.cmo \
middle_end/remove_free_vars_equal_to_args.cmo \
middle_end/extract_projections.cmo \
middle_end/augment_specialised_args.cmo \
middle_end/unbox_free_vars_of_closures.cmo \
middle_end/unbox_specialised_args.cmo \
middle_end/unbox_closures.cmo \
middle_end/inlining_transforms.cmo \
middle_end/inlining_decision.cmo \
middle_end/inline_and_simplify.cmo \
middle_end/ref_to_variables.cmo \
middle_end/flambda_invariants.cmo \
middle_end/middle_end.cmo
TOPLEVEL=toplevel/genprintval.cmo toplevel/toploop.cmo \
toplevel/trace.cmo toplevel/topdirs.cmo toplevel/topmain.cmo
OPTTOPLEVEL=toplevel/genprintval.cmo toplevel/opttoploop.cmo \
toplevel/opttopdirs.cmo toplevel/opttopmain.cmo
BYTESTART=driver/main.cmo
OPTSTART=driver/optmain.cmo
TOPLEVELSTART=toplevel/topstart.cmo
OPTTOPLEVELSTART=toplevel/opttopstart.cmo
PERVASIVES=$(STDLIB_MODULES) outcometree topdirs toploop
# The middle end (whose .cma library is currently only used for linking
# the "ocamlobjinfo" program, since we cannot depend on the whole native code
# compiler for "make world" and the list of dependencies for
# asmcomp/export_info.cmo is long).
compilerlibs/ocamlmiddleend.cma: $(MIDDLE_END)
$(CAMLC) -a -o $@ $(MIDDLE_END)
compilerlibs/ocamlmiddleend.cmxa: $(MIDDLE_END:%.cmo=%.cmx)
$(CAMLOPT) -a -o $@ $^
partialclean::
rm -f compilerlibs/ocamlmiddleend.cma compilerlibs/ocamlmiddleend.cmxa \
compilerlibs/ocamlmiddleend.$(A)
# Tools
ocamltools: ocamlc ocamlyacc ocamllex asmcomp/cmx_format.cmi \
asmcomp/printclambda.cmo compilerlibs/ocamlmiddleend.cma \
asmcomp/export_info.cmo
+cd tools ; $(MAKEREC) all
ocamltoolsopt: ocamlopt
+cd tools; $(MAKEREC) opt
ocamltoolsopt.opt: ocamlc.opt ocamlyacc ocamllex.opt asmcomp/cmx_format.cmi \
asmcomp/printclambda.cmx compilerlibs/ocamlmiddleend.cmxa \
asmcomp/export_info.cmx
+cd tools; $(MAKEREC) opt.opt
partialclean::
+cd tools; $(MAKEREC) clean
alldepend::
+cd tools; $(MAKEREC) depend
#config/Makefile: configure
# ./configure $(CONFIGURE_ARGS)
## Test compilation of backend-specific parts
ARCH_SPECIFIC = \
asmcomp/arch.ml asmcomp/proc.ml asmcomp/CSE.ml asmcomp/selection.ml \
asmcomp/scheduling.ml asmcomp/reload.ml asmcomp/scheduling.ml \
asmcomp/emit.ml
partialclean::
rm -f $(ARCH_SPECIFIC)
beforedepend:: $(ARCH_SPECIFIC)
ARCH_OCAMLOPT:=$(ARCH)
.PHONY: check_arch check_all_arches
# This rule provides a quick way to check that machine-dependent
# files compiles fine for a foreign architecture (passed as ARCH=xxx).
check_arch:
@echo "========= CHECKING asmcomp/$(ARCH) =============="
@rm -f $(ARCH_SPECIFIC) asmcomp/*.cm*
@$(MAKEREC) ARCH_OCAMLOPT=$(ARCH) compilerlibs/ocamloptcomp.cma \
>/dev/null
@rm -f $(ARCH_SPECIFIC) asmcomp/*.cm*
ARCHES=amd64 i386 arm arm64 power sparc s390x
check_all_arches:
@STATUS=0; \
for i in $(ARCHES); do \
$(MAKEREC) --no-print-directory check_arch ARCH=$$i || STATUS=1; \
done; \
exit $$STATUS
# Compiler Plugins
DYNLINK_DIR=otherlibs/dynlink
driver/compdynlink.mlbyte: $(DYNLINK_DIR)/dynlink.ml driver/compdynlink.mli
grep -v 'REMOVE_ME for ../../debugger/dynlink.ml' \
$(DYNLINK_DIR)/dynlink.ml >driver/compdynlink.mlbyte
ifeq ($(NATDYNLINK),true)
driver/compdynlink.mlopt: $(DYNLINK_DIR)/natdynlink.ml driver/compdynlink.mli
cp $(DYNLINK_DIR)/natdynlink.ml driver/compdynlink.mlopt
else
driver/compdynlink.mlopt: driver/compdynlink.mlno driver/compdynlink.mli
cp driver/compdynlink.mlno driver/compdynlink.mlopt
endif
driver/compdynlink.mli: $(DYNLINK_DIR)/dynlink.mli
cp $(DYNLINK_DIR)/dynlink.mli driver/compdynlink.mli
driver/compdynlink.cmo: driver/compdynlink.mlbyte driver/compdynlink.cmi
$(CAMLC) $(COMPFLAGS) -c -impl $<
driver/compdynlink.cmx: driver/compdynlink.mlopt driver/compdynlink.cmi
$(CAMLOPT) $(COMPFLAGS) -c -impl $<
beforedepend:: driver/compdynlink.mlbyte driver/compdynlink.mlopt \
driver/compdynlink.mli
partialclean::
rm -f driver/compdynlink.mlbyte
rm -f driver/compdynlink.mli
rm -f driver/compdynlink.mlopt
# The native toplevel
compilerlibs/ocamlopttoplevel.cmxa: $(OPTTOPLEVEL:.cmo=.cmx)
$(CAMLOPT) -a -o $@ $(OPTTOPLEVEL:.cmo=.cmx)
partialclean::
rm -f compilerlibs/ocamlopttoplevel.cmxa
# When the native toplevel executable has an extension (e.g. ".exe"),
# provide a phony 'ocamlnat' synonym
ifneq ($(EXE),)
.PHONY: ocamlnat
ocamlnat: ocamlnat$(EXE)
endif
ocamlnat$(EXE): compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \
compilerlibs/ocamlbytecomp.cmxa \
compilerlibs/ocamlopttoplevel.cmxa \
$(OPTTOPLEVELSTART:.cmo=.cmx)
$(CAMLOPT) $(LINKFLAGS) -linkall -o $@ $^
partialclean::
rm -f ocamlnat$(EXE)
toplevel/opttoploop.cmx: otherlibs/dynlink/dynlink.cmxa
# The numeric opcodes
bytecomp/opcodes.ml: byterun/caml/instruct.h tools/make_opcodes
$(CAMLRUN) tools/make_opcodes -opcodes < $< > $@
tools/make_opcodes: tools/make_opcodes.mll
cd tools && $(MAKE) make_opcodes
partialclean::
rm -f bytecomp/opcodes.ml
beforedepend:: bytecomp/opcodes.ml

View File

@ -186,7 +186,7 @@ the top-level of the OCaml distribution by running:
eval $(tools/msvs-promote-path)
If you forget to do this, `make -f Makefile.nt world` will fail relatively
If you forget to do this, `make world` will fail relatively
quickly as it will be unable to link `ocamlrun`.
Now run:
@ -206,9 +206,9 @@ for 64-bit. Then, edit `config/Makefile` 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.
Finally, use `make -f Makefile.nt` to build the system, e.g.
Finally, use `make` to build the system, e.g.
make -f Makefile.nt world bootstrap opt opt.opt install
make world bootstrap opt opt.opt install
After installing, it is not necessary to keep the Cygwin installation (although
you may require it to build additional third party libraries and tools). You
@ -277,9 +277,9 @@ for 64-bit. Then, edit `config/Makefile` 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.
Finally, use `make -f Makefile.nt` to build the system, e.g.
Finally, use `make` to build the system, e.g.
make -f Makefile.nt world bootstrap opt opt.opt install
make world bootstrap opt opt.opt install
After installing, you will need to ensure that `ocamlopt` (or `ocamlc -custom`)
can access the C compiler. You can do this either by using OCaml from Cygwin's
@ -325,16 +325,16 @@ done in one of three ways:
OCaml is then compiled as normal for the port you require, except that before
compiling `world`, you must compile `flexdll`, i.e.:
make -f Makefile.nt flexdll world [bootstrap] opt opt.opt install
make flexdll world [bootstrap] opt opt.opt install
* `make -f Makefile.nt install` will install FlexDLL by placing `flexlink.exe`
* `make install` will install FlexDLL by placing `flexlink.exe`
(and the default manifest file for the Microsoft port) in `bin/` and the
FlexDLL object files in `lib/`.
* If you don't include `make -f Makefile.nt opt.opt`, `flexlink.exe` will be a
bytecode program. `make -f Makefile.nt install` always installs the "best"
* If you don't include `make opt.opt`, `flexlink.exe` will be a
bytecode program. `make install` always installs the "best"
`flexlink.exe` (i.e. there is never a `flexlink.opt.exe` installed).
* If you have populated `flexdll/`, you *must* run
`make -f Makefile.nt flexdll`. If you wish to revert to using an externally
`make flexdll`. If you wish to revert to using an externally
installed FlexDLL, you must erase the contents of `flexdll/` before
compiling.

View File

@ -1,4 +1,4 @@
4.05.0+dev0-2016-08-01
4.06.0+dev0-2017-02-15
# The version string is the first line of this file.
# It must be in the format described in stdlib/sys.mli

View File

@ -68,5 +68,5 @@ build_script:
test_script:
- '%APPVEYOR_BUILD_FOLDER%\ocamlc.opt -version'
- set CAML_LD_LIBRARY_PATH=%OCAMLROOT%/lib/stublibs
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER && make -f Makefile.nt tests"'
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER && make -f Makefile.nt install"'
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER && make tests"'
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER && make install"'

View File

@ -40,7 +40,7 @@ cp config/Makefile config/Makefile.bak
sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" config/Makefile.bak > config/Makefile
#run "Content of config/Makefile" cat config/Makefile
run "make world" make -f Makefile.nt world
run "make bootstrap" make -f Makefile.nt bootstrap
run "make opt" make -f Makefile.nt opt
run "make opt.opt" make -f Makefile.nt opt.opt
run "make world" make world
run "make bootstrap" make bootstrap
run "make opt" make opt
run "make opt.opt" make opt.opt

View File

@ -43,7 +43,7 @@ endif
FLAGS += -DSYS_$(SYSTEM) \
$(NATIVECCCOMPOPTS) $(IFLEXDIR) \
$(LIBUNWIND_INCLUDE_FLAGS)
ifeq "$(TOOLCHAIN)" "msvc"
DFLAGS=$(FLAGS) -DDEBUG
PFLAGS=$(FLAGS) -DPROFILING $(NATIVECCPROFOPTS)
@ -182,8 +182,8 @@ ifneq "$(TOOLCHAIN)" "msvc"
depend: $(COBJS:.$(O)=.c) $(LINKEDFILES)
$(CC) -MM $(FLAGS) *.c > .depend
$(CC) -MM $(FLAGS) -DPROFILING *.c | sed -e 's/\.o/.p.o/' >> .depend
$(CC) -MM $(FLAGS) -DDEBUG *.c | sed -e 's/\.o/.d.o)/' >> .depend
$(CC) -MM $(FLAGS) -DCAML_INSTR *.c | sed -e 's/\.o/.i.o' >> .depend
$(CC) -MM $(FLAGS) -DDEBUG *.c | sed -e 's/\.o/.d.o/' >> .depend
$(CC) -MM $(FLAGS) -DCAML_INSTR *.c | sed -e 's/\.o/.i.o/' >> .depend
endif
ifeq "$(UNIX_OR_WIN32)" "win32"

View File

@ -23,6 +23,7 @@
#include <stdarg.h>
#include "caml/alloc.h"
#include "caml/fail.h"
#include "caml/memory.h"
#include "caml/mlvalues.h"
#include "caml/misc.h"
@ -380,7 +381,7 @@ CAMLprim value caml_bitvect_test(value bv, value n)
CAMLexport value caml_alloc_sprintf(const char * format, ...)
{
va_list args;
char buf[64];
char buf[128];
int n;
value res;
@ -393,19 +394,26 @@ CAMLexport value caml_alloc_sprintf(const char * format, ...)
excluding the terminating '\0'. */
n = vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
/* Allocate a Caml string with length "n" as computed by vsnprintf. */
res = caml_alloc_string(n);
if (n < sizeof(buf)) {
/* All output characters were written to buf, including the
terminating '\0'. Just copy them to the result. */
terminating '\0'. Allocate a Caml string with length "n"
as computed by vsnprintf, and copy the output of vsnprintf into it. */
res = caml_alloc_string(n);
memcpy(String_val(res), buf, n);
} else {
/* PR#7568: if the format is in the Caml heap, the following
caml_alloc_string could move or free the format. To prevent
this, take a copy of the format outside the Caml heap. */
char * saved_format = caml_strdup(format);
/* Allocate a Caml string with length "n" as computed by vsnprintf. */
res = caml_alloc_string(n);
/* Re-do the formatting, outputting directly in the Caml string.
Note that caml_alloc_string left room for a '\0' at position n,
so the size passed to vsnprintf is n+1. */
va_start(args, format);
vsnprintf(String_val(res), n + 1, format, args);
vsnprintf(String_val(res), n + 1, saved_format, args);
va_end(args);
caml_stat_free(saved_format);
}
return res;
#else
@ -422,10 +430,14 @@ CAMLexport value caml_alloc_sprintf(const char * format, ...)
if (n >= 0 && n <= sizeof(buf)) {
/* All output characters were written to buf.
"n" is the actual length of the output.
Copy the characters to a Caml string of length n. */
Allocate a Caml string of length "n" and copy the characters into it. */
res = caml_alloc_string(n);
memcpy(String_val(res), buf, n);
} else {
/* PR#7568: if the format is in the Caml heap, the following
caml_alloc_string could move or free the format. To prevent
this, take a copy of the format outside the Caml heap. */
char * saved_format = caml_strdup(format);
/* Determine actual length of output, excluding final '\0' */
va_start(args, format);
n = _vscprintf(format, args);
@ -435,8 +447,9 @@ CAMLexport value caml_alloc_sprintf(const char * format, ...)
Note that caml_alloc_string left room for a '\0' at position n,
so the size passed to _vsnprintf is n+1. */
va_start(args, format);
_vsnprintf(String_val(res), n + 1, format, args);
_vsnprintf(String_val(res), n + 1, saved_format, args);
va_end(args);
caml_stat_free(saved_format);
}
return res;
#endif

View File

@ -174,9 +174,6 @@ RANLIBCMD=ranlib
#CC_PROFILE=-pg
#CC_PROFILE=-xpg
### How to perform a partial link
PARTIALLD=ld -r $(NATIVECCLINKOPTS)
############# Configuration for the contributed libraries
### Which libraries to compile and install

View File

@ -28,6 +28,9 @@ WITH_OCAMLDOC=ocamldoc
### Where to install the binaries
BINDIR=$(PREFIX)/bin
### Standard runtime system
BYTERUN=ocamlrun
### Where to install the standard library
LIBDIR=$(PREFIX)/lib
@ -81,9 +84,11 @@ CC_PROFILE=
SYSTHREAD_SUPPORT=true
EXTRALIBS=
NATDYNLINK=true
NATDYNLINKOPTS=
CMXS=cmxs
RUNTIMED=false
ASM_CFI_SUPPORTED=false
WITH_FRAME_POINTERS=false
UNIX_OR_WIN32=win32
UNIXLIB=win32unix
GRAPHLIB=win32graph
@ -100,6 +105,7 @@ AFL_INSTRUMENT=false
### Which C compiler to use for the bytecode interpreter.
BYTECC=$(TOOLPREF)gcc -O -mms-bitfields
BYTECODE_C_COMPILER=$(BYTECC)
### Additional compile-time options for $(BYTECC). (For static linking.)
BYTECCCOMPOPTS=-DCAML_NAME_SPACE -Wall -Wno-unused
@ -124,7 +130,7 @@ CPP=$(BYTECC) -E
FLEXLINK_CMD=flexlink
FLEXDLL_CHAIN=mingw
# FLEXLINK_FLAGS must be safe to insert in an OCaml string
# (see ocamlmklibconfig.ml in tools/Makefile.nt)
# (see ocamlmklibconfig.ml in tools/Makefile)
FLEXLINK_FLAGS=-chain $(FLEXDLL_CHAIN) -stack 16777216 -link -static-libgcc
FLEXLINK=$(FLEXLINK_CMD) $(FLEXLINK_FLAGS)
FLEXDIR:=$(shell $(FLEXLINK) -where 2>/dev/null)
@ -174,6 +180,7 @@ SYSTEM=mingw
### Which C compiler to use for the native-code compiler.
NATIVECC=$(BYTECC)
NATIVE_C_COMPILER=$(NATIVECC)
### Additional compile-time options for $(NATIVECC).
NATIVECCCOMPOPTS=-DCAML_NAME_SPACE -Wall -Wno-unused
@ -192,11 +199,6 @@ OTHERLIBRARIES=win32unix str num win32graph dynlink bigarray systhreads
BNG_ARCH=ia32
BNG_ASM_LEVEL=1
############# Aliases for common commands
MAKEREC=$(MAKE) -f Makefile.nt
MAKECMD=$(MAKE)
############# for the testsuite makefiles
#ml let topdir = "" and wintopdir = "";;
OTOPDIR=$(WINTOPDIR)

View File

@ -28,6 +28,9 @@ WITH_OCAMLDOC=ocamldoc
### Where to install the binaries
BINDIR=$(PREFIX)/bin
### Standard runtime system
BYTERUN=ocamlrun
### Where to install the standard library
LIBDIR=$(PREFIX)/lib
@ -81,9 +84,11 @@ CC_PROFILE=
SYSTHREAD_SUPPORT=true
EXTRALIBS=
NATDYNLINK=true
NATDYNLINKOPTS=
CMXS=cmxs
RUNTIMED=false
ASM_CFI_SUPPORTED=false
WITH_FRAME_POINTERS=false
UNIX_OR_WIN32=win32
UNIXLIB=win32unix
GRAPHLIB=win32graph
@ -100,6 +105,7 @@ AFL_INSTRUMENT=false
### Which C compiler to use for the bytecode interpreter.
BYTECC=$(TOOLPREF)gcc -O -mms-bitfields
BYTECODE_C_COMPILER=$(BYTECC)
### Additional compile-time options for $(BYTECC). (For static linking.)
BYTECCCOMPOPTS=-DCAML_NAME_SPACE -Wall -Wno-unused
@ -124,7 +130,7 @@ CPP=$(BYTECC) -E
FLEXLINK_CMD=flexlink
FLEXDLL_CHAIN=mingw64
# FLEXLINK_FLAGS must be safe to insert in an OCaml string
# (see ocamlmklibconfig.ml in tools/Makefile.nt)
# (see ocamlmklibconfig.ml in tools/Makefile)
FLEXLINK_FLAGS=-chain $(FLEXDLL_CHAIN) -stack 33554432
FLEXLINK=$(FLEXLINK_CMD) $(FLEXLINK_FLAGS)
FLEXDIR:=$(shell $(FLEXLINK) -where 2>/dev/null)
@ -174,6 +180,7 @@ SYSTEM=mingw64
### Which C compiler to use for the native-code compiler.
NATIVECC=$(BYTECC)
NATIVE_C_COMPILER=$(NATIVECC)
### Additional compile-time options for $(NATIVECC).
NATIVECCCOMPOPTS=-DCAML_NAME_SPACE -Wall -Wno-unused
@ -192,11 +199,6 @@ OTHERLIBRARIES=win32unix str num win32graph dynlink bigarray systhreads
BNG_ARCH=amd64
BNG_ASM_LEVEL=1
############# Aliases for common commands
MAKEREC=$(MAKE) -f Makefile.nt
MAKECMD=$(MAKE)
############# for the testsuite makefiles
#ml let topdir = "" and wintopdir = "";;
OTOPDIR=$(WINTOPDIR)

View File

@ -22,6 +22,9 @@ PREFIX=C:/ocamlms
### Where to install the binaries.
BINDIR=$(PREFIX)/bin
### Standard runtime system
BYTERUN=ocamlrun
### Where to install the standard library
LIBDIR=$(PREFIX)/lib
@ -76,8 +79,10 @@ SYSTHREAD_SUPPORT=true
EXTRALIBS=
CMXS=cmxs
NATDYNLINK=true
NATDYNLINKOPTS=
RUNTIMED=false
ASM_CFI_SUPPORTED=false
WITH_FRAME_POINTERS=false
UNIX_OR_WIN32=win32
UNIXLIB=win32unix
GRAPHLIB=win32graph
@ -94,6 +99,7 @@ AFL_INSTRUMENT=false
### Which C compiler to use for the bytecode interpreter.
BYTECC=cl -nologo -D_CRT_SECURE_NO_DEPRECATE -O2 -Gy- -MD
BYTECODE_C_COMPILER=$(BYTECC)
### Additional compile-time options for $(BYTECC). (For static linking.)
BYTECCCOMPOPTS=-DCAML_NAME_SPACE
@ -118,7 +124,7 @@ CPP=cl -nologo -EP
FLEXLINK_CMD=flexlink
FLEXDLL_CHAIN=msvc
# FLEXLINK_FLAGS must be safe to insert in an OCaml string
# (see ocamlmklibconfig.ml in tools/Makefile.nt)
# (see ocamlmklibconfig.ml in tools/Makefile)
FLEXLINK_FLAGS=-merge-manifest -stack 16777216
FLEXLINK=$(FLEXLINK_CMD) $(FLEXLINK_FLAGS)
FLEXDIR:=$(shell $(FLEXLINK) -where 2>/dev/null)
@ -172,7 +178,7 @@ SYSTEM=win32
### Which C compiler to use for the native-code compiler.
NATIVECC=cl -nologo -D_CRT_SECURE_NO_DEPRECATE -O2 -Gy- -MD
NATIVE_C_COMPILER=$(NATIVECC)
### Additional compile-time options for $(NATIVECC).
NATIVECCCOMPOPTS=-DCAML_NAME_SPACE
@ -196,11 +202,6 @@ OTHERLIBRARIES=win32unix systhreads str num win32graph dynlink bigarray
BNG_ARCH=generic
BNG_ASM_LEVEL=0
############# Aliases for common commands
MAKEREC=$(MAKE) -f Makefile.nt
MAKECMD=$(MAKE)
############# for the testsuite makefiles
#ml let topdir = "" and wintopdir = "";;
OTOPDIR=$(WINTOPDIR)

View File

@ -22,6 +22,9 @@ PREFIX=C:/ocamlms64
### Where to install the binaries.
BINDIR=$(PREFIX)/bin
### Standard runtime system
BYTERUN=ocamlrun
### Where to install the standard library
LIBDIR=$(PREFIX)/lib
@ -75,8 +78,10 @@ CC_PROFILE=
SYSTHREAD_SUPPORT=true
CMXS=cmxs
NATDYNLINK=true
NATDYNLINKOPTS=
RUNTIMED=false
ASM_CFI_SUPPORTED=false
WITH_FRAME_POINTERS=false
UNIX_OR_WIN32=win32
UNIXLIB=win32unix
GRAPHLIB=win32graph
@ -93,6 +98,7 @@ AFL_INSTRUMENT=false
### Which C compiler to use for the bytecode interpreter.
BYTECC=cl -nologo -D_CRT_SECURE_NO_DEPRECATE -O2 -Gy- -MD
BYTECODE_C_COMPILER=$(BYTECC)
### Additional compile-time options for $(BYTECC). (For static linking.)
BYTECCCOMPOPTS=-DCAML_NAME_SPACE
@ -119,7 +125,7 @@ CPP=cl -nologo -EP
FLEXLINK_CMD=flexlink
FLEXDLL_CHAIN=msvc64
# FLEXLINK_FLAGS must be safe to insert in an OCaml string
# (see ocamlmklibconfig.ml in tools/Makefile.nt)
# (see ocamlmklibconfig.ml in tools/Makefile)
FLEXLINK_FLAGS=-x64 -merge-manifest -stack 33554432
FLEXLINK=$(FLEXLINK_CMD) $(FLEXLINK_FLAGS)
FLEXDIR:=$(shell $(FLEXLINK) -where 2>/dev/null)
@ -174,6 +180,7 @@ SYSTEM=win64
### Which C compiler to use for the native-code compiler.
NATIVECC=cl -nologo -O2 -Gy- -MD
NATIVE_C_COMPILER=$(NATIVECC)
### Additional compile-time options for $(NATIVECC).
NATIVECCCOMPOPTS=-DCAML_NAME_SPACE
@ -198,11 +205,6 @@ OTHERLIBRARIES=win32unix systhreads str num win32graph dynlink bigarray
BNG_ARCH=generic
BNG_ASM_LEVEL=0
############# Aliases for common commands
MAKEREC=$(MAKE) -f Makefile.nt
MAKECMD=$(MAKE)
############# for the testsuite makefiles
#ml let topdir = "" and wintopdir = "";;
OTOPDIR=$(WINTOPDIR)

26
configure vendored
View File

@ -262,6 +262,9 @@ case "$bindir" in
bindir="$prefix/bin";;
*) echo "BINDIR=$bindir" >> Makefile;;
esac
echo 'BYTERUN=$(BINDIR)/ocamlrun' >> Makefile
case "$libdir" in
"") echo 'LIBDIR=$(PREFIX)/lib/ocaml' >> Makefile
libdir="$prefix/lib/ocaml";;
@ -333,9 +336,11 @@ esac
# The BYTECC make variable defines which compiler and options to use
# to compile C code intended to be used by OCaml bytecode programs.
# It is used inside OCaml's build system, and also when ocamlc is
# called on a third-party C source file and no -cc command-line option
# has been specified.
# It is used inside OCaml's build system.
# The BYTECODE_C_COMPILER make variable says how the C compiler should be
# invoked to process a third-party C source file passed to ocamlc
# when no -cc command-line option has been specified.
# The BYTECCCOMPOPTS make variable contains options to pass to the C
# compiler but only when compiling C files that belong to the OCaml
@ -862,9 +867,11 @@ fi
# The NATIVECC make variable defines which compiler and options to use
# to compile C code intended to be used by OCaml native programs.
# It is used inside OCaml's build system, and also when ocamlopt is
# called on a third-party C source file and no -cc command-line
# option has been specified.
# It is used inside OCaml's build system.
# The NATIVE_C_COMPILER make variable says how the C compiler should be
# invoked to process a third-party C source file passed to ocamlopt
# when no -cc command-line option has been specified.
# The NATIVECCCOMPOPTS make variable contains options to pass to the C
# compiler, but only when compiling C files that belong to the OCaml
@ -1976,6 +1983,8 @@ fi
cclibs="$cclibs $mathlib"
echo "BYTECC=$bytecc $bytecccompopts" >> Makefile
echo "BYTECODE_C_COMPILER=$bytecc $bytecccompopts $sharedcccompopts" \
>> Makefile
echo "BYTECCCOMPOPTS=$byteccprivatecompopts" >> Makefile
echo "BYTECCLINKOPTS=$bytecclinkopts" >> Makefile
echo "BYTECCLIBS=$cclibs $dllib $curseslibs $pthread_link \
@ -2000,6 +2009,7 @@ echo "ARCH=$arch" >> Makefile
echo "MODEL=$model" >> Makefile
echo "SYSTEM=$system" >> Makefile
echo "NATIVECC=$nativecc $nativecccompopts" >> Makefile
echo "NATIVE_C_COMPILER=$nativecc $nativecccompopts" >> Makefile
echo "NATIVECCCOMPOPTS=$nativeccprivatecompopts" >> Makefile
echo "NATIVECCPROFOPTS=$nativeccprofopts" >> Makefile
echo "NATIVECCLINKOPTS=$nativecclinkopts" >> Makefile
@ -2013,9 +2023,7 @@ echo "DYNLINKOPTS=$dllib" >> Makefile
echo "OTHERLIBRARIES=$otherlibraries" >> Makefile
echo "CC_PROFILE=$cc_profile" >> Makefile
echo "SYSTHREAD_SUPPORT=$systhread_support" >> Makefile
echo "PARTIALLD=$partialld" >> Makefile
echo "PACKLD=\$(PARTIALLD) \$(NATIVECCLINKOPTS) -o " \
| sed -e 's/ $/\\ /' >> Makefile
echo "PACKLD=$partialld $nativecclinkopts -o\\ " >> Makefile
echo "IFLEXDIR=$iflexdir" >> Makefile
echo "O=o" >> Makefile
echo "A=a" >> Makefile

View File

@ -97,6 +97,11 @@ let rec eval_path = function
| Pdot(p, _, pos) -> Obj.field (eval_path p) pos
| Papply _ -> fatal_error "Loadprinter.eval_path"
(* PR#7258: get rid of module aliases before evaluating paths *)
let eval_path path =
eval_path (Env.normalize_path (Some Location.none) Env.empty path)
(* Install, remove a printer (as in toplevel/topdirs) *)
(* since 4.00, "topdirs.cmi" is not in the same directory as the standard

View File

@ -166,6 +166,10 @@ as a preprocessor for each source file.
Pipe abstract syntax tree through preprocessor
.IR command .
.TP
.B \-shared
Generate dependencies for native plugin files (.cmxs) in addition to
native compiled files (.cmx).
.TP
.B \-slash
Under Unix, this option does nothing.
.TP

View File

@ -118,6 +118,10 @@ for each source file.
\item["-ppx" \var{command}]
Pipe abstract syntax trees through preprocessor \var{command}.
\item["-shared"]
Generate dependencies for native plugin files (.cmxs) in addition to
native compiled files (.cmx).
\item["-slash"]
Under Windows, use a forward slash (/) as the path separator instead
of the usual backward slash ($\backslash$). Under Unix, this option does

View File

@ -112,15 +112,6 @@ of the script:
\end{unix}
\begin{windows}
In addition to the text-only command "ocaml.exe", which works exactly
as under Unix (see above), a graphical user interface for the
toplevel is available under the name "ocamlwin.exe". It should be
launched from the Windows file manager or program manager.
This interface provides a text window in which commands can be entered
and edited, and the toplevel responses are printed.
\end{windows}
\section{Options} \label{s:toplevel-options}
The following command-line options are recognized by the "ocaml" command.
@ -135,11 +126,6 @@ The following command-line options are recognized by the "ocaml" command.
\begin{unix}
The following environment variables are also consulted:
\begin{options}
\item["LC_CTYPE"] If set to "iso_8859_1", accented characters (from the
ISO Latin-1 character set) in string and character literals are
printed as is; otherwise, they are printed as decimal escape sequences
("\\"\var{ddd}).
\item["TERM"] When printing error messages, the toplevel system
attempts to underline visually the location of the error. It
consults the "TERM" variable to determines the type of output terminal
@ -214,6 +200,17 @@ will result in an ``unbound value "quit"'' error.
semantics of the compiler.
\end{options}
For directives that take file names as arguments, if the given file
name specifies no directory, the file is searched in the following
directories:
\begin{enumerate}
\item In script mode, the directory containing the script currently
executing; in interactive mode, the current working directory.
\item Directories added with the "#directory" directive.
\item Directories given on the command line with "-I" options.
\item The standard library directory.
\end{enumerate}
\item[Environment queries]
\begin{options}
\item["#show_class "\var{class-path}";;"]\vspace{-4.7ex}

View File

@ -30,8 +30,8 @@ shown below:
systems, including Linux and \hbox{MacOS~X}.
\end{unix}
\begin{windows} This is material specific to Microsoft Windows (2000,
XP, Vista, Seven).
\begin{windows} This is material specific to Microsoft Windows
(XP, Vista, 7, 8, 10).
\end{windows}
\section*{License}
@ -69,13 +69,14 @@ citation is given.
\begin{latexonly}
The complete OCaml distribution can be accessed via the Web
site \url{http://caml.inria.fr/}. This Web site contains a lot of
additional information on OCaml.
sites \url{http://www.ocaml.org/} and \url{http://caml.inria.fr/}.
The former Web site contains a lot of additional information on OCaml.
\end{latexonly}
\begin{htmlonly}
The complete OCaml distribution can be accessed via the
\href{http://caml.inria.fr/}{Caml Web site}.
The \href{http://caml.inria.fr/}{Caml Web site}
\href{http://www.ocaml.org/}{community Caml Web site} and the
\href{http://caml.inria.fr/}{older Caml Web site}.
The \href{http://www.ocaml.org/}{community Caml Web site}
contains a lot of additional information on OCaml.
\end{htmlonly}

View File

@ -22,7 +22,7 @@
%\pdftrue
\input macros.tex
\usepackage{hyperref}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\def\th{^{\hbox{\scriptsize th}}}
\raggedbottom

View File

@ -70,7 +70,7 @@ int main(argc, argv)
}
if (incaml) {
fputs(line, stdout);
if (isprefix(line, "\\endcaml")) incaml = 0;
if (isprefix(line, "\\endcamlexample")) incaml = 0;
continue;
}
if (inverbatim){
@ -95,7 +95,7 @@ int main(argc, argv)
inverbatim_like = 1;
continue;
}
if (isprefix(line, "\\caml")) {
if (isprefix(line, "\\camlexample")) {
fputs(line, stdout);
incaml = 1;
continue;

View File

@ -1,11 +1,3 @@
generators/odoc_literate.cmo : odoc_info.cmi odoc_html.cmo odoc_gen.cmi \
odoc_args.cmi
generators/odoc_literate.cmx : odoc_info.cmx odoc_html.cmx odoc_gen.cmx \
odoc_args.cmx
generators/odoc_todo.cmo : odoc_module.cmo odoc_info.cmi odoc_html.cmo \
odoc_gen.cmi odoc_args.cmi
generators/odoc_todo.cmx : odoc_module.cmx odoc_info.cmx odoc_html.cmx \
odoc_gen.cmx odoc_args.cmx
odoc.cmo : odoc_messages.cmo odoc_info.cmi odoc_global.cmi odoc_gen.cmi \
odoc_config.cmi odoc_args.cmi odoc_analyse.cmi
odoc.cmx : odoc_messages.cmx odoc_info.cmx odoc_global.cmx odoc_gen.cmx \
@ -272,3 +264,15 @@ odoc_value.cmo : ../typing/types.cmi ../typing/printtyp.cmi odoc_types.cmi \
odoc_parameter.cmo odoc_name.cmi odoc_misc.cmi ../parsing/asttypes.cmi
odoc_value.cmx : ../typing/types.cmx ../typing/printtyp.cmx odoc_types.cmx \
odoc_parameter.cmx odoc_name.cmx odoc_misc.cmx ../parsing/asttypes.cmi
generators/odoc_literate.cmo : odoc_info.cmi odoc_html.cmo odoc_gen.cmi \
odoc_args.cmi
generators/odoc_literate.cmx : odoc_info.cmx odoc_html.cmx odoc_gen.cmx \
odoc_args.cmx
generators/odoc_literate.cmxs : odoc_info.cmx odoc_html.cmx odoc_gen.cmx \
odoc_args.cmx
generators/odoc_todo.cmo : odoc_module.cmo odoc_info.cmi odoc_html.cmo \
odoc_gen.cmi odoc_args.cmi
generators/odoc_todo.cmx : odoc_module.cmx odoc_info.cmx odoc_html.cmx \
odoc_gen.cmx odoc_args.cmx
generators/odoc_todo.cmxs : odoc_module.cmx odoc_info.cmx odoc_html.cmx \
odoc_gen.cmx odoc_args.cmx

View File

@ -212,7 +212,7 @@ exeopt: $(OCAMLDOC_OPT)
libopt: $(OCAMLDOC_LIBCMXA) $(OCAMLDOC_LIBCMI)
.PHONY: generatorsopt
generatorsopt: $(GENERATORS_CMXS) # Not present in Makefile.nt
generatorsopt: $(GENERATORS_CMXS)
# TODO: the following debug target could be replaced by a DEBUG variable
.PHONY: debug
@ -424,6 +424,7 @@ depend:
$(OCAMLLEX) odoc_lexer.mll
$(OCAMLLEX) odoc_ocamlhtml.mll
$(OCAMLLEX) odoc_see_lexer.mll
$(OCAMLDEP) $(INCLUDES_DEP) *.mll *.mly *.ml *.mli generators/*.ml > .depend
$(OCAMLDEP) $(INCLUDES_DEP) *.mll *.mly *.ml *.mli > .depend
$(OCAMLDEP) $(INCLUDES_DEP) -shared generators/*.ml >> .depend
include .depend

View File

@ -566,16 +566,18 @@ class latex =
method latex_of_cstr_args ( (fmt,flush) as f) mod_name (args, ret) =
match args, ret with
| Cstr_tuple [], None -> []
| Cstr_tuple [], None -> [CodePre(flush())]
| Cstr_tuple _ as l, None ->
p fmt " of@ %s"
(self#normal_cstr_args ~par:false mod_name l);
[CodePre (flush())]
| Cstr_tuple _ as l, Some r ->
p fmt " :@ %s@ %s@ %s"
(self#normal_cstr_args ~par:false mod_name l)
"->"
(self#normal_type mod_name r);
| Cstr_tuple t as l, Some r ->
let res = self#normal_type mod_name r in
if t = [] then
p fmt " :@ %s" res
else
p fmt " :@ %s -> %s" (self#normal_cstr_args ~par:false mod_name l) res
;
[CodePre (flush())]
| Cstr_record l, None ->
p fmt " of@ ";
@ -700,17 +702,17 @@ class latex =
p fmt2 "@[<h 6> | %s" (Name.simple x.xt_name);
let l = self#latex_of_cstr_args f father (x.xt_args, x.xt_ret) in
let c =
begin match x.xt_alias with
| None -> ()
match x.xt_alias with
| None -> []
| Some xa ->
p fmt2 " = %s"
(
match xa.xa_xt with
| None -> xa.xa_name
| Some x -> x.xt_name
)
end;
[CodePre (flush2 ())] in
);
[CodePre (flush2 ())]
in
Latex (self#make_label (self#extension_label x.xt_name)) :: l @ c
@ (match x.xt_text with
None -> []
@ -744,16 +746,17 @@ class latex =
p fmt2 "@[<hov 2>exception %s" s_name;
let l = self#latex_of_cstr_args f father (e.ex_args, e.ex_ret) in
let s =
(match e.ex_alias with
None -> ()
| Some ea ->
Format.fprintf fmt " = %s"
(
match ea.ea_ex with
None -> ea.ea_name
| Some e -> e.ex_name
)
); [CodePre (flush2 ())] in
match e.ex_alias with
None -> []
| Some ea ->
Format.fprintf fmt " = %s"
(
match ea.ea_ex with
None -> ea.ea_name
| Some e -> e.ex_name
);
[CodePre (flush2 ())]
in
merge_codepre (l @ s ) @
[Latex ("\\index{"^(self#label s_name)^"@\\verb`"^(self#label ~no_:false s_name)^"`}\n")]
@ (self#text_of_info e.ex_info) in

View File

@ -48,7 +48,10 @@ external size_y : unit -> int = "caml_gr_size_y"
(** Return the size of the graphics window. Coordinates of the screen
pixels range over [0 .. size_x()-1] and [0 .. size_y()-1].
Drawings outside of this rectangle are clipped, without causing
an error. The origin (0,0) is at the lower left corner. *)
an error. The origin (0,0) is at the lower left corner.
Some implementation (e.g. X Windows) represent coordinates by
16-bit integers, hence wrong clipping may occur with coordinates
below [-32768] or above [32676]. *)
(** {6 Colors} *)
@ -303,7 +306,7 @@ external wait_next_event : event list -> status = "caml_gr_wait_event"
graphics window, the [mouse_x] and [mouse_y] fields of the event are
outside the range [0..size_x()-1, 0..size_y()-1]. Keypresses
are queued, and dequeued one by one when the [Key_pressed]
event is specified. *)
event is specified and the [Poll] event is not specified. *)
val loop_at_exit : event list -> (status -> unit) -> unit
(** Loop before exiting the program, the list given as argument is the

View File

@ -749,7 +749,6 @@ CAMLprim value caml_thread_join(value th) /* ML */
/* Mutex operations */
#define Mutex_val(v) (* ((st_mutex *) Data_custom_val(v)))
#define Max_mutex_number 5000
static void caml_mutex_finalize(value wrapper)
{
@ -783,7 +782,7 @@ CAMLprim value caml_mutex_new(value unit) /* ML */
value wrapper;
st_check_error(st_mutex_create(&mut), "Mutex.create");
wrapper = caml_alloc_custom(&caml_mutex_ops, sizeof(st_mutex *),
1, Max_mutex_number);
0, 1);
Mutex_val(wrapper) = mut;
return wrapper;
}
@ -828,7 +827,6 @@ CAMLprim value caml_mutex_try_lock(value wrapper) /* ML */
/* Conditions operations */
#define Condition_val(v) (* (st_condvar *) Data_custom_val(v))
#define Max_condition_number 5000
static void caml_condition_finalize(value wrapper)
{
@ -863,7 +861,7 @@ CAMLprim value caml_condition_new(value unit) /* ML */
value wrapper;
st_check_error(st_condvar_create(&cond), "Condition.create");
wrapper = caml_alloc_custom(&caml_condition_ops, sizeof(st_condvar *),
1, Max_condition_number);
0, 1);
Condition_val(wrapper) = cond;
return wrapper;
}
@ -900,7 +898,6 @@ CAMLprim value caml_condition_broadcast(value wrapper) /* ML */
/* Thread status blocks */
#define Threadstatus_val(v) (* ((st_event *) Data_custom_val(v)))
#define Max_threadstatus_number 500
static void caml_threadstatus_finalize(value wrapper)
{
@ -930,7 +927,7 @@ static value caml_threadstatus_new (void)
value wrapper;
st_check_error(st_event_create(&ts), "Thread.create");
wrapper = caml_alloc_custom(&caml_threadstatus_ops, sizeof(st_event *),
1, Max_threadstatus_number);
0, 1);
Threadstatus_val(wrapper) = ts;
return wrapper;
}

View File

@ -881,7 +881,14 @@ val lockf : file_descr -> lock_command -> int -> unit
the specified region.
Finally, the [F_TEST] command tests whether a write lock can be
acquired on the specified region, without actually putting a lock.
It returns immediately if successful, or fails otherwise. *)
It returns immediately if successful, or fails otherwise.
What happens when a process tries to lock a region of a file that is
already locked by the same process depends on the OS. On POSIX-compliant
systems, the second lock operation succeeds and may "promote" the older
lock from read lock to write lock. On Windows, the second lock
operation will block or fail.
*)
(** {6 Signals}

View File

@ -848,7 +848,10 @@ external win_create_process : string -> string -> string option ->
let make_cmdline args =
let maybe_quote f =
if String.contains f ' ' || String.contains f '\"' || f = ""
if String.contains f ' ' ||
String.contains f '\"' ||
String.contains f '\t' ||
f = ""
then Filename.quote f
else f in
String.concat " " (List.map maybe_quote (Array.to_list args))

View File

@ -104,6 +104,9 @@ module type S =
(** [merge f m1 m2] computes a map whose keys is a subset of keys of [m1]
and of [m2]. The presence of each such binding, and the corresponding
value, is determined with the function [f].
In terms of the [find_opt] operation, we have
[find_opt x (merge f m1 m2) = f (find_opt x m1) (find_opt x m2)]
for any key [x], provided that [f None None = None].
@since 3.12.0
*)
@ -111,6 +114,13 @@ module type S =
(** [union f m1 m2] computes a map whose keys is the union of keys
of [m1] and of [m2]. When the same binding is defined in both
arguments, the function [f] is used to combine them.
This is a special case of [merge]: [union f m1 m2] is equivalent
to [merge f' m1 m2], where
- [f' None None = None]
- [f' (Some v) None = Some v]
- [f' None (Some v) = Some v]
- [f' (Some v1) (Some v2) = f v1 v2]
@since 4.03.0
*)
@ -233,8 +243,8 @@ module type S =
or raises [Not_found] if no such binding exists. *)
val find_opt: key -> 'a t -> 'a option
(** [find_opt x m] returns the current binding of [x] in [m],
or raises [Not_found] if no such binding exists.
(** [find_opt x m] returns [Some v] if the current binding of [x]
in [m] is [v], or [None] if no such binding exists.
@since 4.05
*)

View File

@ -619,7 +619,7 @@ external float_of_string : string -> float = "caml_float_of_string"
representation of a float. *)
val float_of_string_opt: string -> float option
(** Same as [float_of_string], but returs [None] instead of raising.
(** Same as [float_of_string], but returns [None] instead of raising.
@since 4.05
*)

View File

@ -28,7 +28,7 @@ FORTRAN_LIB=`if [ -n "$(F_FILES)" ]; then echo $(FORTRAN_LIBRARY); fi`
ADD_CFLAGS+=$(FORTRAN_LIB)
ADD_OPTFLAGS+=$(FORTRAN_LIB)
C_INCLUDES+=-I $(CTOPDIR)/byterun -I$(CTOPDIR)/otherlibs/bigarray
C_INCLUDES+=-I $(CTOPDIR)/byterun -I $(CTOPDIR)/otherlibs/bigarray
GENERATED_SOURCES=

View File

@ -22,12 +22,12 @@ ifeq ($(OS),Windows_NT)
ADD_BYTERUN_FLAGS="-I $(OTOPDIR)/otherlibs/win32unix"
endif
default: reflector.exe fdstatus.exe
default: reflector.exe fdstatus.exe cmdline_prog.exe
$(MAKE) check
include $(BASEDIR)/makefiles/Makefile.several
include $(BASEDIR)/makefiles/Makefile.common
%.exe: %.c
@$(BYTECC) -o $*.exe $*.c > /dev/null
@$(BYTECC) $(if $(filter msvc,$(CCOMPTYPE)),/Fe$*.exe,-o $*.exe) $*.c

View File

@ -0,0 +1,10 @@
#include <stdio.h>
int main (int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i ++) {
printf ("%s\n", argv[i]);
}
return 0;
}

View File

@ -0,0 +1,28 @@
open Unix
let prog_name = "cmdline_prog.exe"
let run args =
let out, inp = pipe () in
let in_chan = in_channel_of_descr out in
set_binary_mode_in in_chan false;
let pid = create_process ("./" ^ prog_name) (Array.of_list (prog_name :: args)) Unix.stdin inp Unix.stderr in
List.iter (fun arg ->
let s = input_line in_chan in
Printf.printf "%S -> %S [%s]\n" arg s (if s = arg then "OK" else "FAIL")
) args;
close_in in_chan;
let _, exit = waitpid [] pid in
assert (exit = WEXITED 0)
let () =
List.iter run
[
[""; ""; "\t \011"];
["a"; "b"; "c.txt@!"];
["\""];
[" "; " a "; " \" \\\" "];
[" \\ \\ \\\\\\"];
[" \"hola \""];
["a\tb"];
]

View File

@ -0,0 +1,13 @@
"" -> "" [OK]
"" -> "" [OK]
"\t \011" -> "\t \011" [OK]
"a" -> "a" [OK]
"b" -> "b" [OK]
"c.txt@!" -> "c.txt@!" [OK]
"\"" -> "\"" [OK]
" " -> " " [OK]
" a " -> " a " [OK]
" \" \\\" " -> " \" \\\" " [OK]
" \\ \\ \\\\\\" -> " \\ \\ \\\\\\" [OK]
" \"hola \"" -> " \"hola \"" [OK]
"a\tb" -> "a\tb" [OK]

View File

@ -33,7 +33,6 @@ A nice exception
\begin{ocamldoccode}
exception Less of int
\end{ocamldoccode}
\index{Less@\verb`Less`}
\begin{ocamldocdescription}
@ -221,7 +220,6 @@ Error field documentation {\tt{name:string}}
\end{ocamldoccomment}
\begin{ocamldoccode}
{\char125}
\end{ocamldoccode}
\index{Error@\verb`Error`}
@ -241,7 +239,6 @@ Field documentation for {\tt{E}} in ext
\end{ocamldoccomment}
\begin{ocamldoccode}
{\char125}
\end{ocamldoccode}
\begin{ocamldoccomment}
Constructor E documentation
@ -258,7 +255,6 @@ Some field documentations for {\tt{F}}
\end{ocamldoccomment}
\begin{ocamldoccode}
{\char125}
\end{ocamldoccode}
\begin{ocamldoccomment}
Constructor F documentation
@ -275,7 +271,6 @@ The last and least field documentation
\end{ocamldoccomment}
\begin{ocamldoccode}
{\char125}
\end{ocamldoccode}
\begin{ocamldoccomment}
Constructor G documentation

View File

@ -33,7 +33,6 @@ A nice exception
\begin{ocamldoccode}
exception Less of int
\end{ocamldoccode}
\index{Less@\verb`Less`}
\begin{ocamldocdescription}
@ -221,7 +220,6 @@ Error field documentation {\tt{name:string}}
\end{ocamldoccomment}
\begin{ocamldoccode}
{\char125}
\end{ocamldoccode}
\index{Error@\verb`Error`}
@ -241,7 +239,6 @@ Field documentation for {\tt{E}} in ext
\end{ocamldoccomment}
\begin{ocamldoccode}
{\char125}
\end{ocamldoccode}
\begin{ocamldoccomment}
Constructor E documentation
@ -258,7 +255,6 @@ Some field documentations for {\tt{F}}
\end{ocamldoccomment}
\begin{ocamldoccode}
{\char125}
\end{ocamldoccode}
\begin{ocamldoccomment}
Constructor F documentation
@ -275,7 +271,6 @@ The last and least field documentation
\end{ocamldoccomment}
\begin{ocamldoccode}
{\char125}
\end{ocamldoccode}
\begin{ocamldoccomment}
Constructor G documentation

View File

@ -0,0 +1,38 @@
(** This test is here to check the latex code generated for variants *)
type s = A | B (** only B is documented here *) | C
type t =
| A
(** doc for A *)
| B
(** doc for B *)
(** Some documentation for u*)
type u =
| A (** doc for A *) | B of unit (** doc for B *)
(** With records *)
type w =
| A of { x: int }
(** doc for A *)
| B of { y:int }
(** doc for B *)
(** With args *)
type z =
| A of int
(** doc for A *)
| B of int
(** doc for B *)
(** Gadt notation *)
type a =
A: a (** doc for A*)
(** Lonely constructor *)
type b =
B (** doc for B *)
type no_documentation = A | B | C

View File

@ -0,0 +1,190 @@
\documentclass[11pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{fullpage}
\usepackage{url}
\usepackage{ocamldoc}
\begin{document}
\tableofcontents
\section{Module {\tt{Variants}} : This test is here to check the latex code generated for variants}
\label{Variants}\index{Variants@\verb`Variants`}
\ocamldocvspace{0.5cm}
\label{TYPVariants.s}\begin{ocamldoccode}
type s =
| A
| B
\end{ocamldoccode}
\begin{ocamldoccomment}
only B is documented here
\end{ocamldoccomment}
\begin{ocamldoccode}
| C
\end{ocamldoccode}
\index{s@\verb`s`}
\label{TYPVariants.t}\begin{ocamldoccode}
type t =
| A
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for A
\end{ocamldoccomment}
\begin{ocamldoccode}
| B
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for B
\end{ocamldoccomment}
\index{t@\verb`t`}
\label{TYPVariants.u}\begin{ocamldoccode}
type u =
| A
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for A
\end{ocamldoccomment}
\begin{ocamldoccode}
| B of unit
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for B
\end{ocamldoccomment}
\index{u@\verb`u`}
\begin{ocamldocdescription}
Some documentation for u
\end{ocamldocdescription}
\label{TYPVariants.w}\begin{ocamldoccode}
type w =
| A of {\char123} x : int ;
{\char125}
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for A
\end{ocamldoccomment}
\begin{ocamldoccode}
| B of {\char123} y : int ;
{\char125}
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for B
\end{ocamldoccomment}
\index{w@\verb`w`}
\begin{ocamldocdescription}
With records
\end{ocamldocdescription}
\label{TYPVariants.z}\begin{ocamldoccode}
type z =
| A of int
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for A
\end{ocamldoccomment}
\begin{ocamldoccode}
| B of int
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for B
\end{ocamldoccomment}
\index{z@\verb`z`}
\begin{ocamldocdescription}
With args
\end{ocamldocdescription}
\label{TYPVariants.a}\begin{ocamldoccode}
type a =
| A : a
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for A
\end{ocamldoccomment}
\index{a@\verb`a`}
\begin{ocamldocdescription}
Gadt notation
\end{ocamldocdescription}
\label{TYPVariants.b}\begin{ocamldoccode}
type b =
| B
\end{ocamldoccode}
\begin{ocamldoccomment}
doc for B
\end{ocamldoccomment}
\index{b@\verb`b`}
\begin{ocamldocdescription}
Lonely constructor
\end{ocamldocdescription}
\label{TYPVariants.no-underscoredocumentation}\begin{ocamldoccode}
type no_documentation =
| A
| B
| C
\end{ocamldoccode}
\index{no-underscoredocumentation@\verb`no_documentation`}
\end{document}

View File

@ -0,0 +1,38 @@
(** This test is here to check the latex code generated for variants *)
type s = A | B (** only B is documented here *) | C
type t =
| A
(** doc for A *)
| B
(** doc for B *)
(** Some documentation for u*)
type u =
| A (** doc for A *) | B of unit (** doc for B *)
(** With records *)
type w =
| A of { x: int }
(** doc for A *)
| B of { y:int }
(** doc for B *)
(** With args *)
type z =
| A of int
(** doc for A *)
| B of int
(** doc for B *)
(** Gadt notation *)
type a =
A: a (** doc for A*)
(** Lonely constructor *)
type b =
B (** doc for B *)
type no_documentation = A | B | C

View File

@ -0,0 +1,232 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Variants" rel="Chapter" href="Variants.html"><title>Variants</title>
</head>
<body>
<div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;</div>
<h1>Module <a href="type_Variants.html">Variants</a></h1>
<pre><span class="keyword">module</span> Variants: <code class="code"><span class="keyword">sig</span></code> <a href="Variants.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
This test is here to check the latex code generated for variants<br>
</div>
<hr width="100%">
<pre><code><span id="TYPEs"><span class="keyword">type</span> <code class="type"></code>s</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTs.A"><span class="constructor">A</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTs.B"><span class="constructor">B</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
only B is documented here<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTs.C"><span class="constructor">C</span></span></code></td>
</tr></table>
<pre><code><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTt.A"><span class="constructor">A</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for A<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTt.B"><span class="constructor">B</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for B<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
<pre><code><span id="TYPEu"><span class="keyword">type</span> <code class="type"></code>u</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTu.A"><span class="constructor">A</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for A<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTu.B"><span class="constructor">B</span></span> <span class="keyword">of</span> <code class="type">unit</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for B<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
<div class="info ">
Some documentation for u<br>
</div>
<pre><code><span id="TYPEw"><span class="keyword">type</span> <code class="type"></code>w</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTw.A"><span class="constructor">A</span></span> <span class="keyword">of</span> <code>{</code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTVariants.A.x">x</span>&nbsp;: <code class="type">int</code>;</code></td>
</tr></table>
}
</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for A<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTw.B"><span class="constructor">B</span></span> <span class="keyword">of</span> <code>{</code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTVariants.B.y">y</span>&nbsp;: <code class="type">int</code>;</code></td>
</tr></table>
}
</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for B<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
<div class="info ">
With records<br>
</div>
<pre><code><span id="TYPEz"><span class="keyword">type</span> <code class="type"></code>z</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTz.A"><span class="constructor">A</span></span> <span class="keyword">of</span> <code class="type">int</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for A<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTz.B"><span class="constructor">B</span></span> <span class="keyword">of</span> <code class="type">int</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for B<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
<div class="info ">
With args<br>
</div>
<pre><code><span id="TYPEa"><span class="keyword">type</span> <code class="type"></code>a</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTa.A"><span class="constructor">A</span></span> <span class="keyword">:</span> <code class="type"><a href="Variants.html#TYPEa">a</a></code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for A<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
<div class="info ">
Gadt notation<br>
</div>
<pre><code><span id="TYPEb"><span class="keyword">type</span> <code class="type"></code>b</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTb.B"><span class="constructor">B</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
doc for B<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
<div class="info ">
Lonely constructor<br>
</div>
<pre><code><span id="TYPEno_documentation"><span class="keyword">type</span> <code class="type"></code>no_documentation</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTno_documentation.A"><span class="constructor">A</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTno_documentation.B"><span class="constructor">B</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTno_documentation.C"><span class="constructor">C</span></span></code></td>
</tr></table>
</body></html>

View File

@ -86,7 +86,6 @@ set -ex
# default values
make=make
instdir="$HOME/ocaml-tmp-install"
makefile=Makefile
configure=unix
case "$branch" in
@ -105,22 +104,18 @@ case "$arch" in
cygwin) ;;
mingw)
instdir=/cygdrive/c/ocamlmgw
makefile=Makefile.nt
configure=nt
;;
mingw64)
instdir=/cygdrive/c/ocamlmgw64
makefile=Makefile.nt
configure=nt
;;
msvc)
instdir=/cygdrive/c/ocamlms
makefile=Makefile.nt
configure=nt
;;
msvc64)
instdir=/cygdrive/c/ocamlms64
makefile=Makefile.nt
configure=nt
;;
*) error "unknown architecture: $arch";;
@ -132,9 +127,6 @@ esac
pwd
cd "$workdir"
# If Makefile.nt is absent, assume the new makefile system.
if ! [ -f $makefile ]; then makefile=Makefile; fi
#########################################################################
# parse optional command-line arguments (has to be done after the "cd")
@ -156,7 +148,7 @@ done
# Tell gcc to use only ASCII in its diagnostic outputs.
export LC_ALL=C
$make -f $makefile distclean || :
$make distclean || :
if $docheckout; then
git fetch origin
@ -173,15 +165,15 @@ case $configure in
*) error "internal error";;
esac
$make -f $makefile coldstart
$make -f $makefile core
$make -f $makefile coreboot
$make -f $makefile world
$make coldstart
$make core
$make coreboot
$make world
if $make_native; then
$make -f $makefile opt
$make -f $makefile opt.opt
$make opt
$make opt.opt
fi
$make -f $makefile install
$make install
rm -rf "$instdir"
cd testsuite

View File

@ -25,6 +25,7 @@ type file_kind = ML | MLI;;
let load_path = ref ([] : (string * string array) list)
let ml_synonyms = ref [".ml"]
let mli_synonyms = ref [".mli"]
let shared = ref false
let native_only = ref false
let bytecode_only = ref false
let error_occurred = ref false
@ -317,6 +318,7 @@ let print_ml_dependencies source_file extracted_deps =
if !all_dependencies
then [ basename ^ ".cmx"; basename ^ ".o" ]
else [ basename ^ ".cmx" ] in
let shared_targets = [ basename ^ ".cmxs" ] in
let init_deps = if !all_dependencies then [source_file] else [] in
let cmi_name = basename ^ ".cmi" in
let init_deps, extra_targets =
@ -332,7 +334,11 @@ let print_ml_dependencies source_file extracted_deps =
if not !native_only then
print_dependencies (byte_targets @ extra_targets) byt_deps;
if not !bytecode_only then
print_dependencies (native_targets @ extra_targets) native_deps
begin
print_dependencies (native_targets @ extra_targets) native_deps;
if !shared then
print_dependencies (shared_targets @ extra_targets) native_deps
end
let print_mli_dependencies source_file extracted_deps =
let basename = Filename.chop_extension source_file in
@ -584,6 +590,8 @@ let _ =
"<cmd> Pipe sources through preprocessor <cmd>";
"-ppx", Arg.String (add_to_list first_ppx),
"<cmd> Pipe abstract syntax trees through preprocessor <cmd>";
"-shared", Arg.Set shared,
" Generate dependencies for native plugin files (.cmxs targets)";
"-slash", Arg.Set Clflags.force_slash,
" (Windows) Use forward slash / instead of backslash \\ in file paths";
"-sort", Arg.Set sort_files,

View File

@ -3050,7 +3050,9 @@ and moregen_row inst_nongen type_pairs env row1 row2 =
raise (Unify [])
| _ when static_row row1 -> ()
| _ when may_inst ->
let ext = newgenty (Tvariant {row2 with row_fields = r2}) in
let ext =
newgenty (Tvariant {row2 with row_fields = r2; row_name = None})
in
moregen_occur env rm1.level ext;
link_type rm1 ext
| Tconstr _, Tconstr _ ->

View File

@ -30,9 +30,9 @@ let standard_library =
let standard_runtime = "%%BYTERUN%%"
let ccomp_type = "%%CCOMPTYPE%%"
let bytecomp_c_compiler = "%%BYTECC%%"
let bytecomp_c_compiler = "%%BYTECODE_C_COMPILER%%"
let bytecomp_c_libraries = "%%BYTECCLIBS%%"
let native_c_compiler = "%%NATIVECC%%"
let native_c_compiler = "%%NATIVE_C_COMPILER%%"
let native_c_libraries = "%%NATIVECCLIBS%%"
let native_pack_linker = "%%PACKLD%%"
let ranlib = "%%RANLIBCMD%%"