forked from ocaml-flambda/flambda-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
130 lines (114 loc) · 4.68 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#**************************************************************************
#* *
#* 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 = ..
include $(ROOTDIR)/Makefile.common
domainstate.ml: domainstate.ml.c ../runtime/caml/domain_state.tbl
$(CPP) -I ../runtime/caml $< > $@
domainstate.mli: domainstate.mli.c ../runtime/caml/domain_state.tbl
$(CPP) -I ../runtime/caml $< > $@
ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false"
FLEXDLL_DIR =
else
FLEXDLL_DIR = +flexdll
endif
FLEXLINK_FLAGS ?=
# 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)
SUBST_QUOTE2=\
-e 's!%%$1%%!$(if $2,$(call SED_ESCAPE,"$(call OCAML_ESCAPE,$2)"))!'
SUBST_QUOTE=$(call SUBST_QUOTE2,$1,$($1))
FLEXLINK_LDFLAGS=$(if $(OC_LDFLAGS), -link "$(OC_LDFLAGS)")
FLEXLINK_DLL_LDFLAGS=$(if $(OC_DLL_LDFLAGS), -link "$(OC_DLL_LDFLAGS)")
config.ml: config.mlp $(ROOTDIR)/Makefile.config Makefile
sed $(call SUBST,AFL_INSTRUMENT) \
$(call SUBST,ARCH) \
$(call SUBST_STRING,ARCMD) \
$(call SUBST_STRING,ASM) \
$(call SUBST,ASM_CFI_SUPPORTED) \
$(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) \
$(call SUBST,FLAMBDA) \
$(call SUBST,FLAMBDA2) \
$(call SUBST,WITH_FLAMBDA_INVARIANTS) \
$(call SUBST,WITH_CMM_INVARIANTS) \
$(call SUBST_STRING,FLEXLINK_FLAGS) \
$(call SUBST_QUOTE,FLEXDLL_DIR) \
$(call SUBST,HOST) \
$(call SUBST_STRING,BINDIR) \
$(call SUBST_STRING,LIBDIR) \
$(call SUBST_STRING,MKDLL) \
$(call SUBST_STRING,MKEXE) \
$(call SUBST_STRING,FLEXLINK_LDFLAGS) \
$(call SUBST_STRING,FLEXLINK_DLL_LDFLAGS) \
$(call SUBST_STRING,MKMAINDLL) \
$(call SUBST,MODEL) \
$(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) \
$(call SUBST,PROFINFO_WIDTH) \
$(call SUBST_STRING,RPATH) \
$(call SUBST_STRING,MKSHAREDLIBRPATH) \
$(call SUBST,FORCE_SAFE_STRING) \
$(call SUBST,DEFAULT_SAFE_STRING) \
$(call SUBST,WINDOWS_UNICODE) \
$(call SUBST,NAKED_POINTERS) \
$(call SUBST,SUPPORTS_SHARED_LIBRARIES) \
$(call SUBST,SYSTEM) \
$(call SUBST,SYSTHREAD_SUPPORT) \
$(call SUBST,TARGET) \
$(call SUBST,WITH_FRAME_POINTERS) \
$(call SUBST,WITH_CPP_MANGLING) \
$(call SUBST,WITH_PROFINFO) \
$(call SUBST,FLAT_FLOAT_ARRAY) \
$(call SUBST,FUNCTION_SECTIONS) \
$(call SUBST,PROBES) \
$(call SUBST,CC_HAS_DEBUG_PREFIX_MAP) \
$(call SUBST,AS_HAS_DEBUG_PREFIX_MAP) \
$(call SUBST,STACK_ALLOCATION) \
$(call SUBST,POLL_INSERTION) \
$< > $@
# 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"