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
30 MATITA_FLAGS = -noprofile
40 applyTransformation.mli \
48 predefined_virtuals.mli \
55 applyTransformation.mli \
65 # objects for matita (GTK GUI)
66 ML = buildTimeConf.ml matitaGeneratedGui.ml $(MLI:%.mli=%.ml)
67 # objects for matitac (batch compiler)
68 CML = buildTimeConf.ml $(CMLI:%.mli=%.ml)
69 MAINCML = $(MAINCMLI:%.mli=%.ml)
72 matita matitac matitadep matitaclean
73 PROGRAMS = $(PROGRAMS_BYTE)
74 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
76 NOINST_PROGRAMS_OPT = $(patsubst %,%.opt,$(EXTRA_PROGRAMS))
79 all: $(PROGRAMS) $(NOINST_PROGRAMS)
81 CMOS = $(ML:%.ml=%.cmo)
82 CCMOS = $(CML:%.ml=%.cmo)
83 MAINCMOS = $(MAINCML:%.ml=%.cmo)
84 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
85 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
86 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
88 $(CMXOS): $(LIBX_DEPS)
90 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES))
91 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
92 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
93 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
94 opt: $(PROGRAMS_OPT) $(NOINST_PROGRAMS_OPT)
98 ifeq ($(HAVE_OCAMLOPT),yes)
99 world: depend.opt opt links
106 $(H)for X in $(INSTALL_PROGRAMS_LINKS_MATITAC) \
107 $(INSTALL_PROGRAMS_LINKS_MATITA); do\
110 $(H)ln -sf matita.opt matita
111 $(H)ln -sf matitac.opt matitac
114 $(H)echo " OCAMLC matita.ml"
115 $(H)$(OCAMLC) $(PKGS) -linkpkg -o matita $(CMOS) $(OCAML_DEBUG_FLAGS) matita.ml
116 $(H)echo " OCAMLC matitac.ml"
117 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o matitac $(CCMOS) $(MAINCMOS) $(OCAML_DEBUG_FLAGS) matitac.ml
119 matita: matita.ml $(LIB_DEPS) $(CMOS)
120 $(H)echo " OCAMLC $<"
121 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
122 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
123 $(H)echo " OCAMLOPT $<"
124 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
126 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
127 $(H)echo " OCAMLC $<"
128 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
129 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
130 $(H)echo " OCAMLOPT $<"
131 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
133 rottener: rottener.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
134 $(H)echo " OCAMLC $<"
135 $(H)$(OCAMLC) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMOS) $(MAINCMOS) rottener.ml
136 rottener.opt: rottener.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
137 $(H)echo " OCAMLOPT $<"
138 $(H)$(OCAMLOPT) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMXS) $(MAINCMXS) rottener.ml
140 find . -type f -name "*.ma.*.rottened" -exec rm {} \;
143 $(H)test -f $@ || ln -s $< $@
144 matitadep.opt: matitac.opt
145 $(H)test -f $@ || ln -s $< $@
148 $(H)test -f $@ || ln -s $< $@
149 matitaclean.opt: matitac.opt
150 $(H)test -f $@ || ln -s $< $@
152 matitaGeneratedGui.ml: matita.glade
153 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
157 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
158 $(PROGRAMS) $(PROGRAMS_OPT) \
159 rottener rottener.opt \
160 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
168 $(H)$(MAKE) -C dist/ clean
169 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
170 $(H)rm -f buildTimeConf.ml
171 $(H)rm -f matita.glade.bak matita.gladep.bak
172 $(H)rm -f matita.conf.xml.sample
183 contribs/RELATIONAL \
191 # contribs/LAMBDA-TYPES \
194 .PHONY: tests tests.opt cleantests cleantests.opt
195 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
196 tests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-test-opt)
197 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
198 cleantests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-cleantests-opt)
200 %-test: matitac matitadep matitaclean
201 -cd $* && make -k clean all
202 %-test-opt: matitac.opt matitadep.opt matitaclean.opt
203 -cd $* && make -k clean.opt opt
204 %-cleantests: matitaclean
206 %-cleantests-opt: matitaclean.opt
207 -cd $* && make clean.opt
209 # {{{ Distribution stuff
211 ifeq ($(DISTRIBUTED),yes)
214 dist_library: install_preliminaries
216 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitadep)
218 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitac -system -noinnertypes)
220 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitaclean)
222 $(H)cp $(WHERE)/.matita/matita.db $(WHERE)/metadata.db || true
223 #$(H)rm -rf $(WHERE)/.matita/
228 dist_pre: matitaGeneratedGui.ml
229 $(MAKE) -C dist/ dist_pre
231 WHERE = $(DESTDIR)/$(RT_BASE_DIR)
241 gtkmathview.matita.conf.xml \
246 ifeq ($(HAVE_OCAMLOPT),yes)
247 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
249 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
252 install-arch: install_preliminaries
255 install_preliminaries : install_preliminaries.stamp
257 install_preliminaries.stamp:
258 $(H)install -d $(WHERE)/ma/
259 $(H)cp -a $(INSTALL_STUFF) $(WHERE)
260 ifeq ($(HAVE_OCAMLOPT),yes)
261 $(H)install -s $(INSTALL_STUFF_BIN) $(WHERE)
262 $(H)for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(WHERE)/$$p; done
264 $(H)install $(INSTALL_STUFF_BIN) $(WHERE)
266 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
267 ln -fs matitac $(WHERE)/$$p;\
269 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
270 ln -fs matita $(WHERE)/$$p;\
272 $(H)cp -a library/ $(WHERE)/ma/standard-library
273 $(H)cp -a nlibrary/ $(WHERE)/ma/new-standard-library
275 $(H)touch install_preliminaries.stamp
280 STATIC_LINK = dist/static_link/static_link
284 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
286 gdome gmetadom_gdome_cpp_smart \
291 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
297 STATIC_CLIBS_PROVER = \
306 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
307 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
309 ifeq ($(HAVE_OCAMLOPT),yes)
310 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
313 $(H)echo "Native code compilation is disabled"
315 $(H)echo "Native code compilation is disabled"
319 $(MAKE) -C dist/ $(STATIC_LINK)
321 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
322 $(STATIC_LINK) $(STATIC_LIBS) -- \
323 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
326 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
327 $(STATIC_LINK) $(STATIC_CLIBS) -- \
328 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
329 $(STATIC_EXTRA_CLIBS)
331 matitadep.opt.static: matitac.opt.static
332 $(H)test -f $@ || ln -s $< $@
333 matitaclean.opt.static: matitac.opt.static
334 $(H)test -f $@ || ln -s $< $@
341 # }}} End of distribution stuff
343 # {{{ Deps and automatic rules
347 $(H)cd ..; otags -vi -r components/ matita/
353 $(H)$(OCAMLDEP) *.ml *.mli > .depend
355 $(H)echo " OCAMLDEP -native"
356 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt
358 # this should be sligtly better, since should work with 'make all opt'
359 MAKECMDGOALS_DELIM=$(addprefix _x_,$(addsuffix _x_,$(MAKECMDGOALS)))
360 ifneq (,$(findstring _x_all_x_,$(MAKECMDGOALS_DELIM)))
361 # if we 'make all opt' the deps for 'all' should be fine also for opt
362 # if we 'make opt all' it should not work...
363 INCLUDE_MANDATORY=yes
365 TO_DEPEND_ON=$(LIB_DEPS)
366 else ifneq (,$(findstring _x_opt_x_,$(MAKECMDGOALS_DELIM)))
367 INCLUDE_MANDATORY=yes
368 TO_INCLUDE+=.depend.opt
369 TO_DEPEND_ON=$(LIBX_DEPS)
370 else ifneq (,$(findstring _x_world_x_,$(MAKECMDGOALS_DELIM)))
371 ifeq ($(HAVE_OCAMLOPT),yes)
372 INCLUDE_MANDATORY=yes
373 TO_INCLUDE+=.depend.opt
374 TO_DEPEND_ON=$(LIBX_DEPS)
376 INCLUDE_MANDATORY=yes
378 TO_DEPEND_ON=$(LIB_DEPS)
383 TO_DEPEND_ON=$(LIB_DEPS)
386 $(MLI:%.mli=%.cmi) $(ML:%.ml=%.cmo) $(ML:%.ml=%.cmx): $(TO_DEPEND_ON)
388 ifeq (no,$(INCLUDE_MANDATORY))
389 -include $(TO_INCLUDE)
391 include $(TO_INCLUDE)
395 $(H)echo " OCAMLC $<"
396 $(H)$(OCAMLC) $(PKGS) -c $<
398 $(H)echo " OCAMLC $<"
399 $(H)$(OCAMLC) $(PKGS) -c $<
401 $(H)echo " OCAMLOPT $<"
402 $(H)$(OCAMLOPT) $(PKGS) -c $<
404 $(H)echo " OCAMLC -dtypes $<"
405 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
410 ./dep2dot.rb < $< | tred > $@
412 # }}} End of deps and automatic rules
414 # vim: set foldmethod=marker: