2017-07-21 07:43:36 -07:00
|
|
|
#**************************************************************************
|
|
|
|
#* *
|
|
|
|
#* OCaml *
|
|
|
|
#* *
|
|
|
|
#* Sebastien Hinderer, projet Gallium, INRIA Paris *
|
|
|
|
#* *
|
|
|
|
#* Copyright 2016 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. *
|
|
|
|
#* *
|
|
|
|
#**************************************************************************
|
|
|
|
|
|
|
|
# The Makefile for ocamltest
|
|
|
|
|
2018-07-27 03:35:09 -07:00
|
|
|
ROOTDIR = ..
|
2018-07-26 08:20:39 -07:00
|
|
|
|
2020-04-17 05:53:49 -07:00
|
|
|
-include $(ROOTDIR)/Makefile.build_config
|
|
|
|
include $(ROOTDIR)/Makefile.common
|
2019-07-28 02:19:02 -07:00
|
|
|
include $(ROOTDIR)/Makefile.best_binaries
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2018-09-19 03:44:17 -07:00
|
|
|
ifeq "$(filter str,$(OTHERLIBRARIES))" ""
|
|
|
|
str := false
|
|
|
|
else
|
|
|
|
str := true
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq "$(filter systhreads,$(OTHERLIBRARIES))" ""
|
|
|
|
systhreads := false
|
|
|
|
else
|
|
|
|
systhreads := true
|
|
|
|
endif
|
|
|
|
|
2018-09-19 03:41:59 -07:00
|
|
|
ifeq "$(filter $(UNIXLIB),$(OTHERLIBRARIES))" ""
|
|
|
|
unix := None
|
|
|
|
else
|
|
|
|
ifeq "$(UNIX_OR_WIN32)" "win32"
|
|
|
|
unix := Some false
|
|
|
|
else
|
|
|
|
unix := Some true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-07-21 07:43:36 -07:00
|
|
|
ifeq "$(UNIX_OR_WIN32)" "win32"
|
2017-11-03 10:52:11 -07:00
|
|
|
ocamlsrcdir := $(shell echo "$(abspath $(shell pwd)/..)"|cygpath -w -f - \
|
|
|
|
| sed 's/\\/\\\\\\\\/g')
|
2018-06-20 04:39:09 -07:00
|
|
|
mkexe := $(MKEXE_ANSI) -link $(OC_LDFLAGS)
|
2017-07-21 07:43:36 -07:00
|
|
|
else
|
|
|
|
ocamlsrcdir := $(abspath $(shell pwd)/..)
|
2018-04-20 05:49:35 -07:00
|
|
|
mkexe := $(MKEXE)
|
2017-07-21 07:43:36 -07:00
|
|
|
endif
|
|
|
|
|
2017-11-30 06:46:39 -08:00
|
|
|
ifeq "$(TOOLCHAIN)" "msvc"
|
2019-03-21 10:12:43 -07:00
|
|
|
CPP := $(CPP) 2> nul
|
2018-04-17 09:57:05 -07:00
|
|
|
CSC := csc
|
2018-11-07 05:28:51 -08:00
|
|
|
ifeq "$(HOST)" "i686-pc-windows"
|
2018-04-17 09:57:05 -07:00
|
|
|
CSCFLAGS := /platform:x86
|
|
|
|
else
|
|
|
|
CSCFLAGS :=
|
|
|
|
endif
|
|
|
|
CSCFLAGS += /nologo /nowarn:1668
|
|
|
|
else
|
|
|
|
CSC :=
|
|
|
|
CSCFLAGS :=
|
2017-11-30 06:46:39 -08:00
|
|
|
endif
|
|
|
|
|
2018-03-15 23:56:35 -07:00
|
|
|
ifeq "$(WITH_OCAMLDOC)" "ocamldoc"
|
|
|
|
WITH_OCAMLDOC := true
|
|
|
|
else
|
|
|
|
WITH_OCAMLDOC := false
|
|
|
|
endif
|
|
|
|
|
2018-03-16 00:25:17 -07:00
|
|
|
ifeq "$(WITH_DEBUGGER)" "ocamldebugger"
|
|
|
|
WITH_OCAMLDEBUG := true
|
|
|
|
else
|
|
|
|
WITH_OCAMLDEBUG := false
|
|
|
|
endif
|
|
|
|
|
2018-07-26 08:20:39 -07:00
|
|
|
OC_CPPFLAGS += -I$(ROOTDIR)/runtime -DCAML_INTERNALS
|
2017-07-21 07:43:36 -07:00
|
|
|
|
|
|
|
run := run_$(UNIX_OR_WIN32)
|
|
|
|
|
|
|
|
# List of source files from which ocamltest is compiled
|
|
|
|
# (all the different sorts of files are derived from this)
|
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
# ocamltest has two components: its core and the OCaml "plugin"
|
|
|
|
# which is actually built into the tool but clearly separated from its core
|
|
|
|
|
|
|
|
core := \
|
2017-07-21 07:43:36 -07:00
|
|
|
$(run).c \
|
|
|
|
run_stubs.c \
|
2018-03-09 14:12:36 -08:00
|
|
|
ocamltest_stdlib_stubs.c \
|
2017-07-21 07:43:36 -07:00
|
|
|
ocamltest_config.mli ocamltest_config.ml.in \
|
2017-11-03 10:52:11 -07:00
|
|
|
ocamltest_stdlib.mli ocamltest_stdlib.ml \
|
2017-07-21 07:43:36 -07:00
|
|
|
run_command.mli run_command.ml \
|
|
|
|
filecompare.mli filecompare.ml \
|
|
|
|
variables.mli variables.ml \
|
2019-06-05 07:17:29 -07:00
|
|
|
environments.mli environments.ml \
|
2018-02-04 10:27:15 -08:00
|
|
|
result.mli result.ml \
|
2017-07-21 07:43:36 -07:00
|
|
|
actions.mli actions.ml \
|
|
|
|
tests.mli tests.ml \
|
2019-06-05 08:24:11 -07:00
|
|
|
strace.mli strace.ml \
|
2017-07-21 07:43:36 -07:00
|
|
|
tsl_ast.mli tsl_ast.ml \
|
|
|
|
tsl_parser.mly \
|
|
|
|
tsl_lexer.mli tsl_lexer.mll \
|
2019-06-05 07:17:29 -07:00
|
|
|
modifier_parser.mli modifier_parser.ml \
|
2017-07-21 07:43:36 -07:00
|
|
|
tsl_semantics.mli tsl_semantics.ml \
|
2017-11-03 10:52:11 -07:00
|
|
|
builtin_variables.mli builtin_variables.ml \
|
|
|
|
actions_helpers.mli actions_helpers.ml \
|
|
|
|
builtin_actions.mli builtin_actions.ml
|
|
|
|
|
|
|
|
ocaml_plugin := \
|
|
|
|
ocaml_backends.mli ocaml_backends.ml \
|
2018-02-07 08:58:44 -08:00
|
|
|
ocaml_filetypes.mli ocaml_filetypes.ml \
|
2017-11-03 10:52:11 -07:00
|
|
|
ocaml_variables.mli ocaml_variables.ml \
|
|
|
|
ocaml_modifiers.mli ocaml_modifiers.ml \
|
2018-01-27 07:10:27 -08:00
|
|
|
ocaml_directories.mli ocaml_directories.ml \
|
2018-01-27 06:03:27 -08:00
|
|
|
ocaml_files.mli ocaml_files.ml \
|
2018-01-27 07:32:15 -08:00
|
|
|
ocaml_flags.mli ocaml_flags.ml \
|
2018-01-27 08:02:28 -08:00
|
|
|
ocaml_commands.mli ocaml_commands.ml \
|
2018-02-26 07:49:24 -08:00
|
|
|
ocaml_tools.mli ocaml_tools.ml \
|
2018-01-27 08:08:23 -08:00
|
|
|
ocaml_compilers.mli ocaml_compilers.ml \
|
2018-02-27 01:12:17 -08:00
|
|
|
ocaml_toplevels.mli ocaml_toplevels.ml \
|
2017-11-03 10:52:11 -07:00
|
|
|
ocaml_actions.mli ocaml_actions.ml \
|
|
|
|
ocaml_tests.mli ocaml_tests.ml
|
|
|
|
|
|
|
|
sources := $(core) $(ocaml_plugin) \
|
2017-07-21 07:43:36 -07:00
|
|
|
options.mli options.ml \
|
|
|
|
main.mli main.ml
|
|
|
|
|
|
|
|
# List of .ml files used for ocamldep and to get the list of modules
|
|
|
|
|
|
|
|
ml_files := \
|
|
|
|
$(filter %.ml, \
|
|
|
|
$(subst .ml.in,.ml,$(subst .mll,.ml,$(subst .mly,.ml,$(sources)))) \
|
|
|
|
)
|
|
|
|
|
|
|
|
cmo_files := $(ml_files:.ml=.cmo)
|
|
|
|
|
|
|
|
cmx_files := $(ml_files:.ml=.cmx)
|
|
|
|
|
|
|
|
ocaml_objects := $(ml_files:.ml=.$(O))
|
|
|
|
|
|
|
|
# List of .mli files for ocamldep
|
|
|
|
mli_files := \
|
|
|
|
$(filter %.mli,$(subst .mly,.mli,$(sources)))
|
|
|
|
|
|
|
|
cmi_files := $(mli_files:.mli=.cmi)
|
|
|
|
|
|
|
|
c_files := $(filter %.c, $(sources))
|
|
|
|
|
|
|
|
o_files := $(c_files:.c=.$(O))
|
|
|
|
|
|
|
|
lexers := $(filter %.mll,$(sources))
|
|
|
|
|
|
|
|
parsers := $(filter %.mly,$(sources))
|
|
|
|
|
|
|
|
config_files := $(filter %.ml.in,$(sources))
|
|
|
|
|
|
|
|
dependencies_generated_prereqs := \
|
|
|
|
$(config_files:.ml.in=.ml) \
|
|
|
|
$(lexers:.mll=.ml) \
|
|
|
|
$(parsers:.mly=.mli) $(parsers:.mly=.ml)
|
|
|
|
|
|
|
|
generated := $(dependencies_generated_prereqs) $(parsers:.mly=.output)
|
|
|
|
|
|
|
|
bytecode_modules := $(o_files) $(cmo_files)
|
|
|
|
|
|
|
|
native_modules := $(o_files) $(cmx_files)
|
|
|
|
|
2018-11-23 03:47:40 -08:00
|
|
|
directories := $(addprefix $(ROOTDIR)/,utils bytecomp parsing stdlib \
|
2019-04-01 09:18:47 -07:00
|
|
|
compilerlibs file_formats)
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2018-03-14 05:15:27 -07:00
|
|
|
include_directories := $(addprefix -I , $(directories))
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2018-03-14 05:15:27 -07:00
|
|
|
flags := -g -nostdlib $(include_directories) \
|
2017-07-21 07:43:36 -07:00
|
|
|
-strict-sequence -safe-string -strict-formats \
|
|
|
|
-w +a-4-9-41-42-44-45-48 -warn-error A
|
|
|
|
|
2019-07-28 02:19:02 -07:00
|
|
|
ocamlc := $(BEST_OCAMLC) $(flags)
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2019-07-28 02:19:02 -07:00
|
|
|
ocamlopt := $(BEST_OCAMLOPT) $(flags)
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2019-07-28 02:19:02 -07:00
|
|
|
ocamldep := $(BEST_OCAMLDEP)
|
2018-12-08 07:19:06 -08:00
|
|
|
depflags := -slash
|
|
|
|
depincludes :=
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2019-07-28 02:19:02 -07:00
|
|
|
ocamllex := $(BEST_OCAMLLEX)
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2018-07-26 08:20:39 -07:00
|
|
|
ocamlyacc := $(ROOTDIR)/yacc/ocamlyacc
|
2017-07-21 07:43:36 -07:00
|
|
|
|
|
|
|
ocamlcdefaultflags :=
|
|
|
|
|
|
|
|
ocamloptdefaultflags := $(shell ./getocamloptdefaultflags $(TARGET))
|
|
|
|
|
2019-01-21 06:16:54 -08:00
|
|
|
.SECONDARY: $(lexers:.mll=.ml) $(parsers:.mly=.mli) $(parsers:.mly=.ml)
|
|
|
|
|
2018-06-03 00:08:20 -07:00
|
|
|
.PHONY: all allopt opt.opt # allopt and opt.opt are synonyms
|
|
|
|
all: ocamltest$(EXE)
|
|
|
|
allopt: ocamltest.opt$(EXE)
|
|
|
|
opt.opt: allopt
|
|
|
|
|
2020-01-04 06:05:33 -08:00
|
|
|
compdeps_names=ocamlcommon ocamlbytecomp
|
|
|
|
compdeps_paths=$(addprefix $(ROOTDIR)/compilerlibs/,$(compdeps_names))
|
|
|
|
compdeps_byte=$(addsuffix .cma,$(compdeps_paths))
|
|
|
|
compdeps_opt=$(addsuffix .cmxa,$(compdeps_paths))
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2020-01-04 06:05:33 -08:00
|
|
|
ocamltest$(EXE): $(compdeps_byte) $(bytecode_modules)
|
|
|
|
$(ocamlc_cmd) -custom -o $@ $^
|
|
|
|
|
|
|
|
%.cmo: %.ml $(compdeps_byte)
|
2017-07-21 07:43:36 -07:00
|
|
|
$(ocamlc) -c $<
|
|
|
|
|
2020-01-04 06:05:33 -08:00
|
|
|
ocamltest.opt$(EXE): $(compdeps_opt) $(native_modules)
|
|
|
|
$(ocamlopt_cmd) -o $@ $^
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2020-01-04 06:05:33 -08:00
|
|
|
%.cmx: %.ml $(compdeps_opt)
|
2017-07-21 07:43:36 -07:00
|
|
|
$(ocamlopt) -c $<
|
|
|
|
|
2020-01-04 06:05:33 -08:00
|
|
|
%.cmi: %.mli $(compdeps_byte)
|
2017-07-21 07:43:36 -07:00
|
|
|
$(ocamlc) -c $<
|
|
|
|
|
|
|
|
%.ml %.mli: %.mly
|
|
|
|
$(ocamlyacc) $<
|
|
|
|
|
|
|
|
%.ml: %.mll
|
2019-05-07 02:32:05 -07:00
|
|
|
$(ocamllex) $(OCAMLLEX_FLAGS) $<
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2019-01-15 01:22:12 -08:00
|
|
|
ocamltest_config.ml: ocamltest_config.ml.in Makefile ../Makefile.config
|
2017-07-21 07:43:36 -07:00
|
|
|
sed \
|
2018-02-14 01:48:59 -08:00
|
|
|
-e 's|@@AFL_INSTRUMENT@@|$(AFL_INSTRUMENT)|' \
|
2019-11-15 04:52:35 -08:00
|
|
|
-e 's|@@RUNTIMEI@@|$(RUNTIMEI)|' \
|
2017-09-22 01:08:56 -07:00
|
|
|
-e 's|@@ARCH@@|$(ARCH)|' \
|
2018-01-22 07:38:44 -08:00
|
|
|
-e 's|@@SHARED_LIBRARIES@@|$(SUPPORTS_SHARED_LIBRARIES)|' \
|
2017-10-09 04:51:25 -07:00
|
|
|
-e 's|@@UNIX@@|$(unix)|' \
|
2018-09-19 03:44:17 -07:00
|
|
|
-e 's|@@SYSTHREADS@@|$(systhreads)|' \
|
|
|
|
-e 's|@@STR@@|$(str)|' \
|
2018-02-05 05:48:56 -08:00
|
|
|
-e 's|@@SYSTEM@@|$(SYSTEM)|' \
|
2019-03-21 10:12:43 -07:00
|
|
|
-e 's|@@CPP@@|$(CPP)|' \
|
2017-07-21 07:43:36 -07:00
|
|
|
-e 's|@@OCAMLCDEFAULTFLAGS@@|$(ocamlcdefaultflags)|' \
|
|
|
|
-e 's|@@OCAMLOPTDEFAULTFLAGS@@|$(ocamloptdefaultflags)|' \
|
|
|
|
-e 's|@@OCAMLSRCDIR@@|$(ocamlsrcdir)|' \
|
|
|
|
-e 's|@@FLAMBDA@@|$(FLAMBDA)|' \
|
2018-02-08 02:55:56 -08:00
|
|
|
-e 's|@@SPACETIME@@|$(WITH_SPACETIME)|' \
|
2017-10-02 04:41:33 -07:00
|
|
|
-e 's|@@FORCE_SAFE_STRING@@|$(FORCE_SAFE_STRING)|' \
|
2017-12-08 08:47:50 -08:00
|
|
|
-e 's|@@FLAT_FLOAT_ARRAY@@|$(FLAT_FLOAT_ARRAY)|' \
|
2018-03-05 02:09:57 -08:00
|
|
|
-e 's|@@OCAMLDOC@@|$(WITH_OCAMLDOC)|' \
|
2018-03-16 00:25:17 -07:00
|
|
|
-e 's|@@OCAMLDEBUG@@|$(WITH_OCAMLDEBUG)|' \
|
2018-04-10 09:24:07 -07:00
|
|
|
-e 's|@@OBJEXT@@|$(O)|' \
|
2019-09-13 04:01:31 -07:00
|
|
|
-e 's|@@ASMEXT@@|$(S)|' \
|
2018-04-12 00:58:19 -07:00
|
|
|
-e 's|@@NATIVE_DYNLINK@@|$(NATDYNLINK)|' \
|
2018-06-20 04:39:09 -07:00
|
|
|
-e 's|@@SHARED_LIBRARY_CFLAGS@@|$(SHAREDLIB_CFLAGS)|' \
|
2018-04-16 07:42:12 -07:00
|
|
|
-e 's|@@SHAREDOBJEXT@@|$(SO)|' \
|
2018-04-17 09:57:05 -07:00
|
|
|
-e 's|@@CSC@@|$(CSC)|' \
|
|
|
|
-e 's|@@CSCFLAGS@@|$(CSCFLAGS)|' \
|
2018-04-18 09:25:03 -07:00
|
|
|
-e 's|@@MKDLL@@|$(MKDLL)|' \
|
2018-04-20 05:49:35 -07:00
|
|
|
-e 's|@@MKEXE@@|$(mkexe)|' \
|
2018-04-18 09:25:03 -07:00
|
|
|
-e 's|@@BYTECCLIBS@@|$(BYTECCLIBS)|' \
|
|
|
|
-e 's|@@NATIVECCLIBS@@|$(NATIVECCLIBS)|' \
|
2018-04-27 02:09:48 -07:00
|
|
|
-e 's|@@ASM@@|$(ASM)|' \
|
|
|
|
-e 's|@@CC@@|$(CC)|' \
|
2018-06-20 04:39:09 -07:00
|
|
|
-e 's|@@CFLAGS@@|$(OC_CFLAGS)|' \
|
2018-04-27 02:09:48 -07:00
|
|
|
-e 's|@@CCOMPTYPE@@|$(CCOMPTYPE)|' \
|
2018-04-19 01:12:22 -07:00
|
|
|
-e 's|@@WINDOWS_UNICODE@@|$(WINDOWS_UNICODE)|' \
|
2019-06-26 03:28:58 -07:00
|
|
|
-e 's|@@FUNCTION_SECTIONS@@|$(FUNCTION_SECTIONS)|' \
|
2017-07-21 07:43:36 -07:00
|
|
|
$< > $@
|
|
|
|
|
2019-11-28 08:35:53 -08:00
|
|
|
# Manual
|
|
|
|
|
|
|
|
.PHONY: doc
|
|
|
|
|
|
|
|
doc: ocamltest.html
|
|
|
|
|
|
|
|
ocamltest.html: ocamltest.org
|
|
|
|
pandoc -s --toc -N -f org -t html -o $@ $<
|
|
|
|
|
2017-07-21 07:43:36 -07:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2019-10-15 03:46:36 -07:00
|
|
|
rm -rf ocamltest ocamltest.exe ocamltest.opt ocamltest.opt.exe
|
|
|
|
rm -rf $(c_files:.c=.o) $(c_files:.c=.obj)
|
|
|
|
rm -rf run_unix.o run_win32.o run_win32.obj
|
|
|
|
rm -rf $(ml_files:.ml=.o) $(ml_files:.ml=.obj)
|
2017-07-21 07:43:36 -07:00
|
|
|
rm -rf $(cmi_files)
|
|
|
|
rm -rf $(cmo_files)
|
|
|
|
rm -rf $(cmx_files)
|
|
|
|
rm -rf $(generated)
|
2019-11-28 08:35:53 -08:00
|
|
|
rm -f ocamltest.html
|
2020-04-17 06:11:22 -07:00
|
|
|
rm -rf $(DEPDIR)
|
|
|
|
|
|
|
|
ifeq "$(COMPUTE_DEPS)" "true"
|
|
|
|
include $(addprefix $(DEPDIR)/, $(c_files:.c=.$(D)))
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(DEPDIR)/%.$(D): %.c | $(DEPDIR)
|
|
|
|
$(DEP_CC) $(OC_CPPFLAGS) $< -MT '$*.$(O)' -MF $@
|
2017-07-21 07:43:36 -07:00
|
|
|
|
|
|
|
.PHONY: depend
|
|
|
|
depend: $(dependencies_generated_prereqs)
|
2018-12-08 07:19:06 -08:00
|
|
|
$(ocamldep) $(depflags) $(depincludes) $(mli_files) $(ml_files) \
|
2020-04-17 06:11:22 -07:00
|
|
|
> .depend
|
2017-07-21 07:43:36 -07:00
|
|
|
|
|
|
|
-include .depend
|