3 include ../Makefile.defs
8 OCAML_FLAGS = -pp $(CAMLP5O) -rectypes
9 PKGS = -package "$(MATITA_REQUIRES)"
10 CPKGS = -package "$(MATITA_CREQUIRES)"
11 OCAML_THREADS_FLAGS = -thread
12 OCAML_DEBUG_FLAGS = -g
14 #OCAMLOPT_DEBUG_FLAGS = -p
15 OCAMLC_FLAGS = $(OCAML_FLAGS) $(OCAML_THREADS_FLAGS)
16 OCAMLC = $(OCAMLFIND) ocamlc$(OCAML_PROF) $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS)
17 OCAMLOPT = $(OCAMLFIND) opt $(OCAMLC_FLAGS) $(OCAMLOPT_DEBUG_FLAGS)
18 OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAML_FLAGS)
19 INSTALL_PROGRAMS= matita matitac
20 INSTALL_PROGRAMS_LINKS_MATITA= cicbrowser
21 INSTALL_PROGRAMS_LINKS_MATITAC= matitadep matitamake matitaclean matitaprover matitawiki
23 MATITA_FLAGS = -noprofile
37 applyTransformation.mli \
53 applyTransformation.mli \
64 # objects for matita (GTK GUI)
65 ML = buildTimeConf.ml matitaGeneratedGui.ml $(MLI:%.mli=%.ml)
66 # objects for matitac (batch compiler)
67 CML = buildTimeConf.ml $(CMLI:%.mli=%.ml)
68 MAINCML = $(MAINCMLI:%.mli=%.ml)
71 matita matitac cicbrowser matitadep matitaclean \
72 matitamake matitaprover matitawiki
73 PROGRAMS = $(PROGRAMS_BYTE) matitatop
74 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
75 NOINST_PROGRAMS = dump_moo gragrep
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) matita.ml
116 $(H)echo " OCAMLC matitac.ml"
117 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o matitac $(CCMOS) $(MAINCMOS) 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 dump_moo: dump_moo.ml buildTimeConf.cmo
127 $(H)echo " OCAMLC $<"
128 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ buildTimeConf.cmo $<
129 dump_moo.opt: dump_moo.ml buildTimeConf.cmx
130 $(H)echo "OCAMLOPT $<"
131 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ buildTimeConf.cmx $<
133 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
134 $(H)echo " OCAMLC $<"
135 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
136 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
137 $(H)echo " OCAMLOPT $<"
138 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
140 matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS)
141 $(H)echo " OCAMLC $<"
142 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $<
144 matitaprover: matitac
145 $(H)test -f $@ || ln -s $< $@
146 matitaprover.opt: matitac.opt
147 $(H)test -f $@ || ln -s $< $@
150 $(H)test -f $@ || ln -s $< $@
151 matitadep.opt: matitac.opt
152 $(H)test -f $@ || ln -s $< $@
155 $(H)test -f $@ || ln -s $< $@
156 matitawiki.opt: matitac.opt
157 $(H)test -f $@ || ln -s $< $@
160 $(H)test -f $@ || ln -s $< $@
161 matitaclean.opt: matitac.opt
162 $(H)test -f $@ || ln -s $< $@
165 $(H)test -f $@ || ln -s $< $@
166 matitamake.opt: matitac.opt
167 $(H)test -f $@ || ln -s $< $@
170 $(H)test -f $@ || ln -s $< $@
171 gragrep.opt: matitac.opt
172 $(H)test -f $@ || ln -s $< $@
175 $(H)test -f $@ || ln -s $< $@
176 cicbrowser.opt: matita.opt
177 $(H)test -f $@ || ln -s $< $@
179 matitaGeneratedGui.ml: matita.glade
180 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
184 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
185 $(PROGRAMS) $(PROGRAMS_OPT) \
186 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
194 $(H)$(MAKE) -C dist/ clean
195 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
196 $(H)rm -f buildTimeConf.ml
197 $(H)rm -f matita.glade.bak matita.gladep.bak
198 $(H)rm -f matita.conf.xml.sample
207 contribs/RELATIONAL \
209 contribs/LAMBDA-TYPES \
210 contribs/PREDICATIVE-TOPOLOGY \
218 .PHONY: tests tests.opt cleantests cleantests.opt
219 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
220 tests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-test-opt)
221 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
222 cleantests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-cleantests-opt)
224 %-test: matitac matitadep matitaclean
225 -cd $* && make -k clean all
226 %-test-opt: matitac.opt matitadep.opt matitaclean.opt
227 -cd $* && make -k clean.opt opt
228 %-cleantests: matitaclean
230 %-cleantests-opt: matitaclean.opt
231 -cd $* && make clean.opt
233 # {{{ Distribution stuff
235 ifeq ($(DISTRIBUTED),yes)
238 MATITA_CFLAGS = #-nodb
240 dist_library: install_preliminaries dist_library@standard-library
242 $(H)echo "MATITAMAKE init $*"
243 $(H)(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitamake init $* $(WHERE)/ma/$*)
244 $(H)echo "MATITAMAKE publish $*"
245 $(H)(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitamake publish $*)
246 $(H)echo "MATITAMAKE destroy $*"
247 $(H)(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitamake destroy $*)
249 $(H)cp $(WHERE)/.matita/matita.db $(WHERE)/metadata.db || true
250 #$(H)rm -rf $(WHERE)/.matita/
255 dist_pre: matitaGeneratedGui.ml
256 $(MAKE) -C dist/ dist_pre
258 WHERE = $(DESTDIR)/$(RT_BASE_DIR)
268 gtkmathview.matita.conf.xml \
269 template_makefile.in \
274 ifeq ($(HAVE_OCAMLOPT),yes)
275 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
277 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
280 install-arch: install_preliminaries
281 install-indep: dist_library
283 install_preliminaries : install_preliminaries.stamp
285 install_preliminaries.stamp:
286 $(H)install -d $(WHERE)/ma/
287 $(H)cp -a $(INSTALL_STUFF) $(WHERE)
288 ifeq ($(HAVE_OCAMLOPT),yes)
289 $(H)install -s $(INSTALL_STUFF_BIN) $(WHERE)
290 $(H)for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(WHERE)/$$p; done
292 $(H)install $(INSTALL_STUFF_BIN) $(WHERE)
294 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
295 ln -fs matitac $(WHERE)/$$p;\
297 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
298 ln -fs matita $(WHERE)/$$p;\
300 $(H)cp -a library/ $(WHERE)/ma/standard-library
301 #$(H)cp -a contribs/ $(WHERE)/ma/
302 $(H)touch install_preliminaries.stamp
307 STATIC_LINK = dist/static_link/static_link
311 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
313 gdome gmetadom_gdome_cpp_smart \
318 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
324 STATIC_CLIBS_PROVER = \
333 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
334 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
336 ifeq ($(HAVE_OCAMLOPT),yes)
337 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
340 $(H)echo "Native code compilation is disabled"
342 $(H)echo "Native code compilation is disabled"
346 $(MAKE) -C dist/ $(STATIC_LINK)
348 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
349 $(STATIC_LINK) $(STATIC_LIBS) -- \
350 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
353 dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml
354 $(STATIC_LINK) $(STATIC_CLIBS) -- \
355 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \
356 $(STATIC_EXTRA_CLIBS)
358 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
359 $(STATIC_LINK) $(STATIC_CLIBS) -- \
360 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
361 $(STATIC_EXTRA_CLIBS)
363 matitaprover.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
364 $(STATIC_LINK) $(STATIC_CLIBS_PROVER) -- \
365 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
366 $(STATIC_EXTRA_CLIBS);
368 matitadep.opt.static: matitac.opt.static
369 $(H)test -f $@ || ln -s $< $@
370 matitaclean.opt.static: matitac.opt.static
371 $(H)test -f $@ || ln -s $< $@
372 matitawiki.opt.static: matitac.opt.static
373 $(H)test -f $@ || ln -s $< $@
374 matitamake.opt.static: matitac.opt.static
375 $(H)test -f $@ || ln -s $< $@
376 cicbrowser.opt.static: matita.opt.static
377 $(H)test -f $@ || ln -s $< $@
378 cicbrowser.opt.static.upx: matita.opt.static.upx
379 $(H)test -f $@ || ln -s $< $@
386 # }}} End of distribution stuff
388 # {{{ Deps and automatic rules
392 $(H)cd ..; otags -vi -r components/ matita/
398 $(H)$(OCAMLDEP) *.ml *.mli > .depend
400 $(H)echo " OCAMLDEP -native"
401 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt
403 # this should be sligtly better, since should work with 'make all opt'
404 MAKECMDGOALS_DELIM=$(addprefix _x_,$(addsuffix _x_,$(MAKECMDGOALS)))
405 ifneq (,$(findstring _x_all_x_,$(MAKECMDGOALS_DELIM)))
406 # if we 'make all opt' the deps for 'all' should be fine also for opt
407 # if we 'make opt all' it should not work...
408 INCLUDE_MANDATORY=yes
410 TO_DEPEND_ON=$(LIB_DEPS)
411 else ifneq (,$(findstring _x_opt_x_,$(MAKECMDGOALS_DELIM)))
412 INCLUDE_MANDATORY=yes
413 TO_INCLUDE+=.depend.opt
414 TO_DEPEND_ON=$(LIBX_DEPS)
415 else ifneq (,$(findstring _x_world_x_,$(MAKECMDGOALS_DELIM)))
416 ifeq ($(HAVE_OCAMLOPT),yes)
417 INCLUDE_MANDATORY=yes
418 TO_INCLUDE+=.depend.opt
419 TO_DEPEND_ON=$(LIBX_DEPS)
421 INCLUDE_MANDATORY=yes
423 TO_DEPEND_ON=$(LIB_DEPS)
428 TO_DEPEND_ON=$(LIB_DEPS)
431 $(MLI:%.mli=%.cmi) $(ML:%.ml=%.cmo) $(ML:%.ml=%.cmx): $(TO_DEPEND_ON)
433 ifeq (no,$(INCLUDE_MANDATORY))
434 -include $(TO_INCLUDE)
436 include $(TO_INCLUDE)
440 $(H)echo " OCAMLC $<"
441 $(H)$(OCAMLC) $(PKGS) -c $<
443 $(H)echo " OCAMLC $<"
444 $(H)$(OCAMLC) $(PKGS) -c $<
446 $(H)echo " OCAMLOPT $<"
447 $(H)$(OCAMLOPT) $(PKGS) -c $<
449 $(H)echo " OCAMLC -dtypes $<"
450 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
455 ./dep2dot.rb < $< | tred > $@
457 # }}} End of deps and automatic rules
459 # vim: set foldmethod=marker: