-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.generating
227 lines (201 loc) · 8.21 KB
/
Makefile.generating
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
##########################################################################
# #
# This file is part of Frama-C. #
# #
# Copyright (C) 2007-2019 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
# you can redistribute it and/or modify it under the terms of the GNU #
# Lesser General Public License as published by the Free Software #
# Foundation, version 2.1. #
# #
# It is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU Lesser General Public License for more details. #
# #
# See the GNU Lesser General Public License version 2.1 #
# for more details (enclosed in the file licenses/LGPLv2.1). #
# #
##########################################################################
ptests/ptests_config.ml: Makefile.generating share/Makefile.config
$(PRINT_MAKING) $@
$(RM) $@
$(TOUCH) $@
$(CHMOD_RO) $@
tests/ptests_config: Makefile.generating share/Makefile.config
$(PRINT_MAKING) $@
$(RM) $@
$(TOUCH) $@
$(ECHO) "DEFAULT_SUITES=$(PLUGIN_TESTS_LIST)" >> $@
$(ECHO) "TOPLEVEL_PATH=bin/toplevel.$(OCAMLBEST)$(EXE)" >> $@
$(ECHO) "OCAMLRUNPARAM=" >> $@
$(ECHO) "FRAMAC_SESSION=." >> $@
$(ECHO) "FRAMAC_SHARE=./share" >> $@
$(ECHO) "FRAMAC_PLUGIN=./lib/plugins" >> $@
$(ECHO) "FRAMAC_PLUGIN_GUI=./lib/plugins/gui" >> $@
$(ECHO) "FRAMAC_LIB=./lib/fc" >> $@
$(CHMOD_RO) $@
ALL_LIBRARY_NAMES=$(shell ocamlfind query -r -p-format $(LIBRARY_NAMES) $(LIBRARY_NAMES_GUI))
MAJOR_VERSION=$(shell $(SED) -E 's/^([0-9]+)\..*/\1/' VERSION)
MINOR_VERSION=$(shell $(SED) -E 's/^[0-9]+\.([0-9]+).*/\1/' VERSION)
$(CONFIG_FILE): $(CONFIG_FILE).in VERSION VERSION_CODENAME share/Makefile.config Makefile.generating configure.in
$(SED) \
-e "s|@VERSION@|$(VERSION)|" \
-e "s|@VERSION_CODENAME@|$(VERSION_CODENAME)|" \
-e "s|@CURR_DATE@|$$(LC_ALL=C date)|" \
-e "s|@OCAMLC@|$(OCAMLC)|" \
-e "s|@OCAMLOPT@|$(OCAMLOPT)|" \
-e "s|@WARNINGS@|$(WARNINGS)|" \
-e "s|@FRAMAC_DATADIR@|$(FRAMAC_DATADIR)|" \
-e "s|@FRAMAC_LIBDIR@|$(FRAMAC_LIBDIR)|" \
-e "s|@FRAMAC_ROOT_SRCDIR@|$(FRAMAC_ROOT_SRCDIR)|" \
-e "s|@FRAMAC_PLUGINDIR@|$(FRAMAC_PLUGINDIR)|" \
-e "s|@FRAMAC_DEFAULT_CPP@|$(FRAMAC_DEFAULT_CPP)|" \
-e "s|@FRAMAC_DEFAULT_CPP_ARGS@|$(FRAMAC_DEFAULT_CPP_ARGS)|" \
-e "s|@FRAMAC_GNU_CPP@|$(FRAMAC_GNU_CPP)|" \
-e "s|@DEFAULT_CPP_KEEP_COMMENTS@|$(DEFAULT_CPP_KEEP_COMMENTS)|" \
-e "s|@DEFAULT_CPP_SUPPORTED_ARCH_OPTS@|$(DEFAULT_CPP_SUPPORTED_ARCH_OPTS)|" \
-e "s|@COMPILATION_UNITS@|$(COMPILATION_UNITS)|" \
-e "s|@LIBRARY_NAMES@|$(foreach p,$(ALL_LIBRARY_NAMES),\"$p\";)|" \
-e "s|@OPTDOT@|$(OPTDOT)|" \
-e "s|@EXE@|$(EXE)|" \
-e "s|@MAJOR_VERSION@|$(MAJOR_VERSION)|" \
-e "s|@MINOR_VERSION@|$(MINOR_VERSION)|" \
$< > [email protected]
@touch -r [email protected] $<
$(CP_IF_DIFF) [email protected] $@
$(RM) [email protected]
$(CHMOD_RO) $@
ifeq ("$(LOCAL_MACHDEP)","yes")
MACHDEP_PATH=share
# Create the machine dependency module
# If the cl command cannot be run then the MSVC part will be identical to GCC
.PHONY : machdep $(MACHDEP_PATH)/local_machdep.ml
machdep: $(MACHDEP_PATH)/local_machdep.ml
bin/machdep.exe: machdep
config.h:
$(PRINT_MAKING) $@
$(ECHO) "missing config.h file generated at configure stage using --enable-localmachdep option."
exit 1;
$(MACHDEP_PATH)/local_machdep.ml: \
$(MACHDEP_PATH)/machdep.c config.h Makefile.generating
$(PRINT_MAKING) $@
$(RM) $@
$(ECHO) "(* This module was generated automatically by code in Makefile and machdep.c *)" >$@
# Now generate the type definition
$(ECHO) "open Cil_types" >> $@
if $(CC) -D_GNUCC $< -o bin/machdep.exe ;then \
$(ECHO) "machdep.exe created successfully."; \
else \
$(RM) $@; exit 1; \
fi
$(ECHO) "let gcc = {" >>$@
./bin/machdep.exe >>$@
$(ECHO) " underscore_name = $(UNDERSCORE_NAME) ;" >> $@
$(ECHO) "}" >>$@
if cl /D_MSVC $< /Febin/machdep.exe /Fobin/machdep.obj ;then \
$(ECHO) "let hasMSVC = true" >>$@; \
else \
$(ECHO) "let hasMSVC = false" >>$@; \
fi
$(ECHO) "let msvc = {" >>$@
./bin/machdep.exe >>$@
$(ECHO) " underscore_name = true ;" >> $@
$(ECHO) "}" >>$@
$(ECHO) \
"let gccHas__builtin_va_list = $(HAVE_BUILTIN_VA_LIST)" >>$@
$(ECHO) "let __thread_is_keyword = $(THREAD_IS_KEYWORD)" >>$@
$(ECHO) \
"$@ generated. You may have this file merged into Frama-C by developers."
$(CHMOD_RO) $@
endif
# transitioning.ml
GENERATED+= src/libraries/utils/json.ml src/libraries/stdlib/transitioning.ml
ifeq ($(HAS_OCAML408),yes)
DYNLINK_INIT=fun () -> ()
FORMAT_STAG=stag
FORMAT_STRING_OF_STAG=match s with \
Format.String_tag str -> str \
| _ -> raise (Invalid_argument "unsupported tag extension")
FORMAT_STAG_OF_STRING=Format.String_tag s
HAS_OCAML407_OR_408=yes
else
DYNLINK_INIT=Dynlink.init
FORMAT_STAG=tag
FORMAT_STRING_OF_STAG=s
FORMAT_STAG_OF_STRING=s
ifeq ($(HAS_OCAML407),yes)
HAS_OCAML407_OR_408=yes
else
HAS_OCAML407_OR_408=no
endif
endif
ifeq ($(HAS_OCAML407_OR_408),yes)
FLOAT_MAX_FLOAT=Float.max_float
else
FLOAT_MAX_FLOAT=Pervasives.max_float
endif
src/libraries/stdlib/transitioning.ml: \
src/libraries/stdlib/transitioning.ml.in \
Makefile.generating share/Makefile.config
$(PRINT_MAKING) $@
rm -f $@
sed \
-e 's/@SPLIT_ON_CHAR@/$(SPLIT_ON_CHAR)/g' \
-e 's/@STACK_FOLD@/$(STACK_FOLD)/g' \
-e 's/@NTH_OPT@/$(NTH_OPT)/g' \
-e 's/@FIND_OPT@/$(FIND_OPT)/g' \
-e 's/@ASSOC_OPT@/$(ASSOC_OPT)/g' \
-e 's/@ASSQ_OPT@/$(ASSQ_OPT)/g' \
-e 's/@DYNLINK_INIT@/$(DYNLINK_INIT)/g' \
-e 's/@FLOAT_MAX_FLOAT@/$(FLOAT_MAX_FLOAT)/g' \
-e 's/@FORMAT_STAG@/$(FORMAT_STAG)/g' \
-e 's/@FORMAT_STRING_OF_STAG@/$(FORMAT_STRING_OF_STAG)/g' \
-e 's/@FORMAT_STAG_OF_STRING@/$(FORMAT_STAG_OF_STRING)/g' \
$< > $@
$(CHMOD_RO) $@
##################
# Frama-C-config #
##################
src/kernel_internals/runtime/frama_c_config.ml: src/kernel_internals/runtime/config.ml \
src/kernel_internals/runtime/frama_c_config.ml.in Makefile.generating
$(PRINT_MAKING) $@
$(RM) $@
$(ECHO) "module Filepath = struct let add_symbolic_dir _ _ = () end" >> $@
$(ECHO) "module Config = struct" >> $@
$(CAT) src/kernel_internals/runtime/config.ml >> $@
$(ECHO) "end" >> $@
$(CAT) src/kernel_internals/runtime/frama_c_config.ml.in >> $@
$(CHMOD_RO) $@
GENERATED+= src/kernel_internals/runtime/frama_c_config.ml
bin/fc-config$(EXE): src/kernel_internals/runtime/frama_c_config.ml
ifeq ($(OCAMLBEST),opt)
$(OCAMLOPT) str.cmxa $< -o $@
else
$(OCAMLC) str.cma $< -o $@
endif
# Merlin #
.PHONY:merlin
.merlin merlin: share/Makefile.config Makefile.generating
#create Merlin file
$(PRINT_MAKING) $@
echo "FLG -c $(FLAGS) $(FRAMAC_USER_MERLIN_FLAGS)" > .merlin
for PKG in $(LIBRARY_NAMES); do echo PKG $$PKG >> .merlin; done
for PKG in $(LIBRARY_NAMES_GUI); do echo PKG $$PKG >> .merlin; done
for PKG in $(MERLIN_PACKAGES); do echo PKG $$PKG >> .merlin; done
echo "B lib/plugins" >> .merlin
echo "B lib/plugins/gui" >> .merlin
find src \( -name '.*' -o -name tests -o -name doc -o -name '*.cache' \) -prune \
-o \( -type d -exec printf "B %s\n" {} \; -exec printf "S %s\n" {} \; \) >> .merlin
ifeq ("$(DEVELOPMENT)","yes")
all:: .merlin
endif
lib/fc/META.frama-c: share/META.frama-c share/Makefile.config Makefile.generating
$(MKDIR) lib/fc/
$(SED) "s/@REQUIRES/$(LIBRARY_NAMES)/" $< > $@
GENERATED += lib/fc/META.frama-c
# Local Variables:
# mode: makefile
# End: