3 include ../Makefile.defs
8 OCAML_FLAGS = -pp $(CAMLP4O)
9 PKGS = -package "$(MATITA_REQUIRES)"
10 CPKGS = -package "$(MATITA_CREQUIRES)"
11 OCAML_THREADS_FLAGS = -thread
12 OCAML_DEBUG_FLAGS = -g
13 OCAMLC_FLAGS = $(OCAML_FLAGS) $(OCAML_THREADS_FLAGS)
14 OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS)
15 OCAMLOPT = $(OCAMLFIND) opt $(OCAMLC_FLAGS)
16 OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAML_FLAGS)
18 MATITA_FLAGS = -noprofile
24 # objects for matita (GTK GUI)
35 matitaGeneratedGui.cmo \
37 applyTransformation.cmo \
41 # objects for matitac (batch compiler)
57 PROGRAMS_BYTE = matita matitac cicbrowser matitadep matitaclean matitamake dump_moo
58 PROGRAMS = $(PROGRAMS_BYTE) matitatop
59 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
63 # all: matita.conf.xml $(PROGRAMS) coq.moo
65 # matita.conf.xml: matita.conf.xml.sample
66 # @if diff matita.conf.xml.sample matita.conf.xml 1>/dev/null 2>/dev/null; then\
67 # touch matita.conf.xml;\
70 # echo "matita.conf.xml.sample is newer than matita.conf.xml";\
72 # echo "PLEASE update your configuration file!";\
73 # echo "(copying matita.conf.xml.sample should work)";\
78 # coq.moo: library/legacy/coq.ma matitac
79 # ./matitac $(MATITA_FLAGS) $<
80 # coq.moo.opt: library/legacy/coq.ma matitac.opt
81 # ./matitac.opt $(MATITA_FLAGS) $<
83 ifeq ($(HAVE_OCAMLOPT),yes)
85 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
86 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
87 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
88 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES))
89 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
90 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
91 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
93 opt: $(PROGRAMS_OPT) coq.moo.opt
95 upx: $(PROGRAMS_UPX) coq.moo.opt
100 @echo "Native code compilation is disabled"
104 matita: matita.ml $(LIB_DEPS) $(CMOS)
106 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
107 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
109 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
111 dump_moo: dump_moo.ml buildTimeConf.cmo
113 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ buildTimeConf.cmo $<
114 dump_moo.opt: dump_moo.ml buildTimeConf.cmx
116 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ buildTimeConf.cmx $<
118 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
120 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
121 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
123 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
125 matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS)
127 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $<
130 @test -f $@ || ln -s $< $@
131 matitadep.opt: matitac.opt
132 @test -f $@ || ln -s $< $@
135 @test -f $@ || ln -s $< $@
136 matitaclean.opt: matitac.opt
137 @test -f $@ || ln -s $< $@
140 @test -f $@ || ln -s $< $@
141 matitamake.opt: matitac.opt
142 @test -f $@ || ln -s $< $@
145 @test -f $@ || ln -s $< $@
146 cicbrowser.opt: matita.opt
147 @test -f $@ || ln -s $< $@
149 matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade
150 $(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
151 $(OCAMLC) $(PKGS) -i matitaGeneratedGui.ml > matitaGeneratedGui.mli
155 rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
166 contribs/LAMBDA-TYPES \
167 contribs/PREDICATIVE-TOPOLOGY \
170 .PHONY: tests tests.opt cleantests cleantests.opt
171 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
172 tests.opt: $(foreach d,$(TEST_DIRS),$(d)-test-opt)
173 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
174 cleantests.opt: $(foreach d,$(TEST_DIRS),$(d)-cleantests-opt)
176 %-test: matitac matitadep matitaclean coq.moo
177 -cd $* && make -k clean all
178 %-test-opt: matitac.opt matitadep.opt matitaclean.opt coq.moo.opt
179 -cd $* && make -k clean.opt opt
180 %-cleantests: matitaclean
182 %-cleantests-opt: matitaclean.opt
183 -cd $* && make clean.opt
185 # {{{ Distribution stuff
187 ifeq ($(wildcard matitac.opt),matitac.opt)
194 @echo "MATITACLEAN all"
195 $(H)./matitaclean -system -conffile `pwd`/matita.conf.xml.build all
196 @echo "MATITAMAKE init"
197 $(H)MATITA_RT_BASE_DIR=`pwd` \
198 MATITA_FLAGS="-system -conffile `pwd`/matita.conf.xml.build" \
199 ./matitamake -conffile `pwd`/matita.conf.xml.build \
200 init build_stdlib `pwd`/library
201 @echo "MATITAMAKE build"
202 $(H)MATITA_RT_BASE_DIR=`pwd` \
203 MATITA_FLAGS="-system -conffile `pwd`/matita.conf.xml.build" \
204 ./matitamake -conffile `pwd`/matita.conf.xml.build \
207 # MATITA_RT_BASE_DIR=`pwd` \
208 $(MAKE) MATITA_FLAGS="-system -conffile `pwd`/matita.conf.xml.build" -C library/ $(BEST)
219 gtkmathview.matita.conf.xml \
220 template_makefile.in \
224 ifeq ($(HAVE_OCAMLOPT),yes)
225 INSTALL_STUFF += $(PROGRAMS_OPT)
231 cp -a $(INSTALL_STUFF) $(DEST)
234 STATIC_LINK = dist/static_link/static_link
238 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
240 gdome gmetadom_gdome_cpp_smart \
245 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
252 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
253 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
255 ifeq ($(HAVE_OCAMLOPT),yes)
256 static: $(STATIC_LINK) $(PROGRAMS_STATIC) coq.moo.opt
259 @echo "Native code compilation is disabled"
261 @echo "Native code compilation is disabled"
265 $(MAKE) -C dist/ $(STATIC_LINK)
267 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
268 $(STATIC_LINK) $(STATIC_LIBS) -- \
269 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
272 dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml
273 $(STATIC_LINK) $(STATIC_CLIBS) -- \
274 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \
275 $(STATIC_EXTRA_CLIBS)
277 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
278 $(STATIC_LINK) $(STATIC_CLIBS) -- \
279 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
280 $(STATIC_EXTRA_CLIBS)
282 matitadep.opt.static: matitac.opt.static
283 @test -f $@ || ln -s $< $@
284 matitaclean.opt.static: matitac.opt.static
285 @test -f $@ || ln -s $< $@
286 matitamake.opt.static: matitac.opt.static
287 @test -f $@ || ln -s $< $@
288 cicbrowser.opt.static: matita.opt.static
289 @test -f $@ || ln -s $< $@
290 cicbrowser.opt.static.upx: matita.opt.static.upx
291 @test -f $@ || ln -s $< $@
295 $(MAKE) -C dist/ clean
296 rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
297 rm -f buildTimeConf.ml
298 rm -f matita.glade.bak matita.gladep.bak
299 rm -f matita.conf.xml.sample
306 # }}} End of distribution stuff
311 cd ..; otags -vi -r components/ matita/
313 #.depend: matitaGeneratedGui.ml matitaGeneratedGui.mli *.ml *.mli
317 $(OCAMLDEP) *.ml *.mli > .depend
323 $(H)$(OCAMLC) $(PKGS) -c $<
326 $(H)$(OCAMLC) $(PKGS) -c $<
329 $(H)$(OCAMLOPT) $(PKGS) -c $<
331 @echo "OCAMLC -dtypes $<"
332 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
335 $(CMOS:%.cmo=%.cmx): $(LIBX_DEPS)
337 ifeq ($(MAKECMDGOALS),all)
338 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
340 ifeq ($(MAKECMDGOALS),)
341 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
343 ifeq ($(MAKECMDGOALS),opt)
344 $(CMOS:%.cmo=%.cmi): $(LIBX_DEPS)
347 # vim: set foldmethod=marker: