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
189 contribs/RELATIONAL \
191 contribs/LAMBDA-TYPES \
192 contribs/PREDICATIVE-TOPOLOGY \
200 .PHONY: tests tests.opt cleantests cleantests.opt
201 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
202 tests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-test-opt)
203 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
204 cleantests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-cleantests-opt)
206 %-test: matitac matitadep matitaclean
207 -cd $* && make -k clean all
208 %-test-opt: matitac.opt matitadep.opt matitaclean.opt
209 -cd $* && make -k clean.opt opt
210 %-cleantests: matitaclean
212 %-cleantests-opt: matitaclean.opt
213 -cd $* && make clean.opt
215 # {{{ Distribution stuff
217 ifeq ($(DISTRIBUTED),yes)
220 dist_library: install_preliminaries
222 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitadep)
224 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitac -system -noinnertypes)
226 $(H)cd $(WHERE)/ma/standard-library;(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)cp -a library/ $(WHERE)/ma/standard-library
280 $(H)touch install_preliminaries.stamp
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 matitadep.opt.static: matitac.opt.static
342 $(H)test -f $@ || ln -s $< $@
343 matitaclean.opt.static: matitac.opt.static
344 $(H)test -f $@ || ln -s $< $@
345 matitawiki.opt.static: matitac.opt.static
346 $(H)test -f $@ || ln -s $< $@
353 # }}} End of distribution stuff
355 # {{{ Deps and automatic rules
359 $(H)cd ..; otags -vi -r components/ matita/
365 $(H)$(OCAMLDEP) *.ml *.mli > .depend
367 $(H)echo " OCAMLDEP -native"
368 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt
370 # this should be sligtly better, since should work with 'make all opt'
371 MAKECMDGOALS_DELIM=$(addprefix _x_,$(addsuffix _x_,$(MAKECMDGOALS)))
372 ifneq (,$(findstring _x_all_x_,$(MAKECMDGOALS_DELIM)))
373 # if we 'make all opt' the deps for 'all' should be fine also for opt
374 # if we 'make opt all' it should not work...
375 INCLUDE_MANDATORY=yes
377 TO_DEPEND_ON=$(LIB_DEPS)
378 else ifneq (,$(findstring _x_opt_x_,$(MAKECMDGOALS_DELIM)))
379 INCLUDE_MANDATORY=yes
380 TO_INCLUDE+=.depend.opt
381 TO_DEPEND_ON=$(LIBX_DEPS)
382 else ifneq (,$(findstring _x_world_x_,$(MAKECMDGOALS_DELIM)))
383 ifeq ($(HAVE_OCAMLOPT),yes)
384 INCLUDE_MANDATORY=yes
385 TO_INCLUDE+=.depend.opt
386 TO_DEPEND_ON=$(LIBX_DEPS)
388 INCLUDE_MANDATORY=yes
390 TO_DEPEND_ON=$(LIB_DEPS)
395 TO_DEPEND_ON=$(LIB_DEPS)
398 $(MLI:%.mli=%.cmi) $(ML:%.ml=%.cmo) $(ML:%.ml=%.cmx): $(TO_DEPEND_ON)
400 ifeq (no,$(INCLUDE_MANDATORY))
401 -include $(TO_INCLUDE)
403 include $(TO_INCLUDE)
407 $(H)echo " OCAMLC $<"
408 $(H)$(OCAMLC) $(PKGS) -c $<
410 $(H)echo " OCAMLC $<"
411 $(H)$(OCAMLC) $(PKGS) -c $<
413 $(H)echo " OCAMLOPT $<"
414 $(H)$(OCAMLOPT) $(PKGS) -c $<
416 $(H)echo " OCAMLC -dtypes $<"
417 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
422 ./dep2dot.rb < $< | tred > $@
424 # }}} End of deps and automatic rules
426 # vim: set foldmethod=marker: