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
120 $(H)echo " OCAMLC matita.ml"
121 $(H)$(OCAMLC) $(PKGS) -linkpkg -o matita $(CMOS) matita.ml
123 matita: matita.ml $(LIB_DEPS) $(CMOS)
124 $(H)echo " OCAMLC $<"
125 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
126 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
127 $(H)echo " OCAMLOPT $<"
128 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
130 dump_moo: dump_moo.ml buildTimeConf.cmo
131 $(H)echo " OCAMLC $<"
132 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ buildTimeConf.cmo $<
133 dump_moo.opt: dump_moo.ml buildTimeConf.cmx
134 $(H)echo "OCAMLOPT $<"
135 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ buildTimeConf.cmx $<
137 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
138 $(H)echo " OCAMLC $<"
139 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
140 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
141 $(H)echo " OCAMLOPT $<"
142 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
144 matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS)
145 $(H)echo " OCAMLC $<"
146 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $<
148 matitaprover: matitac
149 $(H)test -f $@ || ln -s $< $@
150 matitaprover.opt: matitac.opt
151 $(H)test -f $@ || ln -s $< $@
154 $(H)test -f $@ || ln -s $< $@
155 matitadep.opt: matitac.opt
156 $(H)test -f $@ || ln -s $< $@
159 $(H)test -f $@ || ln -s $< $@
160 matitaclean.opt: matitac.opt
161 $(H)test -f $@ || ln -s $< $@
164 $(H)test -f $@ || ln -s $< $@
165 matitamake.opt: matitac.opt
166 $(H)test -f $@ || ln -s $< $@
169 $(H)test -f $@ || ln -s $< $@
170 gragrep.opt: matitac.opt
171 $(H)test -f $@ || ln -s $< $@
174 $(H)test -f $@ || ln -s $< $@
175 cicbrowser.opt: matita.opt
176 $(H)test -f $@ || ln -s $< $@
178 matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade
179 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
180 $(H)rm -f matitaGeneratedGui.mli
181 $(H)#$(OCAMLC) $(PKGS) -i matitaGeneratedGui.ml > matitaGeneratedGui.mli
185 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
186 $(PROGRAMS) $(PROGRAMS_OPT) \
187 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
194 $(H)$(MAKE) -C dist/ clean
195 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
196 $(H)rm -f buildTimeConf.ml
197 $(H)rm -f matita.glade.bak matita.gladep.bak
198 $(H)rm -f matita.conf.xml.sample
205 # contribs/LAMBDA-TYPES \
206 # contribs/PREDICATIVE-TOPOLOGY \
208 .PHONY: tests tests.opt cleantests cleantests.opt
209 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
210 tests.opt: $(foreach d,$(TEST_DIRS),$(d)-test-opt)
211 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
212 cleantests.opt: $(foreach d,$(TEST_DIRS),$(d)-cleantests-opt)
214 %-test: matitac matitadep matitaclean
215 -cd $* && make -k clean all
216 %-test-opt: matitac.opt matitadep.opt matitaclean.opt
217 -cd $* && make -k clean.opt opt
218 %-cleantests: matitaclean
220 %-cleantests-opt: matitaclean.opt
221 -cd $* && make clean.opt
223 # {{{ Distribution stuff
225 ifeq ($(DISTRIBUTED),yes)
227 dist_library: dist_library@standard-library
229 $(H)echo "MATITAMAKE init $*"
230 $(H)(cd $(DESTDIR) && ./matitamake init $* $(DESTDIR)/ma/$*)
231 $(H)echo "MATITAMAKE publish $*"
232 $(H)(cd $(DESTDIR) && ./matitamake publish $*)
233 $(H)echo "MATITAMAKE destroy $*"
234 $(H)(cd $(DESTDIR) && ./matitamake destroy $*)
239 dist_pre: matitaGeneratedGui.ml matitaGeneratedGui.mli
240 $(MAKE) -C dist/ dist_pre
242 DESTDIR = $(RT_BASE_DIR)
252 gtkmathview.matita.conf.xml \
253 template_makefile.in \
258 ifeq ($(HAVE_OCAMLOPT),yes)
259 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
261 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
264 install: install_preliminaries dist_library install_conclusion
266 install_preliminaries:
267 install -d $(DESTDIR)/ma/
268 cp -a $(INSTALL_STUFF) $(DESTDIR)
269 ifeq ($(HAVE_OCAMLOPT),yes)
270 install -s $(INSTALL_STUFF_BIN) $(DESTDIR)
271 for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(DESTDIR)/$$p; done
273 install $(INSTALL_STUFF_BIN) $(DESTDIR)
275 for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
276 ln -fs matitac $(DESTDIR)/$$p;\
278 for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
279 ln -fs matita $(DESTDIR)/$$p;\
281 cp -a library/ $(DESTDIR)/ma/standard-library
282 cp -a contribs/ $(DESTDIR)/ma/
289 STATIC_LINK = dist/static_link/static_link
293 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
295 gdome gmetadom_gdome_cpp_smart \
300 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
306 STATIC_CLIBS_PROVER = \
315 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
316 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
318 ifeq ($(HAVE_OCAMLOPT),yes)
319 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
322 $(H)echo "Native code compilation is disabled"
324 $(H)echo "Native code compilation is disabled"
328 $(MAKE) -C dist/ $(STATIC_LINK)
330 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
331 $(STATIC_LINK) $(STATIC_LIBS) -- \
332 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
335 dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml
336 $(STATIC_LINK) $(STATIC_CLIBS) -- \
337 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \
338 $(STATIC_EXTRA_CLIBS)
340 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
341 $(STATIC_LINK) $(STATIC_CLIBS) -- \
342 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
343 $(STATIC_EXTRA_CLIBS)
345 matitaprover.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
346 $(STATIC_LINK) $(STATIC_CLIBS_PROVER) -- \
347 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
348 $(STATIC_EXTRA_CLIBS);
350 matitadep.opt.static: matitac.opt.static
351 $(H)test -f $@ || ln -s $< $@
352 matitaclean.opt.static: matitac.opt.static
353 $(H)test -f $@ || ln -s $< $@
354 matitamake.opt.static: matitac.opt.static
355 $(H)test -f $@ || ln -s $< $@
356 cicbrowser.opt.static: matita.opt.static
357 $(H)test -f $@ || ln -s $< $@
358 cicbrowser.opt.static.upx: matita.opt.static.upx
359 $(H)test -f $@ || ln -s $< $@
366 # }}} End of distribution stuff
371 $(H)cd ..; otags -vi -r components/ matita/
373 #.depend: matitaGeneratedGui.ml matitaGeneratedGui.mli *.ml *.mli
379 $(H)$(OCAMLDEP) *.ml *.mli > .depend
381 $(H)echo " OCAMLDEP -native"
382 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend
384 ifneq ($(MAKECMDGOALS), depend)
385 ifneq ($(MAKECMDGOALS), depend.opt)
391 $(H)echo " OCAMLC $<"
392 $(H)$(OCAMLC) $(PKGS) -c $<
394 $(H)echo " OCAMLC $<"
395 $(H)$(OCAMLC) $(PKGS) -c $<
397 $(H)echo " OCAMLOPT $<"
398 $(H)$(OCAMLOPT) $(PKGS) -c $<
400 $(H)echo " OCAMLC -dtypes $<"
401 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
404 $(CMOS:%.cmo=%.cmx): $(LIBX_DEPS)
406 ifeq ($(MAKECMDGOALS),all)
407 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
409 ifeq ($(MAKECMDGOALS),)
410 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
412 ifeq ($(MAKECMDGOALS),opt)
413 $(CMOS:%.cmo=%.cmi): $(LIBX_DEPS)
416 # vim: set foldmethod=marker: