2018-10-10 08:16:00 -07:00
|
|
|
#**************************************************************************
|
|
|
|
#* *
|
|
|
|
#* 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. *
|
|
|
|
#* *
|
|
|
|
#**************************************************************************
|
|
|
|
|
|
|
|
# The Makefile for generating the configuration file
|
|
|
|
|
|
|
|
ROOTDIR = ..
|
|
|
|
|
2020-02-05 09:29:43 -08:00
|
|
|
include $(ROOTDIR)/Makefile.common
|
2018-10-10 08:16:00 -07:00
|
|
|
|
2019-02-28 02:21:52 -08:00
|
|
|
ifeq "$(UNIX_OR_WIN32)" "win32"
|
|
|
|
ifeq "$(wildcard $(ROOTDIR)/flexdll/Makefile)" ""
|
|
|
|
FLEXDLL_DIR =
|
|
|
|
else
|
|
|
|
FLEXDLL_DIR = $(if $(wildcard $(ROOTDIR)/flexdll/flexdll_*.$(O)),+flexdll)
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
FLEXDLL_DIR =
|
|
|
|
endif
|
|
|
|
|
2019-04-28 01:19:15 -07:00
|
|
|
FLEXLINK_FLAGS ?=
|
|
|
|
|
2020-02-05 09:29:43 -08:00
|
|
|
# SUBST_QUOTE does the same as SUBST_STRING, adding OCaml quotes around
|
|
|
|
# non-empty strings (see FLEXDLL_DIR which must empty if FLEXDLL_DIR is empty
|
|
|
|
# but an OCaml string otherwise)
|
2019-04-28 01:19:15 -07:00
|
|
|
SUBST_QUOTE2=\
|
|
|
|
-e 's!%%$1%%!$(if $2,$(call SED_ESCAPE,"$(call OCAML_ESCAPE,$2)"))!'
|
|
|
|
SUBST_QUOTE=$(call SUBST_QUOTE2,$1,$($1))
|
|
|
|
|
2018-10-10 08:16:00 -07:00
|
|
|
FLEXLINK_LDFLAGS=$(if $(OC_LDFLAGS), -link "$(OC_LDFLAGS)")
|
2019-04-28 01:19:15 -07:00
|
|
|
|
2018-10-11 07:17:19 -07:00
|
|
|
config.ml: config.mlp $(ROOTDIR)/Makefile.config Makefile
|
2018-10-10 08:16:00 -07:00
|
|
|
sed $(call SUBST,AFL_INSTRUMENT) \
|
|
|
|
$(call SUBST,ARCH) \
|
2019-04-28 01:19:15 -07:00
|
|
|
$(call SUBST_STRING,ARCMD) \
|
|
|
|
$(call SUBST_STRING,ASM) \
|
2018-10-10 08:16:00 -07:00
|
|
|
$(call SUBST,ASM_CFI_SUPPORTED) \
|
2019-04-28 01:19:15 -07:00
|
|
|
$(call SUBST_STRING,BYTECCLIBS) \
|
|
|
|
$(call SUBST_STRING,CC) \
|
|
|
|
$(call SUBST_STRING,CCOMPTYPE) \
|
|
|
|
$(call SUBST_STRING,OUTPUTOBJ) \
|
|
|
|
$(call SUBST_STRING,EXT_ASM) \
|
|
|
|
$(call SUBST_STRING,EXT_DLL) \
|
|
|
|
$(call SUBST_STRING,EXE) \
|
|
|
|
$(call SUBST_STRING,EXT_LIB) \
|
|
|
|
$(call SUBST_STRING,EXT_OBJ) \
|
2018-10-10 08:16:00 -07:00
|
|
|
$(call SUBST,FLAMBDA) \
|
|
|
|
$(call SUBST,WITH_FLAMBDA_INVARIANTS) \
|
2019-04-28 01:19:15 -07:00
|
|
|
$(call SUBST_STRING,FLEXLINK_FLAGS) \
|
2018-10-10 08:16:00 -07:00
|
|
|
$(call SUBST_QUOTE,FLEXDLL_DIR) \
|
|
|
|
$(call SUBST,HOST) \
|
2019-04-28 01:19:15 -07:00
|
|
|
$(call SUBST_STRING,LIBDIR) \
|
|
|
|
$(call SUBST_STRING,MKDLL) \
|
|
|
|
$(call SUBST_STRING,MKEXE) \
|
|
|
|
$(call SUBST_STRING,FLEXLINK_LDFLAGS) \
|
|
|
|
$(call SUBST_STRING,MKMAINDLL) \
|
2018-10-10 08:16:00 -07:00
|
|
|
$(call SUBST,MODEL) \
|
2019-04-28 01:19:15 -07:00
|
|
|
$(call SUBST_STRING,NATIVECCLIBS) \
|
|
|
|
$(call SUBST_STRING,OCAMLC_CFLAGS) \
|
|
|
|
$(call SUBST_STRING,OCAMLC_CPPFLAGS) \
|
|
|
|
$(call SUBST_STRING,OCAMLOPT_CFLAGS) \
|
|
|
|
$(call SUBST_STRING,OCAMLOPT_CPPFLAGS) \
|
|
|
|
$(call SUBST_STRING,PACKLD) \
|
2018-10-10 08:16:00 -07:00
|
|
|
$(call SUBST,PROFINFO_WIDTH) \
|
2019-04-28 01:19:15 -07:00
|
|
|
$(call SUBST_STRING,RANLIBCMD) \
|
2018-10-10 08:16:00 -07:00
|
|
|
$(call SUBST,FORCE_SAFE_STRING) \
|
|
|
|
$(call SUBST,DEFAULT_SAFE_STRING) \
|
|
|
|
$(call SUBST,WINDOWS_UNICODE) \
|
|
|
|
$(call SUBST,SUPPORTS_SHARED_LIBRARIES) \
|
|
|
|
$(call SUBST,SYSTEM) \
|
|
|
|
$(call SUBST,SYSTHREAD_SUPPORT) \
|
|
|
|
$(call SUBST,TARGET) \
|
|
|
|
$(call SUBST,WITH_FRAME_POINTERS) \
|
|
|
|
$(call SUBST,WITH_PROFINFO) \
|
|
|
|
$(call SUBST,FLAT_FLOAT_ARRAY) \
|
2019-02-20 10:46:43 -08:00
|
|
|
$(call SUBST,FUNCTION_SECTIONS) \
|
2018-10-10 08:16:00 -07:00
|
|
|
$(call SUBST,CC_HAS_DEBUG_PREFIX_MAP) \
|
|
|
|
$(call SUBST,AS_HAS_DEBUG_PREFIX_MAP) \
|
|
|
|
$< > $@
|
2019-04-28 01:19:15 -07:00
|
|
|
|
|
|
|
# Test for the substitution functions above
|
|
|
|
|
|
|
|
ALLCHARS= \
|
|
|
|
!"\#\$\%&'()*+,-./ \
|
|
|
|
0123456789:;<=>? \
|
|
|
|
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ \
|
|
|
|
`abcdefghijklmnopqrstuvwxyz{|}~
|
|
|
|
|
|
|
|
TMPFILE=testdata.tmp
|
|
|
|
TMPSCRIPT=ocamlscript.tmp
|
|
|
|
|
|
|
|
test-subst:
|
|
|
|
$(file >$(TMPFILE),$(ALLCHARS))
|
|
|
|
echo '%%ALLCHARS%%' | sed $(call SUBST,ALLCHARS) | cmp $(TMPFILE) -
|
|
|
|
@rm $(TMPFILE)
|
|
|
|
@echo "Test passed"
|
|
|
|
|
|
|
|
# This test assumes there is a working OCaml in the path
|
|
|
|
|
|
|
|
test-subst-string:
|
|
|
|
$(file >$(TMPFILE),$(ALLCHARS))
|
|
|
|
echo 'print_string "%%ALLCHARS%%"; print_newline();;' \
|
|
|
|
| sed $(call SUBST_STRING,ALLCHARS) > $(TMPSCRIPT) && \
|
|
|
|
ocaml $(TMPSCRIPT) | cmp $(TMPFILE) -
|
|
|
|
@rm $(TMPFILE) $(TMPSCRIPT)
|
|
|
|
@echo "Test passed"
|