Debian Codegraph @

Makefile

raw ◀ ▶
Source reconstructed at patch state 0 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 # Attempt to ask git for a version (tag or hash) but fall back on LEMRELEASE.
2 # Note that opam builds from a tar ball so LEMRELEASE will be used in that case.
3 LEMRELEASE:=2026-05-01
4 LEMVERSION:=$(shell git describe --dirty --always 2>/dev/null || echo $(LEMRELEASE))
5
6 DDIR=lem-$(LEMVERSION)
7
8 # by default assume local install
9 INSTALL_DIR := $(realpath .)
10
11 #all: il.pdf build-main ilTheory.uo
12 all: bin/lem libs_phase_1
13
14 # we might want run the tests for all backends that are present
15
16 install:
17 mkdir -p "$(INSTALL_DIR)/bin"
18 rm -f "$(INSTALL_DIR)/bin/lem"
19 cp src/main.native "$(INSTALL_DIR)/bin/lem"
20 rm -rf "$(INSTALL_DIR)/share/lem"
21 mkdir -p "$(INSTALL_DIR)/share/lem/library"
22 cp library/*.lem "$(INSTALL_DIR)/share/lem/library"
23 cp library/*_constants "$(INSTALL_DIR)/share/lem/library"
24 $(MAKE) -C ocaml-lib install
25 cp -R coq-lib "$(INSTALL_DIR)/share/lem"
26 cp -R hol-lib "$(INSTALL_DIR)/share/lem"
27 # cp -R html-lib "$(INSTALL_DIR)/share/lem"
28 cp -R isabelle-lib "$(INSTALL_DIR)/share/lem"
29 # cp -R tex-lib "$(INSTALL_DIR)/share/lem"
30
31 uninstall:
32 rm -f "$(INSTALL_DIR)/bin/lem"
33 rm -rf "$(INSTALL_DIR)/share/lem"
34 $(MAKE) -C ocaml-lib uninstall
35
36 build-doc:
37 $(MAKE) -C doc
38
39 do-tests:
40 $(MAKE) -C tests
41
42 lem_dep.tex: lem_dep.ott
43 ott -o lem_dep.tex -picky_multiple_parses true lem_dep.ott
44
45 lem_dep.pdf: lem_dep.tex
46 pdflatex lem_dep.tex
47
48 # this runs Lem on the Lem library (library/*.lem), leaving the
49 # generated OCaml, Coq, HOL4, and Isabelle files to ocaml-libs,
50 # hol-libs, etc.
51 libs_phase_1:
52 $(MAKE) -C library
53 $(MAKE) ocaml-libs
54
55
56 # this processes the Lem-generated library files for that target,
57 # together with any other hand-written files needed (eg the ocaml
58 # pset.ml), through the target.
59 libs_phase_2:
60 # $(MAKE) ocaml-libs
61 $(MAKE) tex-libs
62 $(MAKE) hol-libs
63 $(MAKE) coq-libs
64 $(MAKE) isa-libs
65
66 hol-libs:
67 # $(MAKE) -C library hol-libs
68 cd hol-lib; Holmake --qof -k
69 $(MAKE) -C library hol-lib-tests
70
71 ocaml-libs:
72 # $(MAKE) -C library ocaml-libs
73 $(MAKE) -C ocaml-lib all
74 $(MAKE) -C library ocaml-lib-tests
75
76 isa-libs:
77 # $(MAKE) -C library isa-libs
78 isabelle build -d isabelle-lib -b LEM
79
80 coq-libs:
81 # $(MAKE) -C library coq-libs
82 cd coq-lib; coqc -R . Lem coqharness.v
83 cd coq-lib; coq_makefile -f coq_makefile.in > Makefile
84 $(MAKE) -C coq-lib
85
86 tex-libs:
87 # $(MAKE) -C library tex-libs
88 cd tex-lib; pdflatex lem-libs.tex
89 cd tex-lib; pdflatex lem-libs.tex
90
91 # test-other: test-ppcmem test-cpp test-cppppc
92 #
93 # test-ppc:
94 # # ppc model
95 # $(MAKE) -C ../../sem/WeakMemory/ppc-abstract-machine
96 # # pull ppc model into ppcmem directory
97 # # DON'T COMMIT
98 # $(MAKE) -C ../ppcmem/system model
99 #
100 # test-axppc:
101 # # Sela model
102 # $(MAKE) -C ../axppc
103 # # pull Sela model into ppcmem directory
104 # # DON'T COMMIT
105 # $(MAKE) -C ../ppcmem/system axmodel
106 #
107 # test-arm:
108 # # ARM flowing model
109 # $(MAKE) -C ../arm/flowing-things
110 # # pull ARM model into ppcmem directory
111 # # DON'T COMMIT
112 # $(MAKE) -C ../ppcmem/system flowingmodel
113 #
114 # test-ppcmem: test-ppc test-axppc test-arm
115 # # next 3 compile PPCMEM
116 # # Check makefile in ppcmem/system is set to "text"
117 # # DON'T commit
118 # $(MAKE) -C ../ppcmem/system clean
119 # $(MAKE) -C ../ppcmem/system depend_text
120 # $(MAKE) -C ../ppcmem/system text
121 #
122 # test-cpp:
123 # # C++. Chat with Mark to fix
124 # $(MAKE) -C ../cpp/axiomatic/ntc deadlock
125 # # C++. Chat with Mark to fix HOL building and Mark/Susmit/Mike ML
126 # # building
127 # #$(MAKE) -C ../cpp/opsem
128 # #$(MAKE) -C ../cpp/axiomatic/ntc/proofs all
129 #
130 # test-cppppc:
131 # $(MAKE) -C ../cppppc proof
132 # $(MAKE) -C ../cppppc/proof2 lem
133 #
134 #
135 # MACHINEFILES=\
136 # MachineDefUtils.lem \
137 # MachineDefFreshIds.lem \
138 # MachineDefValue.lem \
139 # MachineDefTypes.lem \
140 # MachineDefInstructionSemantics.lem \
141 # MachineDefStorageSubsystem.lem \
142 # MachineDefThreadSubsystem.lem \
143 # MachineDefSystem.lem
144 #
145 # test-tex: lem
146 # rm -rf tests/test-tex/*
147 # cp ../WeakMemory/ppc-abstract-machine/*.lem tests/test-tex
148 # cp tests/test-tex-inc-wrapper.tex tests/test-tex
149 # chmod ugo-w tests/test-tex/*.lem
150 # cd tests/test-tex; ../../lem -hol -tex -ocaml -lib ../../library $(MACHINEFILES)
151 # cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex alldoc.tex; dvips alldoc
152 # cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex test-tex-inc-wrapper.tex; dvips test-tex-inc-wrapper
153 # #cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex MachineDefUtils.tex; dvips MachineDefUtils
154 # #cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex MachineDefFreshIds.tex; dvips MachineDefFreshIds
155 # #cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex MachineDefValue.tex; dvips MachineDefValue
156 # #cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex MachineDefTypes.tex; dvips MachineDefTypes
157 # #cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex MachineDefInstructionSemantics.tex; dvips MachineDefInstructionSemantics
158 # #cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex MachineDefStorageSubsystem.tex; dvips MachineDefStorageSubsystem
159 # #cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex MachineDefThreadSubsystem.tex; dvips MachineDefThreadSubsystem
160 # #cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex MachineDefSystem.tex; dvips MachineDefSystem
161 #
162 # test-texg:
163 # g tests/test-tex/alldoc
164 # #g tests/test-tex/MachineDefStorageSubsystem
165 #
166 # test-texw:
167 # cd tests/test-tex; TEXINPUTS=../../tex-lib:$(TEXINPUTS) latex test-tex-inc-wrapper.tex; dvips test-tex-inc-wrapper
168 #
169 #
170 # test-texgw:
171 # g tests/test-tex/test-tex-inc-wrapper
172
173 debug: version share_directory
174 rm -f library/lib_cache
175 $(MAKE) -C src debug
176 ln -sf src/main.d.byte lem
177
178
179 build-lem: version share_directory
180 $(MAKE) -C src all
181 ln -sf src/main.native lem
182
183 build-lem-profile: version share_directory
184 $(MAKE) -C src profile
185 ln -sf src/main.p.native lem-profile
186
187
188 lem: build-lem
189 true
190
191 bin/lem: lem
192 mkdir -p bin
193 cd bin && ln -sf ../src/main.native lem
194
195 OCAML-LIB-NON_LGPL = \
196 ocaml-lib/Makefile \
197 ocaml-lib/big_int_impl.ml \
198 ocaml-lib/big_int_impl.mli \
199 ocaml-lib/nat_big_num.ml \
200 ocaml-lib/nat_big_num.mli \
201 ocaml-lib/nat_num.ml \
202 ocaml-lib/nat_num.mli \
203 ocaml-lib/vector.ml \
204 ocaml-lib/vector.mli
205 # not
206 # pmap.ml
207 # pmap.mli
208 # pset.ml
209 # pset.mli
210
211 apply_header:
212 headache -h etc/header `ls src/*.ml`
213 headache -h etc/header `ls src/*.mli`
214 headache -h etc/header `ls src/*.mly`
215 headache -h etc/header `ls src/*.mll`
216 headache -c etc/head_config -h etc/header `ls language/*.lem`
217 headache -c etc/head_config -h etc/header `ls tex-lib/*.sty`
218 headache -c etc/head_config -h etc/header `ls coq-lib/*.v`
219 headache -c etc/head_config -h etc/header `ls isabelle-lib/*.thy`
220 headache -c etc/head_config -h etc/header `ls tex-lib/*.sty`
221 headache -c etc/head_config -h etc/header $(OCAML-LIB-NONLGPL)
222 headache -c etc/head_config -h etc/header `ls library/coq/*.lem`
223 headache -c etc/head_config -h etc/header `ls library/hol/*.lem`
224 headache -c etc/head_config -h etc/header `ls library/isabelle/*.lem`
225 headache -c etc/head_config -h etc/header `ls library/ocaml/*.lem`
226
227
228 #lem_unwrapped.tex: lem.ott
229 # ott -tex_wrap false -o lem_unwrapped.tex lem.ott
230 #
231 #install_lem_unwrapped: lem_unwrapped.tex
232 # cp lem_unwrapped.tex ../../ott/examples/ich/generated/lem_unwrapped.tex
233
234 #src/version.ml:
235 version:
236 echo "(* Generated file -- do not edit. *)" > src/version.ml
237 echo 'let v="$(LEMVERSION)"' >> src/version.ml
238
239 share_directory:
240 echo "(* Generated file -- do not edit. *)" > src/share_directory.ml
241 echo let d=\"$(INSTALL_DIR)/share/lem\" >> src/share_directory.ml
242
243
244 distrib: src/ast.ml version
245 rm -rf $(DDIR)
246 rm -rf $(DDIR).tar.gz
247 mkdir $(DDIR)
248 mkdir $(DDIR)/src
249 mkdir $(DDIR)/src/ulib
250 cp src/*.ml $(DDIR)/src/
251 chmod a+w $(DDIR)/src/ast.ml
252 chmod a+w $(DDIR)/src/version.ml
253 cp src/*.mli $(DDIR)/src/
254 cp src/*.mll $(DDIR)/src/
255 cp src/*.mly $(DDIR)/src/
256 cp src/_tags $(DDIR)/src/
257 cp src/ulib/*.ml $(DDIR)/src/ulib/
258 cp src/ulib/*.mli $(DDIR)/src/ulib/
259 mkdir $(DDIR)/library
260 mkdir $(DDIR)/library/hol
261 mkdir $(DDIR)/library/isabelle
262 mkdir $(DDIR)/library/ocaml
263 cp library/*.lem $(DDIR)/library/
264 cp library/isabelle/constants $(DDIR)/library/isabelle/
265 cp library/isabelle/*.lem $(DDIR)/library/isabelle/
266 cp library/hol/constants $(DDIR)/library/hol/
267 cp library/hol/*.lem $(DDIR)/library/hol/
268 cp library/ocaml/*.lem $(DDIR)/library/ocaml/
269 mkdir $(DDIR)/ocaml-lib
270 cp ocaml-lib/*.ml $(DDIR)/ocaml-lib
271 cp ocaml-lib/*.mli $(DDIR)/ocaml-lib
272 cp ocaml-lib/*.mllib $(DDIR)/ocaml-lib
273 cp ocaml-lib/Makefile $(DDIR)/ocaml-lib
274 mkdir $(DDIR)/tex-lib
275 cp tex-lib/lem.sty $(DDIR)/tex-lib
276 cp Makefile-distrib $(DDIR)/Makefile
277 cp src/Makefile-distrib $(DDIR)/src/Makefile
278 cp README $(DDIR)
279 cp LICENSE $(DDIR)
280 headache -h header `ls $(DDIR)/src/*.ml`
281 headache -h header `ls $(DDIR)/src/*.mli`
282 headache -h header `ls $(DDIR)/src/*.mly`
283 headache -h header `ls $(DDIR)/src/*.mll`
284 headache -c head_config -h header `ls $(DDIR)/tex-lib/*.sty`
285 headache -c head_config -h header `ls $(DDIR)/library/*.lem`
286 headache -c head_config -h header `ls $(DDIR)/library/hol/*.lem`
287 headache -c head_config -h header `ls $(DDIR)/library/isabelle/*.lem`
288 headache -c head_config -h header `ls $(DDIR)/library/ocaml/*.lem`
289 tar cf $(DDIR).tar $(DDIR)
290 gzip $(DDIR).tar
291 rm -rf $(DDIR)
292
293 clean:
294 -$(MAKE) -C language clean
295 -$(MAKE) -C src clean
296 -$(MAKE) -C coq-lib clean
297 -$(MAKE) -C ocaml-lib clean
298 -$(MAKE) -C tex-lib clean
299 -rm -f coq-lib/Makefile
300 -rm -f coq-lib/coqharness.vo
301 -rm -f coq-lib/coqharness.glob
302 -rm -rf src/version.ml lem library/lib_cache src/share_directory.ml
303 #-rm -rf lem_dep.tex lem_dep.pdf lem_dep.aux lem_dep.log
304
305 cleanall: clean
306 -$(MAKE) -C doc clean
307 -$(MAKE) -C slides clean
308 -$(MAKE) -C manual cleanall
309 -$(MAKE) -C ocaml-lib clean
310 -$(MAKE) -C tests clean
311 -rm -rf lem-$(LEMVERSION) lem-$(LEMVERSION).tar.gz