3 include ../Makefile.defs
14 OCAML_FLAGS = -pp $(CAMLP5O) -rectypes $(ANNOTOPTION)
15 OCAMLDEP_FLAGS = -pp $(CAMLP5O)
16 PKGS = -package "$(MATITA_REQUIRES)"
17 CPKGS = -package "$(MATITA_CREQUIRES)"
18 OCAML_THREADS_FLAGS = -thread
19 OCAML_DEBUG_FLAGS = -g
21 #OCAMLOPT_DEBUG_FLAGS = -p
22 OCAMLC_FLAGS = $(OCAML_FLAGS) $(OCAML_THREADS_FLAGS)
23 OCAMLC = $(OCAMLFIND) ocamlc$(OCAML_PROF) $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS)
24 OCAMLOPT = $(OCAMLFIND) opt $(OCAMLC_FLAGS) $(OCAMLOPT_DEBUG_FLAGS)
25 OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAMLDEP_FLAGS)
26 INSTALL_PROGRAMS= matita matitac
27 INSTALL_PROGRAMS_LINKS_MATITA=
28 INSTALL_PROGRAMS_LINKS_MATITAC= matitadep matitaclean matitawiki
30 MATITA_FLAGS = -noprofile
40 applyTransformation.mli \
49 predefined_virtuals.mli \
56 applyTransformation.mli \
67 # objects for matita (GTK GUI)
68 ML = buildTimeConf.ml matitaGeneratedGui.ml $(MLI:%.mli=%.ml)
69 # objects for matitac (batch compiler)
70 CML = buildTimeConf.ml $(CMLI:%.mli=%.ml)
71 MAINCML = $(MAINCMLI:%.mli=%.ml)
74 matita matitac matitadep matitaclean \
76 PROGRAMS = $(PROGRAMS_BYTE)
77 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
78 NOINST_PROGRAMS = dump_moo
79 NOINST_PROGRAMS_OPT = $(patsubst %,%.opt,$(EXTRA_PROGRAMS))
82 all: $(PROGRAMS) $(NOINST_PROGRAMS)
84 CMOS = $(ML:%.ml=%.cmo)
85 CCMOS = $(CML:%.ml=%.cmo)
86 MAINCMOS = $(MAINCML:%.ml=%.cmo)
87 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
88 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
89 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
91 $(CMXOS): $(LIBX_DEPS)
93 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES))
94 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
95 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
96 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
97 opt: $(PROGRAMS_OPT) $(NOINST_PROGRAMS_OPT)
101 ifeq ($(HAVE_OCAMLOPT),yes)
102 world: depend.opt opt links
109 $(H)for X in $(INSTALL_PROGRAMS_LINKS_MATITAC) \
110 $(INSTALL_PROGRAMS_LINKS_MATITA); do\
113 $(H)ln -sf matita.opt matita
114 $(H)ln -sf matitac.opt matitac
117 $(H)echo " OCAMLC matita.ml"
118 $(H)$(OCAMLC) $(PKGS) -linkpkg -o matita $(CMOS) $(OCAML_DEBUG_FLAGS) matita.ml
119 $(H)echo " OCAMLC matitac.ml"
120 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o matitac $(CCMOS) $(MAINCMOS) $(OCAML_DEBUG_FLAGS) matitac.ml
122 matita: matita.ml $(LIB_DEPS) $(CMOS)
123 $(H)echo " OCAMLC $<"
124 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
125 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
126 $(H)echo " OCAMLOPT $<"
127 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
129 dump_moo: dump_moo.ml buildTimeConf.cmo
130 $(H)echo " OCAMLC $<"
131 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ buildTimeConf.cmo $<
132 dump_moo.opt: dump_moo.ml buildTimeConf.cmx
133 $(H)echo "OCAMLOPT $<"
134 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ buildTimeConf.cmx $<
136 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
137 $(H)echo " OCAMLC $<"
138 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
139 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
140 $(H)echo " OCAMLOPT $<"
141 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
143 rottener: rottener.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
144 $(H)echo " OCAMLC $<"
145 $(H)$(OCAMLC) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMOS) $(MAINCMOS) rottener.ml
146 rottener.opt: rottener.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
147 $(H)echo " OCAMLOPT $<"
148 $(H)$(OCAMLOPT) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMXS) $(MAINCMXS) rottener.ml
150 find . -type f -name "*.ma.*.rottened" -exec rm {} \;
153 $(H)test -f $@ || ln -s $< $@
154 matitadep.opt: matitac.opt
155 $(H)test -f $@ || ln -s $< $@
158 $(H)test -f $@ || ln -s $< $@
159 matitawiki.opt: matitac.opt
160 $(H)test -f $@ || ln -s $< $@
163 $(H)test -f $@ || ln -s $< $@
164 matitaclean.opt: matitac.opt
165 $(H)test -f $@ || ln -s $< $@
167 matitaGeneratedGui.ml: matita.glade
168 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
172 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
173 $(PROGRAMS) $(PROGRAMS_OPT) \
174 rottener rottener.opt \
175 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
183 $(H)$(MAKE) -C dist/ clean
184 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
185 $(H)rm -f buildTimeConf.ml
186 $(H)rm -f matita.glade.bak matita.gladep.bak
187 $(H)rm -f matita.conf.xml.sample
198 contribs/RELATIONAL \
206 # contribs/LAMBDA-TYPES \
209 .PHONY: tests tests.opt cleantests cleantests.opt
210 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
211 tests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-test-opt)
212 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
213 cleantests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-cleantests-opt)
215 %-test: matitac matitadep matitaclean
216 -cd $* && make -k clean all
217 %-test-opt: matitac.opt matitadep.opt matitaclean.opt
218 -cd $* && make -k clean.opt opt
219 %-cleantests: matitaclean
221 %-cleantests-opt: matitaclean.opt
222 -cd $* && make clean.opt
224 # {{{ Distribution stuff
226 ifeq ($(DISTRIBUTED),yes)
229 dist_library: install_preliminaries
231 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitadep)
233 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitac -system -noinnertypes)
235 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitaclean)
237 $(H)cp $(WHERE)/.matita/matita.db $(WHERE)/metadata.db || true
238 #$(H)rm -rf $(WHERE)/.matita/
243 dist_pre: matitaGeneratedGui.ml
244 $(MAKE) -C dist/ dist_pre
246 WHERE = $(DESTDIR)/$(RT_BASE_DIR)
256 gtkmathview.matita.conf.xml \
261 ifeq ($(HAVE_OCAMLOPT),yes)
262 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
264 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
267 install-arch: install_preliminaries
270 install_preliminaries : install_preliminaries.stamp
272 install_preliminaries.stamp:
273 $(H)install -d $(WHERE)/ma/
274 $(H)cp -a $(INSTALL_STUFF) $(WHERE)
275 ifeq ($(HAVE_OCAMLOPT),yes)
276 $(H)install -s $(INSTALL_STUFF_BIN) $(WHERE)
277 $(H)for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(WHERE)/$$p; done
279 $(H)install $(INSTALL_STUFF_BIN) $(WHERE)
281 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
282 ln -fs matitac $(WHERE)/$$p;\
284 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
285 ln -fs matita $(WHERE)/$$p;\
287 $(H)cp -a library/ $(WHERE)/ma/standard-library
288 $(H)cp -a nlibrary/ $(WHERE)/ma/new-standard-library
290 $(H)touch install_preliminaries.stamp
295 STATIC_LINK = dist/static_link/static_link
299 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
301 gdome gmetadom_gdome_cpp_smart \
306 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
312 STATIC_CLIBS_PROVER = \
321 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
322 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
324 ifeq ($(HAVE_OCAMLOPT),yes)
325 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
328 $(H)echo "Native code compilation is disabled"
330 $(H)echo "Native code compilation is disabled"
334 $(MAKE) -C dist/ $(STATIC_LINK)
336 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
337 $(STATIC_LINK) $(STATIC_LIBS) -- \
338 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
341 dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml
342 $(STATIC_LINK) $(STATIC_CLIBS) -- \
343 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \
344 $(STATIC_EXTRA_CLIBS)
346 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
347 $(STATIC_LINK) $(STATIC_CLIBS) -- \
348 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
349 $(STATIC_EXTRA_CLIBS)
351 matitadep.opt.static: matitac.opt.static
352 $(H)test -f $@ || ln -s $< $@
353 matitaclean.opt.static: matitac.opt.static
354 $(H)test -f $@ || ln -s $< $@
355 matitawiki.opt.static: matitac.opt.static
356 $(H)test -f $@ || ln -s $< $@
363 # }}} End of distribution stuff
365 # {{{ Deps and automatic rules
369 $(H)cd ..; otags -vi -r components/ matita/
375 $(H)$(OCAMLDEP) *.ml *.mli > .depend
377 $(H)echo " OCAMLDEP -native"
378 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt
380 # this should be sligtly better, since should work with 'make all opt'
381 MAKECMDGOALS_DELIM=$(addprefix _x_,$(addsuffix _x_,$(MAKECMDGOALS)))
382 ifneq (,$(findstring _x_all_x_,$(MAKECMDGOALS_DELIM)))
383 # if we 'make all opt' the deps for 'all' should be fine also for opt
384 # if we 'make opt all' it should not work...
385 INCLUDE_MANDATORY=yes
387 TO_DEPEND_ON=$(LIB_DEPS)
388 else ifneq (,$(findstring _x_opt_x_,$(MAKECMDGOALS_DELIM)))
389 INCLUDE_MANDATORY=yes
390 TO_INCLUDE+=.depend.opt
391 TO_DEPEND_ON=$(LIBX_DEPS)
392 else ifneq (,$(findstring _x_world_x_,$(MAKECMDGOALS_DELIM)))
393 ifeq ($(HAVE_OCAMLOPT),yes)
394 INCLUDE_MANDATORY=yes
395 TO_INCLUDE+=.depend.opt
396 TO_DEPEND_ON=$(LIBX_DEPS)
398 INCLUDE_MANDATORY=yes
400 TO_DEPEND_ON=$(LIB_DEPS)
405 TO_DEPEND_ON=$(LIB_DEPS)
408 $(MLI:%.mli=%.cmi) $(ML:%.ml=%.cmo) $(ML:%.ml=%.cmx): $(TO_DEPEND_ON)
410 ifeq (no,$(INCLUDE_MANDATORY))
411 -include $(TO_INCLUDE)
413 include $(TO_INCLUDE)
417 $(H)echo " OCAMLC $<"
418 $(H)$(OCAMLC) $(PKGS) -c $<
420 $(H)echo " OCAMLC $<"
421 $(H)$(OCAMLC) $(PKGS) -c $<
423 $(H)echo " OCAMLOPT $<"
424 $(H)$(OCAMLOPT) $(PKGS) -c $<
426 $(H)echo " OCAMLC -dtypes $<"
427 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
432 ./dep2dot.rb < $< | tred > $@
434 # }}} End of deps and automatic rules
436 # vim: set foldmethod=marker: