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
21 MATITA_FLAGS = -noprofile
27 # objects for matita (GTK GUI)
39 applyTransformation.cmo \
42 matitaGeneratedGui.cmo \
46 # objects for matitac (batch compiler)
65 matita matitac cicbrowser matitadep matitaclean matitamake matitaprover
66 PROGRAMS = $(PROGRAMS_BYTE) matitatop
67 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
68 NOINST_PROGRAMS = dump_moo gragrep
69 NOINST_PROGRAMS_OPT = $(patsubst %,%.opt,$(EXTRA_PROGRAMS))
72 all: $(PROGRAMS) $(NOINST_PROGRAMS)
73 # all: matita.conf.xml $(PROGRAMS) coq.moo
75 # matita.conf.xml: matita.conf.xml.sample
76 # $(H)if diff matita.conf.xml.sample matita.conf.xml 1>/dev/null 2>/dev/null; then\
77 # touch matita.conf.xml;\
80 # echo "matita.conf.xml.sample is newer than matita.conf.xml";\
82 # echo "PLEASE update your configuration file!";\
83 # echo "(copying matita.conf.xml.sample should work)";\
88 # coq.moo: library/legacy/coq.ma matitac
89 # ./matitac $(MATITA_FLAGS) $<
90 # coq.moo.opt: library/legacy/coq.ma matitac.opt
91 # ./matitac.opt $(MATITA_FLAGS) $<
93 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
94 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
95 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
96 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES))
97 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
98 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
99 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
100 opt: $(PROGRAMS_OPT) $(NOINST_PROGRAMS_OPT)
104 ifeq ($(HAVE_OCAMLOPT),yes)
105 world: depend.opt opt links
112 $(H)for X in $(INSTALL_PROGRAMS_LINKS_MATITAC) \
113 $(INSTALL_PROGRAMS_LINKS_MATITA); do\
116 $(H)ln -sf matita.opt matita
117 $(H)ln -sf matitac.opt matitac
119 matita: matita.ml $(LIB_DEPS) $(CMOS)
120 $(H)echo " OCAMLC $<"
121 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
122 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
123 $(H)echo " OCAMLOPT $<"
124 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
126 dump_moo: dump_moo.ml buildTimeConf.cmo
127 $(H)echo " OCAMLC $<"
128 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ buildTimeConf.cmo $<
129 dump_moo.opt: dump_moo.ml buildTimeConf.cmx
130 $(H)echo "OCAMLOPT $<"
131 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ buildTimeConf.cmx $<
133 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
134 $(H)echo " OCAMLC $<"
135 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
136 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
137 $(H)echo " OCAMLOPT $<"
138 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
140 matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS)
141 $(H)echo " OCAMLC $<"
142 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $<
144 matitaprover: matitac
145 $(H)test -f $@ || ln -s $< $@
146 matitaprover.opt: matitac.opt
147 $(H)test -f $@ || ln -s $< $@
150 $(H)test -f $@ || ln -s $< $@
151 matitadep.opt: matitac.opt
152 $(H)test -f $@ || ln -s $< $@
155 $(H)test -f $@ || ln -s $< $@
156 matitaclean.opt: matitac.opt
157 $(H)test -f $@ || ln -s $< $@
160 $(H)test -f $@ || ln -s $< $@
161 matitamake.opt: matitac.opt
162 $(H)test -f $@ || ln -s $< $@
165 $(H)test -f $@ || ln -s $< $@
166 gragrep.opt: matitac.opt
167 $(H)test -f $@ || ln -s $< $@
170 $(H)test -f $@ || ln -s $< $@
171 cicbrowser.opt: matita.opt
172 $(H)test -f $@ || ln -s $< $@
174 matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade
175 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
176 $(H)rm -f matitaGeneratedGui.mli
177 $(H)#$(OCAMLC) $(PKGS) -i matitaGeneratedGui.ml > matitaGeneratedGui.mli
181 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
182 $(PROGRAMS) $(PROGRAMS_OPT) \
183 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
190 $(H)$(MAKE) -C dist/ clean
191 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
192 $(H)rm -f buildTimeConf.ml
193 $(H)rm -f matita.glade.bak matita.gladep.bak
194 $(H)rm -f matita.conf.xml.sample
200 contribs/LAMBDA-TYPES \
201 contribs/PREDICATIVE-TOPOLOGY \
204 .PHONY: tests tests.opt cleantests cleantests.opt
205 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
206 tests.opt: $(foreach d,$(TEST_DIRS),$(d)-test-opt)
207 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
208 cleantests.opt: $(foreach d,$(TEST_DIRS),$(d)-cleantests-opt)
210 %-test: matitac matitadep matitaclean
211 -cd $* && make -k clean all
212 %-test-opt: matitac.opt matitadep.opt matitaclean.opt
213 -cd $* && make -k clean.opt opt
214 %-cleantests: matitaclean
216 %-cleantests-opt: matitaclean.opt
217 -cd $* && make clean.opt
219 # {{{ Distribution stuff
221 ifeq ($(DISTRIBUTED),yes)
223 dist_library: dist_library@standard-library
225 $(H)echo "MATITAMAKE init $*"
226 $(H)(cd $(DESTDIR) && ./matitamake init $* $(DESTDIR)/ma/$*)
227 $(H)echo "MATITAMAKE publish $*"
228 $(H)(cd $(DESTDIR) && ./matitamake publish $*)
229 $(H)echo "MATITAMAKE destroy $*"
230 $(H)(cd $(DESTDIR) && ./matitamake destroy $*)
235 dist_pre: matitaGeneratedGui.ml matitaGeneratedGui.mli
236 $(MAKE) -C dist/ dist_pre
238 DESTDIR = $(RT_BASE_DIR)
248 gtkmathview.matita.conf.xml \
249 template_makefile.in \
254 ifeq ($(HAVE_OCAMLOPT),yes)
255 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
257 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
260 install: install_preliminaries dist_library install_conclusion
262 install_preliminaries:
263 install -d $(DESTDIR)/ma/
264 cp -a $(INSTALL_STUFF) $(DESTDIR)
265 ifeq ($(HAVE_OCAMLOPT),yes)
266 install -s $(INSTALL_STUFF_BIN) $(DESTDIR)
267 for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(DESTDIR)/$$p; done
269 install $(INSTALL_STUFF_BIN) $(DESTDIR)
271 for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
272 ln -fs matitac $(DESTDIR)/$$p;\
274 for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
275 ln -fs matita $(DESTDIR)/$$p;\
277 cp -a library/ $(DESTDIR)/ma/standard-library
278 cp -a contribs/ $(DESTDIR)/ma/
285 STATIC_LINK = dist/static_link/static_link
289 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
291 gdome gmetadom_gdome_cpp_smart \
296 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
302 STATIC_CLIBS_PROVER = \
311 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
312 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
314 ifeq ($(HAVE_OCAMLOPT),yes)
315 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
318 $(H)echo "Native code compilation is disabled"
320 $(H)echo "Native code compilation is disabled"
324 $(MAKE) -C dist/ $(STATIC_LINK)
326 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
327 $(STATIC_LINK) $(STATIC_LIBS) -- \
328 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
331 dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml
332 $(STATIC_LINK) $(STATIC_CLIBS) -- \
333 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \
334 $(STATIC_EXTRA_CLIBS)
336 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
337 $(STATIC_LINK) $(STATIC_CLIBS) -- \
338 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
339 $(STATIC_EXTRA_CLIBS)
341 matitaprover.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
342 $(STATIC_LINK) $(STATIC_CLIBS_PROVER) -- \
343 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
344 $(STATIC_EXTRA_CLIBS);
346 matitadep.opt.static: matitac.opt.static
347 $(H)test -f $@ || ln -s $< $@
348 matitaclean.opt.static: matitac.opt.static
349 $(H)test -f $@ || ln -s $< $@
350 matitamake.opt.static: matitac.opt.static
351 $(H)test -f $@ || ln -s $< $@
352 cicbrowser.opt.static: matita.opt.static
353 $(H)test -f $@ || ln -s $< $@
354 cicbrowser.opt.static.upx: matita.opt.static.upx
355 $(H)test -f $@ || ln -s $< $@
362 # }}} End of distribution stuff
367 $(H)cd ..; otags -vi -r components/ matita/
369 #.depend: matitaGeneratedGui.ml matitaGeneratedGui.mli *.ml *.mli
375 $(H)$(OCAMLDEP) *.ml *.mli > .depend
377 $(H)echo " OCAMLDEP -native"
378 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend
380 ifneq ($(MAKECMDGOALS), depend)
381 ifneq ($(MAKECMDGOALS), depend.opt)
387 $(H)echo " OCAMLC $<"
388 $(H)$(OCAMLC) $(PKGS) -c $<
390 $(H)echo " OCAMLC $<"
391 $(H)$(OCAMLC) $(PKGS) -c $<
393 $(H)echo " OCAMLOPT $<"
394 $(H)$(OCAMLOPT) $(PKGS) -c $<
396 $(H)echo " OCAMLC -dtypes $<"
397 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
400 $(CMOS:%.cmo=%.cmx): $(LIBX_DEPS)
402 ifeq ($(MAKECMDGOALS),all)
403 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
405 ifeq ($(MAKECMDGOALS),)
406 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
408 ifeq ($(MAKECMDGOALS),opt)
409 $(CMOS:%.cmo=%.cmi): $(LIBX_DEPS)
412 # vim: set foldmethod=marker: