blob: 044f89f04e98794edf3ce076a43b01d9ab37583b (
plain)
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
|
#######################################################################
# #
# The Compcert verified compiler #
# #
# Xavier Leroy, INRIA Paris-Rocquencourt #
# #
# Copyright Institut National de Recherche en Informatique et en #
# Automatique. All rights reserved. This file is distributed #
# under the terms of the INRIA Non-Commercial License Agreement. #
# #
#######################################################################
include ../Makefile.config
FILES=\
Datatypes.ml Logic.ml Wf.ml Peano.ml Specif.ml Compare_dec.ml EqNat.ml \
Bool.ml CList.ml Sumbool.ml Setoid.ml BinPos.ml BinNat.ml BinInt.ml \
ZArith_dec.ml Zeven.ml Zmax.ml Zmisc.ml Zbool.ml Zpower.ml Zdiv.ml \
Ascii.ml CString.ml \
OrderedType.ml FSetInterface.ml FSetFacts.ml FSetList.ml \
CInt.ml FSetAVL.ml \
Coqlib.ml Maps.ml Ordered.ml Errors.ml AST.ml Iteration.ml Integers.ml \
../caml/Camlcoq.ml ../caml/Floataux.ml Floats.ml Parmov.ml Values.ml \
Mem.ml Globalenvs.ml \
../caml/Clflags.ml \
Csyntax.ml Ctyping.ml Cminor.ml Csharpminor.ml Cshmgen.ml \
Cminorgen.ml \
Op.ml CminorSel.ml \
Selection.ml \
Registers.ml RTL.ml \
Switch.ml ../caml/RTLgenaux.ml RTLgen.ml \
Locations.ml Conventions.ml \
../caml/RTLtypingaux.ml RTLtyping.ml \
Lattice.ml Kildall.ml \
Constprop.ml CSE.ml \
LTL.ml LTLin.ml \
InterfGraph.ml ../caml/Coloringaux.ml Coloring.ml \
Allocation.ml \
Tunneling.ml Linear.ml ../caml/Linearizeaux.ml Linearize.ml \
Parallelmove.ml Reload.ml \
Mach.ml Bounds.ml Stacking.ml \
PPC.ml PPCgen.ml \
Main.ml \
../caml/PrintCsyntax.ml ../caml/Cil2Csyntax.ml \
../caml/CMparser.ml ../caml/CMlexer.ml ../caml/CMtypecheck.ml \
../caml/PrintPPC.ml \
../caml/Configuration.ml ../caml/Driver.ml
EXTRACTEDFILES:=$(filter-out ../caml/%, $(FILES))
GENFILES:=$(EXTRACTEDFILES) $(EXTRACTEDFILES:.ml=.mli)
CAMLINCL=-I ../caml -I ../cil/obj/$(ARCHOS)
OCAMLC=ocamlc -g $(CAMLINCL)
OCAMLOPT=ocamlopt $(CAMLINCL)
OCAMLDEP=ocamldep $(CAMLINCL)
OCAMLLIBS=unix.cma str.cma cil.cma
COQINCL=-I ../lib -I ../common -I ../backend -I ../cfrontend
COQEXEC=coqtop $(COQINCL) -batch -load-vernac-source
executables: ../ccomp ../ccomp.byt
../ccomp.byt: $(FILES:.ml=.cmo)
$(OCAMLC) -o ../ccomp.byt $(OCAMLLIBS) $(FILES:.ml=.cmo)
clean::
rm -f ../ccomp.byt
../ccomp: $(FILES:.ml=.cmx)
$(OCAMLOPT) -o ../ccomp $(OCAMLLIBS:.cma=.cmxa) $(FILES:.ml=.cmx)
clean::
rm -f ../ccomp
extraction:
@rm -f $(GENFILES)
$(COQEXEC) extraction.v
@echo "Fixing file names..."
@mv list.ml CList.ml
@mv list.mli CList.mli
@mv string.ml CString.ml
@mv string.mli CString.mli
@mv int.ml CInt.ml
@mv int.mli CInt.mli
@for i in $(GENFILES); do \
j=`./uncapitalize $$i`; \
test -f $$i || (test -f $$j && mv $$j $$i); \
done
@echo "Conversion List -> CList, String -> CString, Int -> CInt..."
@./convert $(GENFILES)
@echo "Patching files..."
@for i in *.patch; do patch < $$i; done
../caml/CMparser.ml ../caml/CMparser.mli: ../caml/CMparser.mly
ocamlyacc -v ../caml/CMparser.mly
beforedepend:: ../caml/CMparser.ml ../caml/CMparser.mli
clean::
rm -f ../caml/CMparser.ml ../caml/CMparser.mli ../caml/CMparser.output
../caml/CMlexer.ml: ../caml/CMlexer.mll
ocamllex ../caml/CMlexer.mll
beforedepend:: ../caml/CMlexer.ml
clean::
rm -f ../caml/CMlexer.ml
../caml/Configuration.ml: ../Makefile.config
(echo 'let stdlib_path = "$(LIBDIR)"'; \
echo 'let prepro = "$(CPREPRO)"'; \
echo 'let asm = "$(CASM)"'; \
echo 'let linker = "$(CLINKER)"') \
> ../caml/Configuration.ml
beforedepend:: ../caml/Configuration.ml
clean::
rm -f ../caml/Configuration.ml
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.mli.cmi:
$(OCAMLC) -c $*.mli
.ml.cmo:
$(OCAMLC) -c $*.ml
.ml.cmx:
$(OCAMLOPT) -c $*.ml
clean::
rm -f $(GENFILES)
rm -f *.cm? *.o
cd ../caml && rm -f *.cm? *.o
depend: beforedepend
$(OCAMLDEP) ../caml/*.mli ../caml/*.ml *.mli *.ml > .depend
install:
install -d $(BINDIR)
install ../ccomp ../ccomp.byt $(BINDIR)
include .depend
|