Debian Codegraph @

Makefile

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