3 include ../Makefile.defs
8 OCAML_FLAGS = -pp $(CAMLP5O) -rectypes
9 OCAMLDEP_FLAGS = -pp $(CAMLP5O)
10 PKGS = -package "$(MATITA_REQUIRES)"
11 CPKGS = -package "$(MATITA_CREQUIRES)"
12 OCAML_THREADS_FLAGS = -thread
13 OCAML_DEBUG_FLAGS = -g
15 #OCAMLOPT_DEBUG_FLAGS = -p
16 OCAMLC_FLAGS = $(OCAML_FLAGS) $(OCAML_THREADS_FLAGS)
17 OCAMLC = $(OCAMLFIND) ocamlc$(OCAML_PROF) $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS)
18 OCAMLOPT = $(OCAMLFIND) opt $(OCAMLC_FLAGS) $(OCAMLOPT_DEBUG_FLAGS)
19 OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAMLDEP_FLAGS)
20 INSTALL_PROGRAMS= matita matitac
21 INSTALL_PROGRAMS_LINKS_MATITA=
22 INSTALL_PROGRAMS_LINKS_MATITAC= matitadep matitaclean matitawiki
24 MATITA_FLAGS = -noprofile
36 applyTransformation.mli \
50 applyTransformation.mli \
59 # objects for matita (GTK GUI)
60 ML = buildTimeConf.ml matitaGeneratedGui.ml $(MLI:%.mli=%.ml)
61 # objects for matitac (batch compiler)
62 CML = buildTimeConf.ml $(CMLI:%.mli=%.ml)
63 MAINCML = $(MAINCMLI:%.mli=%.ml)
66 matita matitac matitadep matitaclean \
68 PROGRAMS = $(PROGRAMS_BYTE)
69 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
70 NOINST_PROGRAMS = dump_moo
71 NOINST_PROGRAMS_OPT = $(patsubst %,%.opt,$(EXTRA_PROGRAMS))
74 all: $(PROGRAMS) $(NOINST_PROGRAMS)
76 CMOS = $(ML:%.ml=%.cmo)
77 CCMOS = $(CML:%.ml=%.cmo)
78 MAINCMOS = $(MAINCML:%.ml=%.cmo)
79 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
80 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
81 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
83 $(CMXOS): $(LIBX_DEPS)
85 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES))
86 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
87 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
88 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
89 opt: $(PROGRAMS_OPT) $(NOINST_PROGRAMS_OPT)
93 ifeq ($(HAVE_OCAMLOPT),yes)
94 world: depend.opt opt links
101 $(H)for X in $(INSTALL_PROGRAMS_LINKS_MATITAC) \
102 $(INSTALL_PROGRAMS_LINKS_MATITA); do\
105 $(H)ln -sf matita.opt matita
106 $(H)ln -sf matitac.opt matitac
109 $(H)echo " OCAMLC matita.ml"
110 $(H)$(OCAMLC) $(PKGS) -linkpkg -o matita $(CMOS) $(OCAML_DEBUG_FLAGS) matita.ml
111 $(H)echo " OCAMLC matitac.ml"
112 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o matitac $(CCMOS) $(MAINCMOS) $(OCAML_DEBUG_FLAGS) matitac.ml
114 matita: matita.ml $(LIB_DEPS) $(CMOS)
115 $(H)echo " OCAMLC $<"
116 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
117 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
118 $(H)echo " OCAMLOPT $<"
119 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
121 dump_moo: dump_moo.ml buildTimeConf.cmo
122 $(H)echo " OCAMLC $<"
123 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ buildTimeConf.cmo $<
124 dump_moo.opt: dump_moo.ml buildTimeConf.cmx
125 $(H)echo "OCAMLOPT $<"
126 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ buildTimeConf.cmx $<
128 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
129 $(H)echo " OCAMLC $<"
130 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
131 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
132 $(H)echo " OCAMLOPT $<"
133 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
135 rottener: rottener.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
136 $(H)echo " OCAMLC $<"
137 $(H)$(OCAMLC) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMOS) $(MAINCMOS) rottener.ml
138 rottener.opt: rottener.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
139 $(H)echo " OCAMLOPT $<"
140 $(H)$(OCAMLOPT) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMXS) $(MAINCMXS) rottener.ml
142 find . -type f -name "*.ma.*.rottened" -exec rm {} \;
145 $(H)test -f $@ || ln -s $< $@
146 matitadep.opt: matitac.opt
147 $(H)test -f $@ || ln -s $< $@
150 $(H)test -f $@ || ln -s $< $@
151 matitawiki.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 $< $@
159 matitaGeneratedGui.ml: matita.glade
160 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
164 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
165 $(PROGRAMS) $(PROGRAMS_OPT) \
166 rottener rottener.opt \
167 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
175 $(H)$(MAKE) -C dist/ clean
176 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
177 $(H)rm -f buildTimeConf.ml
178 $(H)rm -f matita.glade.bak matita.gladep.bak
179 $(H)rm -f matita.conf.xml.sample
188 contribs/RELATIONAL \
190 contribs/LAMBDA-TYPES \
191 contribs/PREDICATIVE-TOPOLOGY \
199 .PHONY: tests tests.opt cleantests cleantests.opt
200 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
201 tests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-test-opt)
202 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
203 cleantests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-cleantests-opt)
205 %-test: matitac matitadep matitaclean
206 -cd $* && make -k clean all
207 %-test-opt: matitac.opt matitadep.opt matitaclean.opt
208 -cd $* && make -k clean.opt opt
209 %-cleantests: matitaclean
211 %-cleantests-opt: matitaclean.opt
212 -cd $* && make clean.opt
214 # {{{ Distribution stuff
216 ifeq ($(DISTRIBUTED),yes)
219 dist_library: install_preliminaries dist_library@library
222 $(H)cd $*;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitadep)
223 $(H)echo "publish $*"
224 $(H)cd $*;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitac -system -noinnertypes)
225 $(H)echo "destroy $*"
226 $(H)cd $*;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitaclean)
228 $(H)cp $(WHERE)/.matita/matita.db $(WHERE)/metadata.db || true
229 #$(H)rm -rf $(WHERE)/.matita/
234 dist_pre: matitaGeneratedGui.ml
235 $(MAKE) -C dist/ dist_pre
237 WHERE = $(DESTDIR)/$(RT_BASE_DIR)
247 gtkmathview.matita.conf.xml \
252 ifeq ($(HAVE_OCAMLOPT),yes)
253 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
255 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
258 install-arch: install_preliminaries
259 install-indep: dist_library
261 install_preliminaries : install_preliminaries.stamp
263 install_preliminaries.stamp:
264 $(H)install -d $(WHERE)/ma/
265 $(H)cp -a $(INSTALL_STUFF) $(WHERE)
266 ifeq ($(HAVE_OCAMLOPT),yes)
267 $(H)install -s $(INSTALL_STUFF_BIN) $(WHERE)
268 $(H)for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(WHERE)/$$p; done
270 $(H)install $(INSTALL_STUFF_BIN) $(WHERE)
272 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
273 ln -fs matitac $(WHERE)/$$p;\
275 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
276 ln -fs matita $(WHERE)/$$p;\
278 $(H)cd library;../matitadep
279 $(H)cp -a library/ $(WHERE)/ma/standard-library
281 $(H)touch install_preliminaries.stamp
286 STATIC_LINK = dist/static_link/static_link
290 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
292 gdome gmetadom_gdome_cpp_smart \
297 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
303 STATIC_CLIBS_PROVER = \
312 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
313 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
315 ifeq ($(HAVE_OCAMLOPT),yes)
316 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
319 $(H)echo "Native code compilation is disabled"
321 $(H)echo "Native code compilation is disabled"
325 $(MAKE) -C dist/ $(STATIC_LINK)
327 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
328 $(STATIC_LINK) $(STATIC_LIBS) -- \
329 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
332 dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml
333 $(STATIC_LINK) $(STATIC_CLIBS) -- \
334 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \
335 $(STATIC_EXTRA_CLIBS)
337 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
338 $(STATIC_LINK) $(STATIC_CLIBS) -- \
339 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
340 $(STATIC_EXTRA_CLIBS)
342 matitadep.opt.static: matitac.opt.static
343 $(H)test -f $@ || ln -s $< $@
344 matitaclean.opt.static: matitac.opt.static
345 $(H)test -f $@ || ln -s $< $@
346 matitawiki.opt.static: matitac.opt.static
347 $(H)test -f $@ || ln -s $< $@
354 # }}} End of distribution stuff
356 # {{{ Deps and automatic rules
360 $(H)cd ..; otags -vi -r components/ matita/
366 $(H)$(OCAMLDEP) *.ml *.mli > .depend
368 $(H)echo " OCAMLDEP -native"
369 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt
371 # this should be sligtly better, since should work with 'make all opt'
372 MAKECMDGOALS_DELIM=$(addprefix _x_,$(addsuffix _x_,$(MAKECMDGOALS)))
373 ifneq (,$(findstring _x_all_x_,$(MAKECMDGOALS_DELIM)))
374 # if we 'make all opt' the deps for 'all' should be fine also for opt
375 # if we 'make opt all' it should not work...
376 INCLUDE_MANDATORY=yes
378 TO_DEPEND_ON=$(LIB_DEPS)
379 else ifneq (,$(findstring _x_opt_x_,$(MAKECMDGOALS_DELIM)))
380 INCLUDE_MANDATORY=yes
381 TO_INCLUDE+=.depend.opt
382 TO_DEPEND_ON=$(LIBX_DEPS)
383 else ifneq (,$(findstring _x_world_x_,$(MAKECMDGOALS_DELIM)))
384 ifeq ($(HAVE_OCAMLOPT),yes)
385 INCLUDE_MANDATORY=yes
386 TO_INCLUDE+=.depend.opt
387 TO_DEPEND_ON=$(LIBX_DEPS)
389 INCLUDE_MANDATORY=yes
391 TO_DEPEND_ON=$(LIB_DEPS)
396 TO_DEPEND_ON=$(LIB_DEPS)
399 $(MLI:%.mli=%.cmi) $(ML:%.ml=%.cmo) $(ML:%.ml=%.cmx): $(TO_DEPEND_ON)
401 ifeq (no,$(INCLUDE_MANDATORY))
402 -include $(TO_INCLUDE)
404 include $(TO_INCLUDE)
408 $(H)echo " OCAMLC $<"
409 $(H)$(OCAMLC) $(PKGS) -c $<
411 $(H)echo " OCAMLC $<"
412 $(H)$(OCAMLC) $(PKGS) -c $<
414 $(H)echo " OCAMLOPT $<"
415 $(H)$(OCAMLOPT) $(PKGS) -c $<
417 $(H)echo " OCAMLC -dtypes $<"
418 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
423 ./dep2dot.rb < $< | tred > $@
425 # }}} End of deps and automatic rules
427 # vim: set foldmethod=marker: