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 \
43 predefined_virtuals.mli \
52 applyTransformation.mli \
61 # objects for matita (GTK GUI)
62 ML = buildTimeConf.ml matitaGeneratedGui.ml $(MLI:%.mli=%.ml)
63 # objects for matitac (batch compiler)
64 CML = buildTimeConf.ml $(CMLI:%.mli=%.ml)
65 MAINCML = $(MAINCMLI:%.mli=%.ml)
68 matita matitac matitadep matitaclean \
70 PROGRAMS = $(PROGRAMS_BYTE)
71 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
72 NOINST_PROGRAMS = dump_moo
73 NOINST_PROGRAMS_OPT = $(patsubst %,%.opt,$(EXTRA_PROGRAMS))
76 all: $(PROGRAMS) $(NOINST_PROGRAMS)
78 CMOS = $(ML:%.ml=%.cmo)
79 CCMOS = $(CML:%.ml=%.cmo)
80 MAINCMOS = $(MAINCML:%.ml=%.cmo)
81 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
82 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
83 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
85 $(CMXOS): $(LIBX_DEPS)
87 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES))
88 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
89 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
90 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
91 opt: $(PROGRAMS_OPT) $(NOINST_PROGRAMS_OPT)
95 ifeq ($(HAVE_OCAMLOPT),yes)
96 world: depend.opt opt links
103 $(H)for X in $(INSTALL_PROGRAMS_LINKS_MATITAC) \
104 $(INSTALL_PROGRAMS_LINKS_MATITA); do\
107 $(H)ln -sf matita.opt matita
108 $(H)ln -sf matitac.opt matitac
111 $(H)echo " OCAMLC matita.ml"
112 $(H)$(OCAMLC) $(PKGS) -linkpkg -o matita $(CMOS) $(OCAML_DEBUG_FLAGS) matita.ml
113 $(H)echo " OCAMLC matitac.ml"
114 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o matitac $(CCMOS) $(MAINCMOS) $(OCAML_DEBUG_FLAGS) matitac.ml
116 matita: matita.ml $(LIB_DEPS) $(CMOS)
117 $(H)echo " OCAMLC $<"
118 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
119 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
120 $(H)echo " OCAMLOPT $<"
121 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
123 dump_moo: dump_moo.ml buildTimeConf.cmo
124 $(H)echo " OCAMLC $<"
125 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ buildTimeConf.cmo $<
126 dump_moo.opt: dump_moo.ml buildTimeConf.cmx
127 $(H)echo "OCAMLOPT $<"
128 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ buildTimeConf.cmx $<
130 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
131 $(H)echo " OCAMLC $<"
132 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
133 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
134 $(H)echo " OCAMLOPT $<"
135 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
137 rottener: rottener.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
138 $(H)echo " OCAMLC $<"
139 $(H)$(OCAMLC) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMOS) $(MAINCMOS) rottener.ml
140 rottener.opt: rottener.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
141 $(H)echo " OCAMLOPT $<"
142 $(H)$(OCAMLOPT) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMXS) $(MAINCMXS) rottener.ml
144 find . -type f -name "*.ma.*.rottened" -exec rm {} \;
147 $(H)test -f $@ || ln -s $< $@
148 matitadep.opt: matitac.opt
149 $(H)test -f $@ || ln -s $< $@
152 $(H)test -f $@ || ln -s $< $@
153 matitawiki.opt: matitac.opt
154 $(H)test -f $@ || ln -s $< $@
157 $(H)test -f $@ || ln -s $< $@
158 matitaclean.opt: matitac.opt
159 $(H)test -f $@ || ln -s $< $@
161 matitaGeneratedGui.ml: matita.glade
162 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
166 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
167 $(PROGRAMS) $(PROGRAMS_OPT) \
168 rottener rottener.opt \
169 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
177 $(H)$(MAKE) -C dist/ clean
178 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
179 $(H)rm -f buildTimeConf.ml
180 $(H)rm -f matita.glade.bak matita.gladep.bak
181 $(H)rm -f matita.conf.xml.sample
192 contribs/RELATIONAL \
194 contribs/PREDICATIVE-TOPOLOGY \
200 # contribs/LAMBDA-TYPES \
203 .PHONY: tests tests.opt cleantests cleantests.opt
204 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
205 tests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-test-opt)
206 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
207 cleantests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-cleantests-opt)
209 %-test: matitac matitadep matitaclean
210 -cd $* && make -k clean all
211 %-test-opt: matitac.opt matitadep.opt matitaclean.opt
212 -cd $* && make -k clean.opt opt
213 %-cleantests: matitaclean
215 %-cleantests-opt: matitaclean.opt
216 -cd $* && make clean.opt
218 # {{{ Distribution stuff
220 ifeq ($(DISTRIBUTED),yes)
223 dist_library: install_preliminaries
225 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitadep)
227 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitac -system -noinnertypes)
229 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitaclean)
231 $(H)cp $(WHERE)/.matita/matita.db $(WHERE)/metadata.db || true
232 #$(H)rm -rf $(WHERE)/.matita/
237 dist_pre: matitaGeneratedGui.ml
238 $(MAKE) -C dist/ dist_pre
240 WHERE = $(DESTDIR)/$(RT_BASE_DIR)
250 gtkmathview.matita.conf.xml \
255 ifeq ($(HAVE_OCAMLOPT),yes)
256 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
258 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
261 install-arch: install_preliminaries
262 install-indep: dist_library
264 install_preliminaries : install_preliminaries.stamp
266 install_preliminaries.stamp:
267 $(H)install -d $(WHERE)/ma/
268 $(H)cp -a $(INSTALL_STUFF) $(WHERE)
269 ifeq ($(HAVE_OCAMLOPT),yes)
270 $(H)install -s $(INSTALL_STUFF_BIN) $(WHERE)
271 $(H)for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(WHERE)/$$p; done
273 $(H)install $(INSTALL_STUFF_BIN) $(WHERE)
275 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
276 ln -fs matitac $(WHERE)/$$p;\
278 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
279 ln -fs matita $(WHERE)/$$p;\
281 $(H)cp -a library/ $(WHERE)/ma/standard-library
283 $(H)touch install_preliminaries.stamp
288 STATIC_LINK = dist/static_link/static_link
292 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
294 gdome gmetadom_gdome_cpp_smart \
299 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
305 STATIC_CLIBS_PROVER = \
314 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
315 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
317 ifeq ($(HAVE_OCAMLOPT),yes)
318 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
321 $(H)echo "Native code compilation is disabled"
323 $(H)echo "Native code compilation is disabled"
327 $(MAKE) -C dist/ $(STATIC_LINK)
329 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
330 $(STATIC_LINK) $(STATIC_LIBS) -- \
331 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
334 dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml
335 $(STATIC_LINK) $(STATIC_CLIBS) -- \
336 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \
337 $(STATIC_EXTRA_CLIBS)
339 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
340 $(STATIC_LINK) $(STATIC_CLIBS) -- \
341 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
342 $(STATIC_EXTRA_CLIBS)
344 matitadep.opt.static: matitac.opt.static
345 $(H)test -f $@ || ln -s $< $@
346 matitaclean.opt.static: matitac.opt.static
347 $(H)test -f $@ || ln -s $< $@
348 matitawiki.opt.static: matitac.opt.static
349 $(H)test -f $@ || ln -s $< $@
356 # }}} End of distribution stuff
358 # {{{ Deps and automatic rules
362 $(H)cd ..; otags -vi -r components/ matita/
368 $(H)$(OCAMLDEP) *.ml *.mli > .depend
370 $(H)echo " OCAMLDEP -native"
371 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt
373 # this should be sligtly better, since should work with 'make all opt'
374 MAKECMDGOALS_DELIM=$(addprefix _x_,$(addsuffix _x_,$(MAKECMDGOALS)))
375 ifneq (,$(findstring _x_all_x_,$(MAKECMDGOALS_DELIM)))
376 # if we 'make all opt' the deps for 'all' should be fine also for opt
377 # if we 'make opt all' it should not work...
378 INCLUDE_MANDATORY=yes
380 TO_DEPEND_ON=$(LIB_DEPS)
381 else ifneq (,$(findstring _x_opt_x_,$(MAKECMDGOALS_DELIM)))
382 INCLUDE_MANDATORY=yes
383 TO_INCLUDE+=.depend.opt
384 TO_DEPEND_ON=$(LIBX_DEPS)
385 else ifneq (,$(findstring _x_world_x_,$(MAKECMDGOALS_DELIM)))
386 ifeq ($(HAVE_OCAMLOPT),yes)
387 INCLUDE_MANDATORY=yes
388 TO_INCLUDE+=.depend.opt
389 TO_DEPEND_ON=$(LIBX_DEPS)
391 INCLUDE_MANDATORY=yes
393 TO_DEPEND_ON=$(LIB_DEPS)
398 TO_DEPEND_ON=$(LIB_DEPS)
401 $(MLI:%.mli=%.cmi) $(ML:%.ml=%.cmo) $(ML:%.ml=%.cmx): $(TO_DEPEND_ON)
403 ifeq (no,$(INCLUDE_MANDATORY))
404 -include $(TO_INCLUDE)
406 include $(TO_INCLUDE)
410 $(H)echo " OCAMLC $<"
411 $(H)$(OCAMLC) $(PKGS) -c $<
413 $(H)echo " OCAMLC $<"
414 $(H)$(OCAMLC) $(PKGS) -c $<
416 $(H)echo " OCAMLOPT $<"
417 $(H)$(OCAMLOPT) $(PKGS) -c $<
419 $(H)echo " OCAMLC -dtypes $<"
420 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
425 ./dep2dot.rb < $< | tred > $@
427 # }}} End of deps and automatic rules
429 # vim: set foldmethod=marker: