diff options
author | David Allsopp <david.allsopp@metastack.com> | 2022-12-14 00:52:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-14 00:52:52 +0100 |
commit | 8c25e3266411dc8a2c2f8f92090464aeddbb93b7 (patch) | |
tree | 7d9dd8fedcfdb7682cd8c4c4f740e1771d2516b4 /tools | |
parent | aa4f842468ef4e1085a76c85e7f317a56985b0a6 (diff) | |
parent | 08bb1bbebe1d53502bdcced8b6262d594ad2a5e1 (diff) | |
download | ocaml-8c25e3266411dc8a2c2f8f92090464aeddbb93b7.tar.gz |
Merge pull request #11675 from shindere/merge-tools-makefile
Merge tools/Makefile into the root Makefile
Diffstat (limited to 'tools')
-rw-r--r-- | tools/.depend | 213 | ||||
-rw-r--r-- | tools/Makefile | 353 | ||||
-rw-r--r-- | tools/cmpbyt.ml | 4 | ||||
-rw-r--r-- | tools/cmpbyt.mli | 16 | ||||
-rw-r--r-- | tools/cvt_emit.mli | 16 | ||||
-rw-r--r-- | tools/cvt_emit.mll | 16 | ||||
-rw-r--r-- | tools/dumpobj.ml | 2 | ||||
-rw-r--r-- | tools/dumpobj.mli | 16 | ||||
-rw-r--r-- | tools/lintapidiff.mli | 17 | ||||
-rw-r--r-- | tools/make_opcodes.mli | 16 | ||||
-rw-r--r-- | tools/objinfo.ml | 2 | ||||
-rw-r--r-- | tools/objinfo.mli | 16 | ||||
-rw-r--r-- | tools/ocamlcmt.ml | 5 | ||||
-rw-r--r-- | tools/ocamlcmt.mli | 16 | ||||
-rw-r--r-- | tools/ocamlcp.mli | 16 | ||||
-rw-r--r-- | tools/ocamlcp_common.mli | 55 | ||||
-rw-r--r-- | tools/ocamldep.mli | 16 | ||||
-rw-r--r-- | tools/ocamlmklib.ml | 8 | ||||
-rw-r--r-- | tools/ocamlmklib.mli | 16 | ||||
-rw-r--r-- | tools/ocamlmktop.ml | 4 | ||||
-rw-r--r-- | tools/ocamlmktop.mli | 16 | ||||
-rw-r--r-- | tools/ocamloptp.mli | 16 | ||||
-rw-r--r-- | tools/ocamlprof.mli | 16 | ||||
-rw-r--r-- | tools/ocamltex.ml | 11 | ||||
-rw-r--r-- | tools/ocamltex.mli | 17 | ||||
-rw-r--r-- | tools/opnames.mli | 16 | ||||
-rw-r--r-- | tools/primreq.ml | 2 | ||||
-rw-r--r-- | tools/primreq.mli | 16 | ||||
-rw-r--r-- | tools/stripdebug.ml | 4 | ||||
-rw-r--r-- | tools/stripdebug.mli | 16 |
30 files changed, 361 insertions, 592 deletions
diff --git a/tools/.depend b/tools/.depend deleted file mode 100644 index f99e8bd79d..0000000000 --- a/tools/.depend +++ /dev/null @@ -1,213 +0,0 @@ -cmpbyt.cmo : \ - ../bytecomp/bytesections.cmi -cmpbyt.cmx : \ - ../bytecomp/bytesections.cmx -cvt_emit.cmo : -cvt_emit.cmx : -dumpobj.cmo : \ - ../bytecomp/symtable.cmi \ - opnames.cmo \ - ../bytecomp/opcodes.cmi \ - ../parsing/location.cmi \ - ../lambda/lambda.cmi \ - ../bytecomp/instruct.cmi \ - ../typing/ident.cmi \ - ../utils/config.cmi \ - ../file_formats/cmo_format.cmi \ - ../bytecomp/bytesections.cmi \ - ../parsing/asttypes.cmi -dumpobj.cmx : \ - ../bytecomp/symtable.cmx \ - opnames.cmx \ - ../bytecomp/opcodes.cmx \ - ../parsing/location.cmx \ - ../lambda/lambda.cmx \ - ../bytecomp/instruct.cmx \ - ../typing/ident.cmx \ - ../utils/config.cmx \ - ../file_formats/cmo_format.cmi \ - ../bytecomp/bytesections.cmx \ - ../parsing/asttypes.cmi -eqparsetree.cmo : \ - ../parsing/parsetree.cmi \ - ../parsing/longident.cmi \ - ../parsing/location.cmi \ - ../parsing/asttypes.cmi -eqparsetree.cmx : \ - ../parsing/parsetree.cmi \ - ../parsing/longident.cmx \ - ../parsing/location.cmx \ - ../parsing/asttypes.cmi -gen_sizeclasses.cmo : -gen_sizeclasses.cmx : -lintapidiff.cmo : \ - ../typing/printtyp.cmi \ - ../driver/pparse.cmi \ - ../typing/path.cmi \ - ../parsing/parsetree.cmi \ - ../parsing/parse.cmi \ - ../utils/misc.cmi \ - ../parsing/location.cmi \ - ../typing/ident.cmi -lintapidiff.cmx : \ - ../typing/printtyp.cmx \ - ../driver/pparse.cmx \ - ../typing/path.cmx \ - ../parsing/parsetree.cmi \ - ../parsing/parse.cmx \ - ../utils/misc.cmx \ - ../parsing/location.cmx \ - ../typing/ident.cmx -make_opcodes.cmo : -make_opcodes.cmx : -objinfo.cmo : \ - ../bytecomp/symtable.cmi \ - ../middle_end/symbol.cmi \ - ../typing/shape.cmi \ - ../middle_end/printclambda.cmi \ - ../utils/misc.cmi \ - ../middle_end/linkage_name.cmi \ - ../typing/ident.cmi \ - ../middle_end/flambda/export_info.cmi \ - ../middle_end/compilation_unit.cmi \ - ../file_formats/cmxs_format.cmi \ - ../file_formats/cmx_format.cmi \ - ../file_formats/cmt_format.cmi \ - ../file_formats/cmo_format.cmi \ - ../file_formats/cmi_format.cmi \ - ../bytecomp/bytesections.cmi \ - ../utils/binutils.cmi -objinfo.cmx : \ - ../bytecomp/symtable.cmx \ - ../middle_end/symbol.cmx \ - ../typing/shape.cmx \ - ../middle_end/printclambda.cmx \ - ../utils/misc.cmx \ - ../middle_end/linkage_name.cmx \ - ../typing/ident.cmx \ - ../middle_end/flambda/export_info.cmx \ - ../middle_end/compilation_unit.cmx \ - ../file_formats/cmxs_format.cmi \ - ../file_formats/cmx_format.cmi \ - ../file_formats/cmt_format.cmx \ - ../file_formats/cmo_format.cmi \ - ../file_formats/cmi_format.cmx \ - ../bytecomp/bytesections.cmx \ - ../utils/binutils.cmx -ocamlcmt.cmo : \ - ../typing/untypeast.cmi \ - ../typing/stypes.cmi \ - ../parsing/pprintast.cmi \ - ../parsing/location.cmi \ - ../utils/load_path.cmi \ - ../typing/envaux.cmi \ - ../driver/compmisc.cmi \ - ../file_formats/cmt_format.cmi \ - ../typing/cmt2annot.cmi \ - ../utils/clflags.cmi \ - ../typing/annot.cmi -ocamlcmt.cmx : \ - ../typing/untypeast.cmx \ - ../typing/stypes.cmx \ - ../parsing/pprintast.cmx \ - ../parsing/location.cmx \ - ../utils/load_path.cmx \ - ../typing/envaux.cmx \ - ../driver/compmisc.cmx \ - ../file_formats/cmt_format.cmx \ - ../typing/cmt2annot.cmx \ - ../utils/clflags.cmx \ - ../typing/annot.cmi -ocamlcp.cmo : \ - ocamlcp_common.cmo \ - ../driver/main_args.cmi -ocamlcp.cmx : \ - ocamlcp_common.cmx \ - ../driver/main_args.cmx -ocamlcp_common.cmo : \ - ../driver/main_args.cmi \ - ../driver/compenv.cmi -ocamlcp_common.cmx : \ - ../driver/main_args.cmx \ - ../driver/compenv.cmx -ocamldep.cmo : \ - ../driver/makedepend.cmi -ocamldep.cmx : \ - ../driver/makedepend.cmx -ocamlmklib.cmo : \ - ../utils/misc.cmi \ - ../utils/config.cmi -ocamlmklib.cmx : \ - ../utils/misc.cmx \ - ../utils/config.cmx -ocamlmktop.cmo : \ - ../utils/config.cmi \ - ../utils/ccomp.cmi -ocamlmktop.cmx : \ - ../utils/config.cmx \ - ../utils/ccomp.cmx -ocamloptp.cmo : \ - ocamlcp_common.cmo \ - ../driver/main_args.cmi -ocamloptp.cmx : \ - ocamlcp_common.cmx \ - ../driver/main_args.cmx -ocamlprof.cmo : \ - ../utils/warnings.cmi \ - ../parsing/parsetree.cmi \ - ../parsing/parse.cmi \ - ../parsing/location.cmi -ocamlprof.cmx : \ - ../utils/warnings.cmx \ - ../parsing/parsetree.cmi \ - ../parsing/parse.cmx \ - ../parsing/location.cmx -ocamltex.cmo : \ - ../toplevel/toploop.cmi \ - ../parsing/syntaxerr.cmi \ - ../parsing/parsetree.cmi \ - ../parsing/parse.cmi \ - ../utils/misc.cmi \ - ../parsing/location.cmi \ - ../utils/load_path.cmi \ - ../parsing/lexer.cmi \ - ../driver/compmisc.cmi \ - ../driver/compenv.cmi \ - ../utils/clflags.cmi \ - ../parsing/ast_iterator.cmi \ - ../parsing/ast_helper.cmi -ocamltex.cmx : \ - ../toplevel/toploop.cmx \ - ../parsing/syntaxerr.cmx \ - ../parsing/parsetree.cmi \ - ../parsing/parse.cmx \ - ../utils/misc.cmx \ - ../parsing/location.cmx \ - ../utils/load_path.cmx \ - ../parsing/lexer.cmx \ - ../driver/compmisc.cmx \ - ../driver/compenv.cmx \ - ../utils/clflags.cmx \ - ../parsing/ast_iterator.cmx \ - ../parsing/ast_helper.cmx -opnames.cmo : -opnames.cmx : -primreq.cmo : \ - ../utils/misc.cmi \ - ../utils/config.cmi \ - ../file_formats/cmo_format.cmi -primreq.cmx : \ - ../utils/misc.cmx \ - ../utils/config.cmx \ - ../file_formats/cmo_format.cmi -profiling.cmo : \ - profiling.cmi -profiling.cmx : \ - profiling.cmi -profiling.cmi : -stripdebug.cmo : \ - ../utils/misc.cmi \ - ../bytecomp/bytesections.cmi -stripdebug.cmx : \ - ../utils/misc.cmx \ - ../bytecomp/bytesections.cmx diff --git a/tools/Makefile b/tools/Makefile deleted file mode 100644 index 12f3a2af6a..0000000000 --- a/tools/Makefile +++ /dev/null @@ -1,353 +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. * -#* * -#************************************************************************** - -ROOTDIR = .. -# NOTE: it is important that OCAMLLEX is defined *before* Makefile.common -# gets included, so that its definition here takes precedence -# over the one there. -OCAMLLEX ?= $(BOOT_OCAMLLEX) -include $(ROOTDIR)/Makefile.common -include $(ROOTDIR)/Makefile.best_binaries - -# Setup GNU make variables storing per-target source and target, -# a list of installed tools, and a function to quote a filename for -# the shell. -installed_tools := ocamldep ocamlprof ocamlcp ocamloptp \ - ocamlmktop ocamlmklib ocamlobjinfo - -install_files := -define byte2native -$(patsubst %.cmo,%.cmx,$(patsubst %.cma,%.cmxa,$1)) -endef - -CAMLC = $(BOOT_OCAMLC) $(BOOT_STDLIBFLAGS) -g \ - -use-prims $(ROOTDIR)/runtime/primitives -I $(ROOTDIR) -CAMLOPT = $(OCAMLRUN) $(ROOTDIR)/ocamlopt$(EXE) $(STDLIBFLAGS) -g -DIRS = $(addprefix $(ROOTDIR)/,utils parsing typing bytecomp \ - middle_end middle_end/closure middle_end/flambda \ - middle_end/flambda/base_types driver toplevel \ - file_formats lambda) -INCLUDES = $(addprefix -I ,$(DIRS)) -COMPFLAGS = -absname -w +a-4-9-41-42-44-45-48-70 -strict-sequence \ --warn-error +A -principal -strict-formats -bin-annot $(INCLUDES) -LINKFLAGS = $(INCLUDES) -VPATH := $(filter-out -I,$(INCLUDES)) - -programs_byte := \ - ocamldep ocamlprof ocamlcp ocamloptp ocamlmklib \ - ocamlmktop ocamlcmt dumpobj ocamlobjinfo \ - primreq stripdebug cmpbyt -install_files += $(filter $(installed_tools), $(programs_byte)) -programs_opt := $(programs_byte:%=%.opt) - -.PHONY: all allopt opt.opt othertools # allopt and opt.opt are synonyms -all: $(programs_byte) -opt.opt: $(programs_opt) -allopt: opt.opt - -$(foreach program, $(programs_byte) $(programs_opt),\ - $(eval $(call PROGRAM_SYNONYM,$(program)))) - -$(programs_byte:%=%$(EXE)): - $(CAMLC) $(LINKFLAGS) -I $(ROOTDIR) -o $@ $(filter-out %.cmi,$^) - -$(programs_opt:%=%$(EXE)): - $(CAMLOPT_CMD) $(LINKFLAGS) -I $(ROOTDIR) -o $@ $(filter-out %.cmi,$^) - -clean:: - rm -f $(programs_byte) $(programs_byte:%=%.exe) - rm -f $(programs_opt) $(programs_opt:%=%.exe) - -# The dependency generator - -ocamldep_objects = \ - $(ROOTDIR)/compilerlibs/ocamlcommon.cma \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \ - ocamldep.cmo depend.cmi - -ocamldep$(EXE): LINKFLAGS += -compat-32 -ocamldep$(EXE): $(ocamldep_objects) -ocamldep.opt$(EXE): $(call byte2native, $(ocamldep_objects)) - -# The profiler - -OCAMLPROF=config.cmo build_path_prefix_map.cmo misc.cmo identifiable.cmo \ - numbers.cmo arg_helper.cmo local_store.cmo load_path.cmo clflags.cmo \ - terminfo.cmo warnings.cmo location.cmo longident.cmo docstrings.cmo \ - syntaxerr.cmo ast_helper.cmo \ - camlinternalMenhirLib.cmo parser.cmo \ - pprintast.cmo \ - lexer.cmo parse.cmo ocamlprof.cmo - -ocamlprof$(EXE): $(OCAMLPROF) -ocamlprof.opt$(EXE): $(call byte2native, $(OCAMLPROF)) -all: profiling.cmo -opt.opt: profiling.cmx - -OCAMLCP = config.cmo build_path_prefix_map.cmo misc.cmo profile.cmo \ - warnings.cmo identifiable.cmo numbers.cmo arg_helper.cmo \ - local_store.cmo load_path.cmo clflags.cmo \ - terminfo.cmo location.cmo ccomp.cmo compenv.cmo \ - main_args.cmo ocamlcp_common.cmo - -ocamlcp$(EXE): $(OCAMLCP) ocamlcp.cmo -ocamlcp.opt$(EXE): $(call byte2native, $(OCAMLCP) ocamlcp.cmo) -ocamloptp$(EXE): $(OCAMLCP) ocamloptp.cmo -ocamloptp.opt$(EXE): $(call byte2native, $(OCAMLCP) ocamloptp.cmo) - -opt:: profiling.cmx - -INSTALL_LIBDIR_PROFILING = $(INSTALL_LIBDIR)/profiling - -install:: -# If installing over a previous OCaml version, ensure the module is removed -# from the previous installation. - rm -f "$(INSTALL_LIBDIR)"/profiling.cm* "$(INSTALL_LIBDIR)/profiling.$(O)" - $(MKDIR) "$(INSTALL_LIBDIR_PROFILING)" - $(INSTALL_DATA) \ - profiling.cmi profiling.cmo \ - "$(INSTALL_LIBDIR_PROFILING)" -ifeq "$(INSTALL_SOURCE_ARTIFACTS)" "true" - $(INSTALL_DATA) \ - profiling.cmt profiling.cmti \ - "$(INSTALL_LIBDIR_PROFILING)" -endif - -installopt:: - $(INSTALL_DATA) \ - profiling.cmx profiling.$(O) \ - "$(INSTALL_LIBDIR_PROFILING)" - -# To help building mixed-mode libraries (OCaml + C) -OCAMLMKLIB = config.cmo build_path_prefix_map.cmo misc.cmo ocamlmklib.cmo - -ocamlmklib$(EXE): $(OCAMLMKLIB) -ocamlmklib.opt$(EXE): $(call byte2native, $(OCAMLMKLIB)) - -# To make custom toplevels - -OCAMLMKTOP=config.cmo build_path_prefix_map.cmo misc.cmo \ - identifiable.cmo numbers.cmo arg_helper.cmo local_store.cmo \ - load_path.cmo clflags.cmo profile.cmo ccomp.cmo ocamlmktop.cmo - -ocamlmktop$(EXE): $(OCAMLMKTOP) -ocamlmktop.opt$(EXE): $(call byte2native, $(OCAMLMKTOP)) - -# Converter olabl/ocaml 2.99 to ocaml 3 - -LIBRARY3=config.cmo build_path_prefix_map.cmo misc.cmo warnings.cmo location.cmo - -ifeq ($(UNIX_OR_WIN32),unix) -LN := ln -sf -else -LN := cp -pf -endif - -install:: -ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" - for i in $(install_files); \ - do \ - $(INSTALL_PROG) "$$i$(EXE)" "$(INSTALL_BINDIR)/$$i.byte$(EXE)"; \ - if test -f "$$i".opt$(EXE); then \ - $(INSTALL_PROG) "$$i.opt$(EXE)" "$(INSTALL_BINDIR)" && \ - (cd "$(INSTALL_BINDIR)" && $(LN) "$$i.opt$(EXE)" "$$i$(EXE)"); \ - else \ - (cd "$(INSTALL_BINDIR)" && $(LN) "$$i.byte$(EXE)" "$$i$(EXE)"); \ - fi; \ - done -else - for i in $(install_files); \ - do \ - if test -f "$$i".opt$(EXE); then \ - $(INSTALL_PROG) "$$i.opt$(EXE)" "$(INSTALL_BINDIR)"; \ - (cd "$(INSTALL_BINDIR)" && $(LN) "$$i.opt$(EXE)" "$$i$(EXE)"); \ - fi; \ - done -endif - -# The preprocessor for asm generators - -cvt_emit := cvt_emit$(EXE) - -$(eval $(call PROGRAM_SYNONYM,cvt_emit)) - -$(cvt_emit): cvt_emit.cmo - $(CAMLC) $(LINKFLAGS) -o $@ $^ - -clean:: - rm -f cvt_emit.ml cvt_emit cvt_emit.exe - -beforedepend:: cvt_emit.ml - -# Reading cmt files - -OCAMLCMT = \ - $(ROOTDIR)/compilerlibs/ocamlcommon.cma \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \ - ocamlcmt.cmo - -ocamlcmt$(EXE): $(OCAMLCMT) -ocamlcmt.opt$(EXE): $(call byte2native, $(OCAMLCMT)) - -install:: - if test -f ocamlcmt.opt$(EXE); then \ - $(INSTALL_PROG)\ - ocamlcmt.opt$(EXE) "$(INSTALL_BINDIR)/ocamlcmt$(EXE)"; \ - else \ - $(INSTALL_PROG) ocamlcmt$(EXE) "$(INSTALL_BINDIR)"; \ - fi - -# The bytecode disassembler - -DUMPOBJ= \ - $(ROOTDIR)/compilerlibs/ocamlcommon.cma \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \ - opnames.cmo dumpobj.cmo - -dumpobj$(EXE): $(DUMPOBJ) -dumpobj.opt$(EXE): $(call byte2native, $(DUMPOBJ)) - -make_opcodes := make_opcodes$(EXE) - -$(eval $(call PROGRAM_SYNONYM,make_opcodes)) - -$(make_opcodes): make_opcodes.ml - $(CAMLC) $< -o $@ - -opnames.ml: $(ROOTDIR)/runtime/caml/instruct.h $(make_opcodes) - $(NEW_OCAMLRUN) $(make_opcodes) -opnames < $< > $@ - -clean:: - rm -f opnames.ml make_opcodes make_opcodes.exe make_opcodes.ml - -beforedepend:: opnames.ml - -# Display info on compiled files - -DEF_SYMBOL_PREFIX = '-Dsymbol_prefix=""' - -ifeq "$(SYSTEM)" "macosx" -DEF_SYMBOL_PREFIX = '-Dsymbol_prefix="_"' -endif - -ifeq "$(SYSTEM)" "cygwin" -DEF_SYMBOL_PREFIX = '-Dsymbol_prefix="_"' -endif - -OCAMLOBJINFO=$(ROOTDIR)/compilerlibs/ocamlcommon.cma \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \ - $(ROOTDIR)/compilerlibs/ocamlmiddleend.cma \ - objinfo.cmo - -ocamlobjinfo$(EXE): $(OCAMLOBJINFO) -ocamlobjinfo.opt$(EXE): $(call byte2native, $(OCAMLOBJINFO)) - -PRIMREQ=$(ROOTDIR)/compilerlibs/ocamlcommon.cma \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \ - primreq.cmo - -# Scan object files for required primitives -primreq$(EXE): $(PRIMREQ) -primreq.opt$(EXE): $(call byte2native, $(PRIMREQ)) - -LINTAPIDIFF=$(ROOTDIR)/compilerlibs/ocamlcommon.cmxa \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cmxa \ - $(ROOTDIR)/compilerlibs/ocamlmiddleend.cmxa \ - $(ROOTDIR)/otherlibs/str/str.cmxa \ - lintapidiff.cmx - -lintapidiff.opt$(EXE): INCLUDES+= -I $(ROOTDIR)/otherlibs/str -lintapidiff.opt$(EXE): $(LINTAPIDIFF) - $(CAMLOPT_CMD) $(LINKFLAGS) -I $(ROOTDIR) -o $@ $(LINTAPIDIFF) -clean:: - rm -f -- lintapidiff.opt lintapidiff.opt.exe - rm -f lintapidiff.cm? lintapidiff.o lintapidiff.obj - -# Copy a bytecode executable, stripping debug info - -STRIPDEBUG=$(ROOTDIR)/compilerlibs/ocamlcommon.cma \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \ - stripdebug.cmo - -stripdebug$(EXE): $(STRIPDEBUG) -stripdebug.opt$(EXE): $(call byte2native, $(STRIPDEBUG)) - -# Compare two bytecode executables - -CMPBYT=$(ROOTDIR)/compilerlibs/ocamlcommon.cma \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \ - cmpbyt.cmo - -cmpbyt$(EXE): $(CMPBYT) -cmpbyt.opt$(EXE): $(call byte2native, $(CMPBYT)) - -ocamltex_files := \ - $(ROOTDIR)/compilerlibs/ocamlcommon.cma \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \ - $(ROOTDIR)/compilerlibs/ocamltoplevel.cma \ - $(ROOTDIR)/otherlibs/str/str.cma \ - $(ROOTDIR)/otherlibs/unix/unix.cma \ - ocamltex.ml - -# checkstack tool - -checkstack$(EXE): checkstack.$(O) - $(MKEXE) $(OUTPUTEXE)$@ $< - -#Scan latex files, and run ocaml code examples - -ocamltex := ocamltex$(EXE) - -# ocamltex uses str.cma and unix.cma and so must be compiled with -# $(ROOTDIR)/ocamlc not $(ROOTDIR)/boot/ocamlc since the boot -# compiler does not necessarily have the correct shared library -# configuration. -$(ocamltex): INCLUDES += $(addprefix -I $(ROOTDIR)/otherlibs/,str unix) -$(ocamltex): $(ocamltex_files) - $(OCAMLRUN) $(ROOTDIR)/ocamlc$(EXE) $(STDLIBFLAGS) \ - $(LINKFLAGS) -linkall -o $@ -no-alias-deps $^ - -# we need str and unix which depend on the bytecode version of other tools -# thus we use the othertools target -ifeq "$(build_ocamltex)" "true" -othertools: $(ocamltex) -endif -clean:: - rm -f -- ocamltex ocamltex.exe ocamltex.cm? - -# Common stuff - -%.cmo: %.ml - $(CAMLC) -c $(COMPFLAGS) - $< - -%.cmi: %.mli - $(CAMLC) -c $(COMPFLAGS) - $< - -%.cmx: %.ml - $(CAMLOPT) $(COMPFLAGS) -c - $< - -clean:: - rm -f *.cmo *.cmi *.cma *.dll *.so *.lib *.a - -OC_OCAMLDEPDIRS = $(DIRS) -depend: beforedepend - $(OCAMLDEP_CMD) *.mli *.ml > .depend - -.PHONY: clean distclean install beforedepend depend - -distclean: clean - rm -f eventlog_metadata *.bak - -include .depend diff --git a/tools/cmpbyt.ml b/tools/cmpbyt.ml index 983234fe31..75f9dacd47 100644 --- a/tools/cmpbyt.ml +++ b/tools/cmpbyt.ml @@ -79,9 +79,11 @@ let cmpbyt file1 file2 = close_in ic1; close_in ic2; res -let _ = +let main () = if Array.length Sys.argv <> 3 then begin eprintf "Usage: cmpbyt <file 1> <file 2>\n"; exit 2 end; if cmpbyt Sys.argv.(1) Sys.argv.(2) then exit 0 else exit 1 + +let _ = main () diff --git a/tools/cmpbyt.mli b/tools/cmpbyt.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/cmpbyt.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit diff --git a/tools/cvt_emit.mli b/tools/cvt_emit.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/cvt_emit.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit diff --git a/tools/cvt_emit.mll b/tools/cvt_emit.mll index d5ea331317..f6d83853e5 100644 --- a/tools/cvt_emit.mll +++ b/tools/cvt_emit.mll @@ -35,15 +35,15 @@ let print_unescaped_string s = done } -rule main = parse +rule lex = parse "`" { lexeme_beginning := Lexing.lexeme_start lexbuf; first_item := true; print_char '('; command lexbuf; print_char ')'; - main lexbuf } + lex lexbuf } | "\\`" - { print_string "`"; main lexbuf } + { print_string "`"; lex lexbuf } | '\t' { prerr_string "Invalid tab at character "; prerr_int (Lexing.lexeme_start lexbuf); prerr_newline(); @@ -52,7 +52,7 @@ rule main = parse print_char '"'; string lexbuf } | eof { () } - | _ { print_char(Lexing.lexeme_char lexbuf 0); main lexbuf } + | _ { print_char(Lexing.lexeme_char lexbuf 0); lex lexbuf } and command = parse "`" { () } @@ -88,7 +88,7 @@ and command = parse and string = parse | '"' { print_char '"'; - main lexbuf } + lex lexbuf } | '\\' _ | [^ '\\' '"' ]+ { print_string (Lexing.lexeme lexbuf); string lexbuf } @@ -98,7 +98,9 @@ and string = parse exit 2 } { -let _ = main(Lexing.from_channel stdin) +let main () = + lex (Lexing.from_channel stdin); + exit 0 -let _ = exit (0) +let _ = main () } diff --git a/tools/dumpobj.ml b/tools/dumpobj.ml index 01722ed9ca..621cac264f 100644 --- a/tools/dumpobj.ml +++ b/tools/dumpobj.ml @@ -577,7 +577,7 @@ let arg_fun filename = close_in ic; if !print_banners then printf "## end of ocaml dump of %S\n%!" filename -let main() = +let main () = Arg.parse_expand arg_list arg_fun arg_usage; exit 0 diff --git a/tools/dumpobj.mli b/tools/dumpobj.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/dumpobj.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit diff --git a/tools/lintapidiff.mli b/tools/lintapidiff.mli new file mode 100644 index 0000000000..0b1d333476 --- /dev/null +++ b/tools/lintapidiff.mli @@ -0,0 +1,17 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +(* lintapidiff.ml does not need to export any definition so here is + an empty interface *) diff --git a/tools/make_opcodes.mli b/tools/make_opcodes.mli new file mode 100644 index 0000000000..26b5aac33e --- /dev/null +++ b/tools/make_opcodes.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +(* make_opcodes.mll exports no definition so here is an empty interface *) diff --git a/tools/objinfo.ml b/tools/objinfo.ml index 31f8c31a62..1b723d2018 100644 --- a/tools/objinfo.ml +++ b/tools/objinfo.ml @@ -407,7 +407,7 @@ let arg_list = [ let arg_usage = Printf.sprintf "%s [OPTIONS] FILES : give information on files" Sys.argv.(0) -let main() = +let main () = Arg.parse_expand arg_list dump_obj arg_usage; exit 0 diff --git a/tools/objinfo.mli b/tools/objinfo.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/objinfo.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit diff --git a/tools/ocamlcmt.ml b/tools/ocamlcmt.ml index 359b28aa4b..399a2232dd 100644 --- a/tools/ocamlcmt.ml +++ b/tools/ocamlcmt.ml @@ -189,8 +189,7 @@ let main () = end ) arg_usage - -let () = +let main () = try main () with x -> @@ -198,3 +197,5 @@ let () = Location.report_exception Format.err_formatter x; Format.fprintf Format.err_formatter "@."; exit 2 + +let _ = main () diff --git a/tools/ocamlcmt.mli b/tools/ocamlcmt.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/ocamlcmt.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit diff --git a/tools/ocamlcp.mli b/tools/ocamlcp.mli new file mode 100644 index 0000000000..a87b25bf4a --- /dev/null +++ b/tools/ocamlcp.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +(* ocamlcp.ml contains no definition so here is an empty interface *) diff --git a/tools/ocamlcp_common.mli b/tools/ocamlcp_common.mli new file mode 100644 index 0000000000..2dacb6023f --- /dev/null +++ b/tools/ocamlcp_common.mli @@ -0,0 +1,55 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) +(* *) +(* Copyright 1998 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. *) +(* *) +(**************************************************************************) + +(* This module shares the definitions common to both ocamlcp and ocamloptp *) + +(* Arguments recognized by ocamlcp and ocamloptp *) +module type Ocamlcp_args = + sig + val _a : unit -> unit + val _impl : string -> unit + val _intf : string -> unit + val _pp : string -> unit + val _ppx : string -> unit + val anonymous : string -> unit + end + +(* Description of one profiler *) +module type OCAMLCP = + sig + val bytecode : bool + module Make_options : Ocamlcp_args -> Main_args.Arg_list + end + +(* Functor to build a profiler from its description *) +module Make : OCAMLCP -> + sig + val name : string + val make_archive : bool ref + val with_impl : bool ref + val with_intf : bool ref + val with_mli : bool ref + val with_ml : bool ref + val process_file : string -> unit + val usage : string + val incompatible : string -> 'a + module Options : Main_args.Arg_list + val rev_compargs : string list ref + val rev_profargs : string list ref + val add_profarg : string -> unit + val anon : string -> unit + val optlist : (string * Arg.spec * string) list + val main : unit -> 'a + end diff --git a/tools/ocamldep.mli b/tools/ocamldep.mli new file mode 100644 index 0000000000..d9876da3c1 --- /dev/null +++ b/tools/ocamldep.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +(* ocamldep.ml contains no definition so here is an empty interface *) diff --git a/tools/ocamlmklib.ml b/tools/ocamlmklib.ml index 8a81a451b1..f6bfa96de6 100644 --- a/tools/ocamlmklib.ml +++ b/tools/ocamlmklib.ml @@ -15,9 +15,6 @@ open Printf -let syslib x = - if Config.ccomp_type = "msvc" then x ^ ".lib" else "-l" ^ x - let mklib out files opts = if Config.ccomp_type = "msvc" then let machine = @@ -61,7 +58,6 @@ let starts_with s pref = let ends_with = Filename.check_suffix let chop_prefix s pref = String.sub s (String.length pref) (String.length s - String.length pref) -let chop_suffix = Filename.chop_suffix exception Bad_argument of string @@ -342,7 +338,7 @@ let build_libs () = (String.concat " " (prefix_list "-cclib " !c_libs)) (String.concat " " !caml_libs)) -let _ = +let main () = try parse_arguments Sys.argv; build_libs() @@ -355,3 +351,5 @@ let _ = prerr_string "System error: "; prerr_endline s; exit 4 | x -> raise x + +let _ = main () diff --git a/tools/ocamlmklib.mli b/tools/ocamlmklib.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/ocamlmklib.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit diff --git a/tools/ocamlmktop.ml b/tools/ocamlmktop.ml index d47fa24a2e..78fbeacdfe 100644 --- a/tools/ocamlmktop.ml +++ b/tools/ocamlmktop.ml @@ -13,7 +13,7 @@ (* *) (**************************************************************************) -let _ = +let main () = let args = Ccomp.quote_files (List.tl (Array.to_list Sys.argv)) in let ocamlmktop = Sys.executable_name in (* On Windows Sys.command calls system() which in turn calls 'cmd.exe /c'. @@ -31,3 +31,5 @@ let _ = extra_quote in exit(Sys.command cmdline) + +let _ = main () diff --git a/tools/ocamlmktop.mli b/tools/ocamlmktop.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/ocamlmktop.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit diff --git a/tools/ocamloptp.mli b/tools/ocamloptp.mli new file mode 100644 index 0000000000..d5f6f7fe93 --- /dev/null +++ b/tools/ocamloptp.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +(* ocamloptp.ml contains no definition so here is an empty interface *) diff --git a/tools/ocamlprof.mli b/tools/ocamlprof.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/ocamlprof.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit diff --git a/tools/ocamltex.ml b/tools/ocamltex.ml index e6b2c8cd0d..4e7cecfe01 100644 --- a/tools/ocamltex.ml +++ b/tools/ocamltex.ml @@ -209,13 +209,13 @@ module Toplevel = struct try match mode with | Toplevel -> Parse.toplevel_phrase lex - | Verbatim -> Ptop_def (Parse.implementation lex) + | Verbatim -> Parsetree.Ptop_def (Parse.implementation lex) | Signature -> let sign = Parse.interface lex in let name = Location.mknoloc "wrap" in let str = Ast_helper.[Str.modtype @@ Mtd.mk ~typ:(Mty.signature sign) name] in - Ptop_def str + Parsetree.Ptop_def str with | Lexer.Error _ | Syntaxerr.Error _ -> raise (Phrase_parsing s) @@ -421,8 +421,6 @@ module Text_transform = struct | Ellipsis -> Format.fprintf ppf "ellipsis" let underline start stop = { kind = Underline; start; stop} - let ellipsis start stop = { kind = Ellipsis; start; stop } - let escape_specials s = s |> global_replace ~!{|\$|} {|$\textdollar$|} @@ -560,7 +558,8 @@ module Ellipsis = struct | None -> raise (Unmatched_ellipsis {kind="right"; start; stop}) | Some (start', stop' ) -> let start, stop = min start start', max stop stop' in - transforms := {kind=Ellipsis; start ; stop } :: !transforms; + let transform = {Text_transform.kind=Ellipsis; start ; stop } in + transforms := transform :: !transforms; left_mark := None end | _ -> () @@ -575,7 +574,7 @@ module Ellipsis = struct let find = function | Parsetree.Ptop_def ast -> extract (fun it -> it.structure it) ast - | Ptop_dir _ -> [] + | Parsetree.Ptop_dir _ -> [] end diff --git a/tools/ocamltex.mli b/tools/ocamltex.mli new file mode 100644 index 0000000000..68cf6b376a --- /dev/null +++ b/tools/ocamltex.mli @@ -0,0 +1,17 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +(* ocamltex.ml does not need to export any definition so here is + an empty interface *) diff --git a/tools/opnames.mli b/tools/opnames.mli new file mode 100644 index 0000000000..6165d4eab0 --- /dev/null +++ b/tools/opnames.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val names_of_instructions : string array diff --git a/tools/primreq.ml b/tools/primreq.ml index 04832ad8c3..3b6686a9b4 100644 --- a/tools/primreq.ml +++ b/tools/primreq.ml @@ -67,7 +67,7 @@ let exclude filename = with End_of_file -> close_in ic | x -> close_in ic; raise x -let main() = +let main () = Arg.parse_expand ["-used", Arg.Unit(fun () -> used := true; defined := false), "show primitives referenced in the object files"; diff --git a/tools/primreq.mli b/tools/primreq.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/primreq.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit diff --git a/tools/stripdebug.ml b/tools/stripdebug.ml index 5f2d2eede0..d7998fe91e 100644 --- a/tools/stripdebug.ml +++ b/tools/stripdebug.ml @@ -48,10 +48,12 @@ let stripdebug infile outfile = close_in ic; close_out oc -let _ = +let main () = if Array.length Sys.argv = 3 then stripdebug Sys.argv.(1) Sys.argv.(2) else begin eprintf "Usage: stripdebug <source file> <destination file>\n"; exit 2 end + +let _ = main () diff --git a/tools/stripdebug.mli b/tools/stripdebug.mli new file mode 100644 index 0000000000..f3cd0e2dd4 --- /dev/null +++ b/tools/stripdebug.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides, Paris *) +(* *) +(* Copyright 2022 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. *) +(* *) +(**************************************************************************) + +val main : unit -> unit |