This repository has been archived by the owner on Nov 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile.in
352 lines (297 loc) · 11.3 KB
/
Makefile.in
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# -*- Mode: makefile -*-
# Makefile for the cil wrapper
# @do_not_edit@ Makefile.in
#
# authors: George Necula, Gabriel Kerneis
CILLY = cpc
CIL_VERSION = @CIL_VERSION@
.PHONY: all
all: cillib $(CILLY) cpc_runtime
# Now add the defines for the CIL features
include Makefile.features
# look out for outdated Makefile; if it's out of date, this will automatically
# re-run ./config.status, then re-exec make with the same arguments
Makefile: config.status Makefile.in
./$<
config.status: configure
./$@ --recheck
$(srcdir)/configure: configure.ac aclocal.m4
cd '$(srcdir)' && autoconf
# autoheader might not change config.h.in, so touch a stamp file.
$(srcdir)/config.h.in: stamp-h.in
$(srcdir)/stamp-h.in: configure.ac aclocal.m4
cd '$(srcdir)' && autoheader
echo timestamp > '$(srcdir)/stamp-h.in'
config.h: stamp-h
stamp-h: config.h.in config.status
./config.status
@DEFAULT_COMPILER@=1
EMUL = @EMUL@
ifdef EMUL
# Compile machdep-ml.c with -static when
# cross-compiling only (because -static
# is broken on MacOS X)
MACHDEPCC=$(CC) $(CFLAGS) -static -D_GNUCC
else
MACHDEPCC=gcc -D_GNUCC
endif
# We have to use _build because of OCaml's bug #0004502
OBJDIR = _build
BINDIR = bin
CILLYDIR = lib
# Ocaml tools
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@
OCAMLFIND = @OCAMLFIND@
OCAMLBUILD = @OCAMLBUILD@
PERL = @PERL@
# Build the list of files for cillib
CILLIB_TARGETS=
CILLY_EXE_FILES=
ifneq ($(OCAMLC),no)
CILLIB_TARGETS += $(OBJDIR)/src/cil.cma
CILLY_EXE_FILES += $(OBJDIR)/src/cilly.byte
endif
ifneq ($(OCAMLOPT),no)
CILLIB_TARGETS += $(OBJDIR)/src/cil.cmxa $(OBJDIR)/src/cil.a
CILLY_EXE_FILES += $(OBJDIR)/src/cilly.native
endif
CILLIB_FILES = $(OBJDIR)/src/cil.libfiles
CILDOC_INDEX = $(OBJDIR)/cil.docdir/index.html
CILLY_EXE_BIN = $(patsubst $(OBJDIR)/src/cilly.%,bin/$(CILLY).%,$(CILLY_EXE_FILES))
# Force a single invocation of ocamlbuild per make execution
OCAMLBUILD += -build-dir $(OBJDIR) -no-links -classic-display
OCAMLBUILD_TARGETS = \
$(CILLIB_TARGETS) \
$(CILLIB_FILES) \
$(CILLY_EXE_FILES) \
$(CILDOC_INDEX)
# Trick: this no-op rule is executed for each target, but
# its PHONY dependency is built exactly once.
$(OCAMLBUILD_TARGETS): ocamlbuild
@:
.PHONY: ocamlbuild
ocamlbuild:
export CIL_VERSION
$(OCAMLBUILD) $(patsubst $(OBJDIR)/%,%,$(OCAMLBUILD_TARGETS))
# OCaml CIL library
.PHONY: cillib
cillib: $(CILLIB_TARGETS)
# cilly perl wrapper
prefix = @prefix@
INSTALL_BASE = $(prefix)
CILLYMOD := Cpc
$(CILLYDIR)/Makefile: $(CILLYDIR)/Makefile.PL $(CILLYDIR)/App/$(CILLYMOD).pm
cd $(CILLYDIR); $(PERL) Makefile.PL INSTALL_BASE="$(INSTALL_BASE)"
bin/$(CILLY).%: $(OBJDIR)/src/cilly.%
cp $< $@
.PHONY: $(CILLY)
$(CILLY): $(CILLY_EXE_BIN) $(CILLYDIR)/Makefile
$(MAKE) -C $(CILLYDIR)
# Create the machine dependency module
# If the cl command cannot be run then the MSVC part will be identical to GCC
.PHONY : machdep
machdep: $(OBJDIR)/machdep.ml
$(OBJDIR)/machdep.ml : src/machdep-ml.c configure.ac Makefile.in
@rm -f $@
@mkdir -p $(OBJDIR)
@echo "(* This module was generated automatically by code in Makefile and $(<F) *)" >$@
@echo "type mach = {" >> $@
@echo " version_major: int; (* Major version number *)" >> $@
@echo " version_minor: int; (* Minor version number *)" >> $@
@echo " version: string; (* gcc version string *)" >> $@
@echo " underscore_name: bool; (* If assembly names have leading underscore *)" >> $@
@echo " sizeof_short: int; (* Size of \"short\" *)" >> $@
@echo " sizeof_int: int; (* Size of \"int\" *)" >> $@
@echo " sizeof_bool: int; (* Size of \"_Bool\" *)" >> $@
@echo " sizeof_long: int ; (* Size of \"long\" *)" >> $@
@echo " sizeof_longlong: int; (* Size of \"long long\" *)" >> $@
@echo " sizeof_ptr: int; (* Size of pointers *)" >> $@
@echo " sizeof_float: int; (* Size of \"float\" *)" >> $@
@echo " sizeof_double: int; (* Size of \"double\" *)" >> $@
@echo " sizeof_longdouble: int; (* Size of \"long double\" *)" >> $@
@echo " sizeof_void: int; (* Size of \"void\" *)" >> $@
@echo " sizeof_fun: int; (* Size of function *)" >> $@
@echo " size_t: string; (* Type of \"sizeof(T)\" *)" >> $@
@echo " wchar_t: string; (* Type of \"wchar_t\" *)" >> $@
@echo " alignof_short: int; (* Alignment of \"short\" *)" >> $@
@echo " alignof_int: int; (* Alignment of \"int\" *)" >> $@
@echo " alignof_bool: int; (* Alignment of \"_Bool\" *)" >> $@
@echo " alignof_long: int; (* Alignment of \"long\" *)" >> $@
@echo " alignof_longlong: int; (* Alignment of \"long long\" *)" >> $@
@echo " alignof_ptr: int; (* Alignment of pointers *)" >> $@
@echo " alignof_enum: int; (* Alignment of enum types *)" >> $@
@echo " alignof_float: int; (* Alignment of \"float\" *)" >> $@
@echo " alignof_double: int; (* Alignment of \"double\" *)" >> $@
@echo " alignof_longdouble: int; (* Alignment of \"long double\" *)" >> $@
@echo " alignof_str: int; (* Alignment of strings *)" >> $@
@echo " alignof_fun: int; (* Alignment of function *)" >> $@
@echo " alignof_aligned: int; (* Alignment of anything with the \"aligned\" attribute *)" >> $@
@echo " char_is_unsigned: bool; (* Whether \"char\" is unsigned *)">> $@
@echo " const_string_literals: bool; (* Whether string literals have const chars *)">> $@
@echo " little_endian: bool; (* whether the machine is little endian *)">>$@
@echo " __thread_is_keyword: bool; (* whether __thread is a keyword *)">>$@
@echo " __builtin_va_list: bool; (* whether __builtin_va_list is builtin (gccism) *)">>$@
@echo "}" >> $@
@if $(MACHDEPCC) $< -o $(OBJDIR)/machdep-ml.exe ;then \
echo "machdep-ml.exe created succesfully." \
;else \
rm -f $@; exit 1 \
;fi
@echo "let gcc = {" >>$@
@$(EMUL) $(OBJDIR)/machdep-ml.exe >>$@
@echo "}" >>$@
@if cl -D_MSVC $< -Fe$(OBJDIR)/machdep-ml.exe -Fo$(OBJDIR)/machdep-ml.obj ;then \
echo "let hasMSVC = true" >>$@ ;\
echo "let msvc = {" >>$@ ;\
$(OBJDIR)/machdep-ml.exe >>$@ ;\
echo "}" >>$@ \
;else \
echo "let hasMSVC = false" >>$@ ;\
echo "let msvc = gcc" >> $@ \
;fi
@echo "let theMachine : mach ref = ref gcc" >>$@
$(CILLYDIR)/App/$(CILLYMOD).pm: $(CILLYDIR)/App/$(CILLYMOD).pm.in src/machdep-ml.c configure.ac Makefile.in
cp $(CILLYDIR)/App/$(CILLYMOD).pm.in $(CILLYDIR)/App/$(CILLYMOD).pm
sed -e "s|CIL_VERSION|$(CIL_VERSION)|" $(CILLYDIR)/App/$(CILLYMOD).pm > $(CILLYDIR)/App/$(CILLYMOD).pm.tmp; \
mv $(CILLYDIR)/App/$(CILLYMOD).pm.tmp $(CILLYDIR)/App/$(CILLYMOD).pm; \
if $(MACHDEPCC) -m32 src/machdep-ml.c -o $(OBJDIR)/machdep-ml32.exe ;then \
sed -e "s|nogcc32model|`$(EMUL) $(OBJDIR)/machdep-ml32.exe --env`|" $(CILLYDIR)/App/$(CILLYMOD).pm > $(CILLYDIR)/App/$(CILLYMOD).pm.tmp; \
mv $(CILLYDIR)/App/$(CILLYMOD).pm.tmp $(CILLYDIR)/App/$(CILLYMOD).pm; \
fi
if $(MACHDEPCC) -m64 src/machdep-ml.c -o $(OBJDIR)/machdep-ml64.exe ;then \
sed -e "s|nogcc64model|`$(EMUL) $(OBJDIR)/machdep-ml64.exe --env`|" $(CILLYDIR)/App/$(CILLYMOD).pm > $(CILLYDIR)/App/$(CILLYMOD).pm.tmp; \
mv $(CILLYDIR)/App/$(CILLYMOD).pm.tmp $(CILLYDIR)/App/$(CILLYMOD).pm; \
fi
.PHONY: feature_config
feature_config: $(OBJDIR)/feature_config.ml
$(OBJDIR)/feature_config.ml: config.status
rm -f $(OBJDIR)/feature_config.*
echo "(* This module was generated automatically by code in Makefile.in *)" >$@
echo "open Cil" >>$@
echo "let features : featureDescr list = [" >> $@
ifdef USE_BLOCKINGGRAPH
echo " Blockinggraph.feature;" >> $@
endif
ifdef USE_RAND
echo " Rand.feature;" >> $@
endif
ifdef USE_ARITHABS
echo " Arithabs.feature;" >>$@
endif
ifdef USE_ZRAPP
echo " Zrapp.feature;" >> $@
endif
ifdef USE_LLVM
echo " Llvm.feature;" >> $@
endif
echo " (* EXTRAFEATURES: *)" >> $@
echo \
$(foreach f,@EXTRAFEATURES@, \
"\n "`echo $f | cut -c 1 | tr "[a-z]" "[A-Z]"``echo $f | cut -c 2-`".feature;") \
| $(PERL) -pe 's/\\n/\n/g' >> $@
echo "]" >>$@
### DOCUMENTATION
# You should usually run this twice to get all of the references linked
# correctly.
.PHONY: doc
doc: texdoc pdfdoc odoc
.PHONY: odoc texdoc pdfdoc
# Documentation generated by "ocamldoc"
odoc: $(CILDOC_INDEX)
-rm -rf doc/html/cil/api
-mkdir -p doc/html/cil/
-cp -r $(dir $<) doc/html/cil/api
doc/cilpp.tex: doc/cilcode.pl doc/cil.tex $(CILLY)
-rm -rf doc/html/cil
-mkdir -p doc/html/cil
-mkdir -p doc/html/cil/examples
cd doc; $(PERL) cilcode.pl cil.tex >cilpp.tex.tmp
mv doc/cilpp.tex.tmp $@
# Documentation generated from latex files using "hevea"
texdoc: doc/cilpp.tex
cd doc/html/cil; printf '\\def\\cilversion{$(CIL_VERSION)}\n' >cil.version.tex
cd doc/html/cil; hevea -exec xxdate.exe ../../cilpp
cd doc/html/cil; hevea -exec xxdate.exe ../../cilpp
cd doc/html/cil; mv cilpp.html cil.html
cd doc/html/cil; hacha -o ciltoc.html cil.html
cp -f doc/index.html doc/html/cil/index.html
cp -f doc/header.html doc/html/cil
pdfdoc: doc/cilpp.tex
cd doc; printf '\\def\\cilversion{$(CIL_VERSION)}\n' >cil.version.tex
cd doc; pdflatex cilpp.tex; pdflatex cilpp.tex
cd doc; mv cilpp.pdf html/cil/CIL.pdf
.PHONY: distclean clean
distclean: clean
$(MAKE) -C test distclean
rm -rf autom4te.cache/
rm -f Makefile
rm -f $(CILLYDIR)/App/$(CILLYMOD)/CilConfig.pm
rm -f config.h
rm -f config.log
rm -f config.mk
rm -f config.status
rm -f doc/header.html
rm -f doc/index.html
rm -f src/machdep-ml.c
rm -f stamp-h
clean: $(CILLYDIR)/Makefile cpc_clean
rm -rf $(OBJDIR)
rm -f $(BINDIR)/$(CILLY).*
rm -rf doc/html/
rm -rf doc/cilcode.tmp/
rm -f doc/cil.version.*
rm -f doc/cilpp.*
$(MAKE) -C $(CILLYDIR) clean
rm -f $(CILLYDIR)/App/$(CILLYMOD).pm
rm -f $(CILLYDIR)/Makefile.old
rm -f Makefile.features
.PHONY: test
test:
cd test; ./testcil -r --regrtest
# CPC targets
.PHONY: cpc_runtime cpc_clean testcpc
cpc_runtime:
$(MAKE) -C runtime all
cpc_clean:
$(MAKE) -C runtime clean
$(MAKE) -C samples clean
testcpc: cpc
$(MAKE) -C samples clean all test
########################################################################
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
# Make DESTDIR absolute (necessary for perl installation)
ifneq ($(DESTDIR),)
override DESTDIR := $(abspath $(DESTDIR))
endif
install: $(CILLY)
$(MAKE) -C $(CILLYDIR) pure_install DESTDIR=$(DESTDIR) INSTALL_BASE=$(INSTALL_BASE)
$(INSTALL) -m 0755 $(BINDIR)/$(CILLY).* $(DESTDIR)$(bindir)
$(INSTALL) -d $(DESTDIR)$(includedir)/cpc
$(INSTALL_DATA) include/cpc/* $(DESTDIR)$(includedir)/cpc
$(INSTALL_DATA) runtime/libcpc.a $(DESTDIR)$(libdir)/libcpc.a
uninstall: $(CILLYDIR)/Makefile
-rm -f $(DESTDIR)$(bindir)/$(CILLY).*
$(MAKE) -C $(CILLYDIR) force_uninstall
-rm -rf $(DESTDIR)$(includedir)/cpc
-rm -f $(DESTDIR)$(libdir)/libcpc.a
.PHONY: install-findlib uninstall-findlib
# Make DESTDIR work for ocamlfind
ifneq ($(DESTDIR),)
OCAMLFIND_DESTDIR = $(DESTDIR)$(shell ocamlfind printconf destdir)
endif
export OCAMLFIND_DESTDIR
install-findlib: $(CILLIB_FILES) $(CILLIB_TARGETS)
ifneq ($(OCAMLFIND_DESTDIR),)
mkdir -p $(OCAMLFIND_DESTDIR)
endif
$(OCAMLFIND) install -patch-version $(CIL_VERSION) cil META \
$(CILLIB_TARGETS) `cat $(CILLIB_FILES)`
uninstall-findlib:
$(OCAMLFIND) remove cil