5 MAKEFLAGS+=--no-print-directory
6 OCAMLPATH = ../ocaml/METAS/
7 OCAMLFIND = OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH @OCAMLFIND@
9 LABLGLADECC = @LABLGLADECC@
10 REQUIRES = @FINDLIB_REQUIRES@
11 CREQUIRES = @FINDLIB_CREQUIRES@
12 DEPREQUIRES = @FINDLIB_DEPREQUIRES@
13 CLEANREQUIRES = @FINDLIB_CLEANREQUIRES@
14 MAKEREQUIRES = @FINDLIB_MAKEREQUIRES@
15 HAVE_OCAMLOPT = @HAVE_OCAMLOPT@
17 OCAML_FLAGS = -pp $(CAMLP4O)
18 PKGS = -package "$(REQUIRES)"
19 CPKGS = -package "$(CREQUIRES)"
20 DEPPKGS = -package "$(DEPREQUIRES)"
21 CLEANPKGS = -package "$(CLEANREQUIRES)"
22 MAKEPKGS = -package "$(MAKEREQUIRES)"
23 OCAML_THREADS_FLAGS = -thread
24 OCAML_DEBUG_FLAGS = -g
25 OCAMLC_FLAGS = $(OCAML_FLAGS) $(OCAML_THREADS_FLAGS)
26 OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS)
27 OCAMLOPT = $(OCAMLFIND) opt $(OCAMLC_FLAGS)
28 OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAML_FLAGS)
30 MATITA_FLAGS = -noprofile
36 # objects for matita (GTK GUI)
47 matitaGeneratedGui.cmo \
49 applyTransformation.cmo \
53 # objects for matitac (batch compiler)
75 PROGRAMS_BYTE = matita matitac cicbrowser matitadep matitaclean matitamake dump_moo
76 PROGRAMS = $(PROGRAMS_BYTE) matitatop
77 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
80 all: matita.conf.xml $(PROGRAMS) coq.moo
82 matita.conf.xml: matita.conf.xml.sample
83 @if diff matita.conf.xml.sample matita.conf.xml 1>/dev/null 2>/dev/null; then\
84 touch matita.conf.xml;\
87 echo "matita.conf.xml.sample is newer than matita.conf.xml";\
89 echo "PLEASE update your configuration file!";\
90 echo "(copying matita.conf.xml.sample should work)";\
95 matita.conf.xml.sample: matita.conf.xml.sample.in
99 @echo "WARNING: The configuration sample file has changed!"
102 coq.moo: coq.ma matitac
103 ./matitac $(MATITA_FLAGS) coq.ma
104 coq.moo.opt: coq.ma matitac.opt
105 ./matitac.opt $(MATITA_FLAGS) coq.ma
107 ifeq ($(HAVE_OCAMLOPT),yes)
109 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
110 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
111 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
112 DEPCMXS = $(patsubst %.cmo,%.cmx,$(DEPCMOS))
113 CLEANCMXS = $(patsubst %.cmo,%.cmx,$(CLEANCMOS))
114 MAKECMXS = $(patsubst %.cmo,%.cmx,$(MAKECMOS))
115 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(REQUIRES))
116 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(REQUIRES))
117 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(CREQUIRES))
118 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(CREQUIRES))
119 DEPLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(DEPREQUIRES))
120 DEPLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(DEPREQUIRES))
121 CLEANLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(CLEANREQUIRES))
122 CLEANLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(CLEANREQUIRES))
123 MAKELIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MAKEREQUIRES))
124 MAKELIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MAKEREQUIRES))
126 opt: $(PROGRAMS_OPT) coq.moo.opt
128 upx: $(PROGRAMS_UPX) coq.moo.opt
133 @echo "Native code compilation is disabled"
137 matita: $(LIB_DEPS) $(CMOS) matita.ml
138 $(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
139 matita.opt: $(LIBX_DEPS) $(CMXS) matita.ml
140 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
142 dump_moo: buildTimeConf.cmo dump_moo.ml
143 $(OCAMLC) $(PKGS) -linkpkg -o $@ $^
144 dump_moo.opt: buildTimeConf.cmx dump_moo.ml
145 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^
147 matitac: $(CLIB_DEPS) $(CCMOS) $(MAINCMOS) matitac.ml
148 $(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
149 matitac.opt: $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
150 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
152 matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS)
153 $(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $<
155 # matitadep: matitadep.ml $(DEPLIB_DEPS) $(DEPCMOS)
156 # $(OCAMLC) $(DEPPKGS) -linkpkg -o $@ $(DEPCMOS) $<
157 # matitadep.opt: matitadep.ml $(DEPLIB_DEPS) $(DEPCMXS)
158 # $(OCAMLOPT) $(DEPPKGS) -linkpkg -o $@ $(DEPCMXS) $<
160 @test -f $@ || ln -s $< $@
161 matitadep.opt: matitac.opt
162 @test -f $@ || ln -s $< $@
164 # matitaclean: matitaclean.ml $(CLEANLIB_DEPS) $(CLEANCMOS)
165 # $(OCAMLC) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMOS) $<
166 # matitaclean.opt: matitaclean.ml $(CLEANLIB_DEPS) $(CLEANCMXS)
167 # $(OCAMLOPT) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMXS) $<
169 @test -f $@ || ln -s $< $@
170 matitaclean.opt: matitac.opt
171 @test -f $@ || ln -s $< $@
173 # matitamake: matitamake.ml $(MAKECMOS)
174 # $(OCAMLC) $(MAKEPKGS) -linkpkg -o $@ $(MAKECMOS) $<
175 # matitamake.opt: matitamake.ml $(MAKECMXS)
176 # $(OCAMLOPT) $(MAKEPKGS) -linkpkg -o $@ $(MAKECMXS) $<
178 @test -f $@ || ln -s $< $@
179 matitamake.opt: matitac.opt
180 @test -f $@ || ln -s $< $@
183 @test -f $@ || ln -s $< $@
184 cicbrowser.opt: matita.opt
185 @test -f $@ || ln -s $< $@
187 matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade
188 $(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
189 $(OCAMLC) $(PKGS) -i matitaGeneratedGui.ml > matitaGeneratedGui.mli
193 rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
200 tests: matitac matitadep matitaclean
201 @-(cd library && make -k clean all)
202 @-(cd tests && make -k clean all)
203 @-(cd tests/bad_tests && make -k clean all)
204 @-(cd contribs/LAMBDA-TYPES && make -k clean all)
205 @-(cd contribs/PREDICATIVE-TOPOLOGY && make -k clean all)
206 tests.opt: matitac.opt matitadep.opt matitaclean.opt
207 @-(cd library && make -k clean.opt opt)
208 @-(cd tests && make -k clean.opt opt)
209 @-(cd tests/bad_tests && make -k clean.opt opt)
210 @-(cd contribs/LAMBDA-TYPES && make -k clean.opt opt)
211 @-(cd contribs/PREDICATIVE-TOPOLOGY && make -k clean.opt opt)
212 cleantests: matitaclean
213 @(cd library && make clean)
214 @(cd tests && make clean)
215 @(cd tests/bad_tests && make clean)
216 @(cd contribs/LAMBDA-TYPES && make clean)
217 @(cd contribs/PREDICATIVE-TOPOLOGY && make clean)
218 cleantests.opt: matitaclean.opt
219 @(cd library && make clean.opt)
220 @(cd tests && make clean.opt)
221 @(cd tests/bad_tests && make clean)
222 @(cd contribs/LAMBDA-TYPES && make clean.opt)
223 @(cd contribs/PREDICATIVE-TOPOLOGY && make clean.opt)
224 .PHONY: tests tests.opt cleantests cleantests.opt
226 # {{{ Distribution stuff
228 STATIC_LINK = dist/static_link/static_link
232 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
234 gdome gmetadom_gdome_cpp_smart \
239 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
246 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
247 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
249 ifeq ($(HAVE_OCAMLOPT),yes)
250 static: $(STATIC_LINK) $(PROGRAMS_STATIC) coq.moo.opt
253 @echo "Native code compilation is disabled"
255 @echo "Native code compilation is disabled"
259 $(MAKE) -C dist/ $(STATIC_LINK)
261 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
262 $(STATIC_LINK) $(STATIC_LIBS) -- \
263 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
266 dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml
267 $(STATIC_LINK) $(STATIC_CLIBS) -- \
268 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \
269 $(STATIC_EXTRA_CLIBS)
271 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
272 $(STATIC_LINK) $(STATIC_CLIBS) -- \
273 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
274 $(STATIC_EXTRA_CLIBS)
276 # matitadep.opt.static: $(STATIC_LINK) matitadep.ml $(DEPLIB_DEPS) $(DEPCMXS)
277 # $(STATIC_LINK) $(STATIC_CLIBS) -- \
278 # $(OCAMLOPT) $(DEPPKGS) -linkpkg -o $@ $(DEPCMXS) $< \
279 # $(STATIC_EXTRA_CLIBS)
281 matitadep.opt.static: matitac.opt.static
282 @test -f $@ || ln -s $< $@
283 # matitaclean.opt.static: $(STATIC_LINK) matitaclean.ml $(CLEANLIB_DEPS) $(CLEANCMXS)
284 # $(STATIC_LINK) $(STATIC_CLIBS) -- \
285 # $(OCAMLOPT) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMXS) $< \
286 # $(STATIC_EXTRA_CLIBS)
288 matitaclean.opt.static: matitac.opt.static
289 @test -f $@ || ln -s $< $@
290 # matitamake.opt.static: $(STATIC_LINK) matitamake.ml $(MAKECMXS)
291 # $(STATIC_LINK) $(STATIC_CLIBS) -- \
292 # $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(MAKECMXS) $< \
293 # $(STATIC_EXTRA_CLIBS)
295 matitamake.opt.static: matitac.opt.static
296 @test -f $@ || ln -s $< $@
297 cicbrowser.opt.static: matita.opt.static
298 @test -f $@ || ln -s $< $@
299 cicbrowser.opt.static.upx: matita.opt.static.upx
300 @test -f $@ || ln -s $< $@
304 $(MAKE) -C dist/ clean
305 rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
306 rm -f config.log config.status Makefile buildTimeConf.ml
307 rm -f matita.glade.bak matita.gladep.bak
308 rm -rf autom4te.cache/
309 rm -f configure matita.conf.xml.sample
316 # }}} End of distribution stuff
321 cd ..; otags -vi -r ocaml/ matita/
323 #.depend: matitaGeneratedGui.ml matitaGeneratedGui.mli *.ml *.mli
327 $(OCAMLDEP) *.ml *.mli > .depend
332 $(OCAMLC) $(PKGS) -c $<
334 $(OCAMLC) $(PKGS) -c $<
336 $(OCAMLOPT) $(PKGS) -c $<
338 $(OCAMLC) -dtypes $(PKGS) -c $<
341 $(CMOS:%.cmo=%.cmx): $(LIBX_DEPS)
343 ifeq ($(MAKECMDGOALS),all)
344 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
346 ifeq ($(MAKECMDGOALS),)
347 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
349 ifeq ($(MAKECMDGOALS),opt)
350 $(CMOS:%.cmo=%.cmi): $(LIBX_DEPS)
353 # vim: set foldmethod=marker: