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)
17 INSTALL_PROGRAMS= matita matitac
18 INSTALL_PROGRAMS_LINKS_MATITA= cicbrowser
19 INSTALL_PROGRAMS_LINKS_MATITAC= matitadep matitamake matitaclean matitaprover matitawiki
21 MATITA_FLAGS = -noprofile
27 # objects for matita (GTK GUI)
37 applyTransformation.cmo \
42 matitaGeneratedGui.cmo \
46 # objects for matitac (batch compiler)
55 applyTransformation.cmo \
67 matita matitac cicbrowser matitadep matitaclean matitamake matitaprover matitawiki
68 PROGRAMS = $(PROGRAMS_BYTE) matitatop
69 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
70 NOINST_PROGRAMS = dump_moo gragrep
71 NOINST_PROGRAMS_OPT = $(patsubst %,%.opt,$(EXTRA_PROGRAMS))
74 all: $(PROGRAMS) $(NOINST_PROGRAMS)
75 # all: matita.conf.xml $(PROGRAMS) coq.moo
77 # matita.conf.xml: matita.conf.xml.sample
78 # $(H)if diff matita.conf.xml.sample matita.conf.xml 1>/dev/null 2>/dev/null; then\
79 # touch matita.conf.xml;\
82 # echo "matita.conf.xml.sample is newer than matita.conf.xml";\
84 # echo "PLEASE update your configuration file!";\
85 # echo "(copying matita.conf.xml.sample should work)";\
90 # coq.moo: library/legacy/coq.ma matitac
91 # ./matitac $(MATITA_FLAGS) $<
92 # coq.moo.opt: library/legacy/coq.ma matitac.opt
93 # ./matitac.opt $(MATITA_FLAGS) $<
95 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
96 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
97 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
98 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES))
99 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
100 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
101 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
102 opt: $(PROGRAMS_OPT) $(NOINST_PROGRAMS_OPT)
106 ifeq ($(HAVE_OCAMLOPT),yes)
107 world: depend.opt opt links
114 $(H)for X in $(INSTALL_PROGRAMS_LINKS_MATITAC) \
115 $(INSTALL_PROGRAMS_LINKS_MATITA); do\
118 $(H)ln -sf matita.opt matita
119 $(H)ln -sf matitac.opt matitac
122 $(H)echo " OCAMLC matita.ml"
123 $(H)$(OCAMLC) $(PKGS) -linkpkg -o matita $(CMOS) matita.ml
124 $(H)echo " OCAMLC matitac.ml"
125 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o matitac $(CCMOS) $(MAINCMOS) matitac.ml
127 matita: matita.ml $(LIB_DEPS) $(CMOS)
128 $(H)echo " OCAMLC $<"
129 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
130 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
131 $(H)echo " OCAMLOPT $<"
132 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
134 dump_moo: dump_moo.ml buildTimeConf.cmo
135 $(H)echo " OCAMLC $<"
136 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ buildTimeConf.cmo $<
137 dump_moo.opt: dump_moo.ml buildTimeConf.cmx
138 $(H)echo "OCAMLOPT $<"
139 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ buildTimeConf.cmx $<
141 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
142 $(H)echo " OCAMLC $<"
143 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
144 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
145 $(H)echo " OCAMLOPT $<"
146 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
148 matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS)
149 $(H)echo " OCAMLC $<"
150 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $<
152 matitaprover: matitac
153 $(H)test -f $@ || ln -s $< $@
154 matitaprover.opt: matitac.opt
155 $(H)test -f $@ || ln -s $< $@
158 $(H)test -f $@ || ln -s $< $@
159 matitadep.opt: matitac.opt
160 $(H)test -f $@ || ln -s $< $@
163 $(H)test -f $@ || ln -s $< $@
164 matitawiki.opt: matitac.opt
165 $(H)test -f $@ || ln -s $< $@
168 $(H)test -f $@ || ln -s $< $@
169 matitaclean.opt: matitac.opt
170 $(H)test -f $@ || ln -s $< $@
173 $(H)test -f $@ || ln -s $< $@
174 matitamake.opt: matitac.opt
175 $(H)test -f $@ || ln -s $< $@
178 $(H)test -f $@ || ln -s $< $@
179 gragrep.opt: matitac.opt
180 $(H)test -f $@ || ln -s $< $@
183 $(H)test -f $@ || ln -s $< $@
184 cicbrowser.opt: matita.opt
185 $(H)test -f $@ || ln -s $< $@
187 matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade
188 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
189 $(H)rm -f matitaGeneratedGui.mli
190 $(H)#$(OCAMLC) $(PKGS) -i matitaGeneratedGui.ml > matitaGeneratedGui.mli
194 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
195 $(PROGRAMS) $(PROGRAMS_OPT) \
196 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
203 $(H)$(MAKE) -C dist/ clean
204 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
205 $(H)rm -f buildTimeConf.ml
206 $(H)rm -f matita.glade.bak matita.gladep.bak
207 $(H)rm -f matita.conf.xml.sample
216 contribs/RELATIONAL \
217 contribs/LAMBDA-TYPES \
218 contribs/PREDICATIVE-TOPOLOGY \
221 .PHONY: tests tests.opt cleantests cleantests.opt
222 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
223 tests.opt: $(foreach d,$(TEST_DIRS),$(d)-test-opt)
224 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
225 cleantests.opt: $(foreach d,$(TEST_DIRS),$(d)-cleantests-opt)
227 %-test: matitac matitadep matitaclean
228 -cd $* && make -k clean all
229 %-test-opt: matitac.opt matitadep.opt matitaclean.opt
230 -cd $* && make -k clean.opt opt
231 %-cleantests: matitaclean
233 %-cleantests-opt: matitaclean.opt
234 -cd $* && make clean.opt
236 # {{{ Distribution stuff
238 ifeq ($(DISTRIBUTED),yes)
240 dist_library: dist_library@standard-library
242 $(H)echo "MATITAMAKE init $*"
243 $(H)(cd $(DESTDIR) && ./matitamake init $* $(DESTDIR)/ma/$*)
244 $(H)echo "MATITAMAKE publish $*"
245 $(H)(cd $(DESTDIR) && ./matitamake publish $*)
246 $(H)echo "MATITAMAKE destroy $*"
247 $(H)(cd $(DESTDIR) && ./matitamake destroy $*)
252 dist_pre: matitaGeneratedGui.ml matitaGeneratedGui.mli
253 $(MAKE) -C dist/ dist_pre
255 DESTDIR = $(RT_BASE_DIR)
265 gtkmathview.matita.conf.xml \
266 template_makefile.in \
271 ifeq ($(HAVE_OCAMLOPT),yes)
272 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
274 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
277 install: install_preliminaries dist_library install_conclusion
279 install_preliminaries:
280 install -d $(DESTDIR)/ma/
281 cp -a $(INSTALL_STUFF) $(DESTDIR)
282 ifeq ($(HAVE_OCAMLOPT),yes)
283 install -s $(INSTALL_STUFF_BIN) $(DESTDIR)
284 for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(DESTDIR)/$$p; done
286 install $(INSTALL_STUFF_BIN) $(DESTDIR)
288 for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
289 ln -fs matitac $(DESTDIR)/$$p;\
291 for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
292 ln -fs matita $(DESTDIR)/$$p;\
294 cp -a library/ $(DESTDIR)/ma/standard-library
295 cp -a contribs/ $(DESTDIR)/ma/
302 STATIC_LINK = dist/static_link/static_link
306 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
308 gdome gmetadom_gdome_cpp_smart \
313 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
319 STATIC_CLIBS_PROVER = \
328 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
329 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
331 ifeq ($(HAVE_OCAMLOPT),yes)
332 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
335 $(H)echo "Native code compilation is disabled"
337 $(H)echo "Native code compilation is disabled"
341 $(MAKE) -C dist/ $(STATIC_LINK)
343 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
344 $(STATIC_LINK) $(STATIC_LIBS) -- \
345 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
348 dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml
349 $(STATIC_LINK) $(STATIC_CLIBS) -- \
350 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \
351 $(STATIC_EXTRA_CLIBS)
353 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
354 $(STATIC_LINK) $(STATIC_CLIBS) -- \
355 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
356 $(STATIC_EXTRA_CLIBS)
358 matitaprover.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
359 $(STATIC_LINK) $(STATIC_CLIBS_PROVER) -- \
360 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
361 $(STATIC_EXTRA_CLIBS);
363 matitadep.opt.static: matitac.opt.static
364 $(H)test -f $@ || ln -s $< $@
365 matitaclean.opt.static: matitac.opt.static
366 $(H)test -f $@ || ln -s $< $@
367 matitawiki.opt.static: matitac.opt.static
368 $(H)test -f $@ || ln -s $< $@
369 matitamake.opt.static: matitac.opt.static
370 $(H)test -f $@ || ln -s $< $@
371 cicbrowser.opt.static: matita.opt.static
372 $(H)test -f $@ || ln -s $< $@
373 cicbrowser.opt.static.upx: matita.opt.static.upx
374 $(H)test -f $@ || ln -s $< $@
381 # }}} End of distribution stuff
386 $(H)cd ..; otags -vi -r components/ matita/
388 #.depend: matitaGeneratedGui.ml matitaGeneratedGui.mli *.ml *.mli
394 $(H)$(OCAMLDEP) *.ml *.mli > .depend
396 $(H)echo " OCAMLDEP -native"
397 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt
399 ifeq ($(MAKECMDGOALS),)
403 ifeq ($(MAKECMDGOALS), all)
407 ifeq ($(MAKECMDGOALS), opt)
412 $(H)echo " OCAMLC $<"
413 $(H)$(OCAMLC) $(PKGS) -c $<
415 $(H)echo " OCAMLC $<"
416 $(H)$(OCAMLC) $(PKGS) -c $<
418 $(H)echo " OCAMLOPT $<"
419 $(H)$(OCAMLOPT) $(PKGS) -c $<
421 $(H)echo " OCAMLC -dtypes $<"
422 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
425 $(CMOS:%.cmo=%.cmx): $(LIBX_DEPS)
430 ./dep2dot.rb < $< | tred > $@
432 ifeq ($(MAKECMDGOALS),all)
433 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
435 ifeq ($(MAKECMDGOALS),)
436 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
438 ifeq ($(MAKECMDGOALS),opt)
439 $(CMOS:%.cmo=%.cmi): $(LIBX_DEPS)
442 # vim: set foldmethod=marker: