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 WPKGS = -package "$(MATITA_WREQUIRES)"
19 OCAML_THREADS_FLAGS = -thread
20 OCAML_DEBUG_FLAGS = -g
22 #OCAMLOPT_DEBUG_FLAGS = -p
23 OCAMLC_FLAGS = $(OCAML_FLAGS) $(OCAML_THREADS_FLAGS)
24 OCAMLC = $(OCAMLFIND) ocamlc$(OCAML_PROF) $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS) $(SYNTAXOPTIONS)
25 OCAMLTOP = $(OCAMLFIND) ocamlmktop$(OCAML_PROF) $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS) $(SYNTAXOPTIONS)
26 OCAMLOPT = $(OCAMLFIND) opt $(OCAMLC_FLAGS) $(OCAMLOPT_DEBUG_FLAGS)
27 OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAMLDEP_FLAGS)
28 INSTALL_PROGRAMS= matita matitac
29 INSTALL_PROGRAMS_LINKS_MATITA=
30 INSTALL_PROGRAMS_LINKS_MATITAC= matitaclean
32 MATITA_FLAGS = -noprofile
39 matitaScriptLexer.mli \
43 applyTransformation.mli \
50 predefined_virtuals.mli \
58 applyTransformation.mli \
66 applyTransformation.mli \
70 matitaFilesystem.mli \
71 matitaAuthentication.mli \
76 # objects for matita (GTK GUI)
77 ML = buildTimeConf.ml matitaGeneratedGui.ml $(MLI:%.mli=%.ml)
78 # objects for matitac (batch compiler)
79 CML = buildTimeConf.ml $(CMLI:%.mli=%.ml)
80 WML = buildTimeConf.ml $(WMLI:%.mli=%.ml)
81 MAINCML = $(MAINCMLI:%.mli=%.ml)
84 matita matitac matitadaemon matitaclean
85 PROGRAMS = $(PROGRAMS_BYTE)
86 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
88 NOINST_PROGRAMS_OPT = $(patsubst %,%.opt,$(EXTRA_PROGRAMS))
91 all: $(PROGRAMS) $(NOINST_PROGRAMS)
93 UTF8DIR := $(shell $(OCAMLFIND) query helm-syntax_extensions)
94 ULEXDIR := $(shell $(OCAMLFIND) query ulex08)
96 matitaScriptLexer.cmo: SYNTAXOPTIONS = -pp "camlp5o -I $(UTF8DIR) -I $(ULEXDIR) pa_extend.cmo pa_ulex.cma pa_unicode_macro.cma -loc loc"
98 matitaFilesystem.cmi: matitaFilesystem.mli
100 $(H)$(OCAMLC) $(WPKGS) -c $<
101 matitaFilesystem.cmo: matitaFilesystem.ml
102 $(H)echo " OCAMLC $<"
103 $(H)$(OCAMLC) $(WPKGS) -c $<
105 matitaAuthentication.cmi: matitaAuthentication.mli
106 $(H)echo " OCAMLC $<"
107 $(H)$(OCAMLC) $(WPKGS) -c $<
108 matitaAuthentication.cmo: matitaAuthentication.ml
109 $(H)echo " OCAMLC $<"
110 $(H)$(OCAMLC) $(WPKGS) -c $<
112 CMOS = $(ML:%.ml=%.cmo)
113 CCMOS = $(CML:%.ml=%.cmo)
114 WCMOS = $(WML:%.ml=%.cmo)
115 MAINCMOS = $(MAINCML:%.ml=%.cmo)
116 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
117 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
118 WCMXS = $(patsubst %.cmo,%.cmx,$(WCMOS))
119 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
120 $(CMOS) : $(LIB_DEPS)
121 $(CMXOS): $(LIBX_DEPS)
123 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES))
124 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
125 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
126 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
127 WLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_WREQUIRES))
128 WLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_WREQUIRES))
129 opt: $(PROGRAMS_OPT) $(NOINST_PROGRAMS_OPT)
133 ifeq ($(HAVE_OCAMLOPT),yes)
134 world: depend.opt opt links
141 $(H)for X in $(INSTALL_PROGRAMS_LINKS_MATITAC) \
142 $(INSTALL_PROGRAMS_LINKS_MATITA); do\
145 $(H)ln -sf matita.opt matita
146 $(H)ln -sf matitac.opt matitac
149 $(H)echo " OCAMLC matita.ml"
150 $(H)$(OCAMLC) $(PKGS) -linkpkg -o matita $(CMOS) $(OCAML_DEBUG_FLAGS) matita.ml
151 $(H)echo " OCAMLC matitac.ml"
152 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o matitac $(CCMOS) $(MAINCMOS) $(OCAML_DEBUG_FLAGS) matitac.ml
153 $(H)echo " OCAMLC matitadaemon.ml"
154 $(H)$(OCAMLC) $(WPKGS) -linkpkg -o matitadaemon $(WCMOS) $(MAINCMOS) $(OCAML_DEBUG_FLAGS) matitadaemon.ml
157 matita: matita.ml $(LIB_DEPS) $(CMOS)
158 $(H)echo " OCAMLC $<"
159 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
160 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
161 $(H)echo " OCAMLOPT $<"
162 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
164 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
165 $(H)echo " OCAMLC $<"
166 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
167 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
168 $(H)echo " OCAMLOPT $<"
169 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
171 matitadaemon: matitadaemon.ml $(WLIB_DEPS) $(WCMOS) $(MAINCMOS)
172 $(H)echo " OCAMLC $<"
173 $(H)$(OCAMLC) $(WPKGS) -linkpkg -o $@ $(WCMOS) $(MAINCMOS) matitadaemon.ml
174 matitadaemon.opt: matitadaemon.ml $(WLIBX_DEPS) $(WCMXS) $(MAINCMXS)
175 $(H)echo " OCAMLOPT $<"
176 $(H)$(OCAMLOPT) $(WPKGS) -linkpkg -o $@ $(WCMXS) $(MAINCMXS) matitadaemon.ml
178 rottener: rottener.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
179 $(H)echo " OCAMLC $<"
180 $(H)$(OCAMLC) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMOS) $(MAINCMOS) rottener.ml
181 rottener.opt: rottener.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
182 $(H)echo " OCAMLOPT $<"
183 $(H)$(OCAMLOPT) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMXS) $(MAINCMXS) rottener.ml
185 find . -type f -name "*.ma.*.rottened" -exec rm {} \;
188 $(H)test -f $@ || ln -s $< $@
189 matitaclean.opt: matitac.opt
190 $(H)test -f $@ || ln -s $< $@
192 matitaGeneratedGui.ml: matita.glade.utf8
193 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
195 matita.glade.utf8: matita.glade
196 $(H)xmllint --encode UTF8 $< > $@
200 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
201 $(PROGRAMS) $(PROGRAMS_OPT) \
202 rottener rottener.opt \
203 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
211 $(H)$(MAKE) -C dist/ clean
212 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
213 $(H)rm -f buildTimeConf.ml
214 $(H)rm -f matita.glade.bak matita.gladep.bak
215 $(H)rm -f matita.conf.xml.sample
226 contribs/RELATIONAL \
234 # contribs/LAMBDA-TYPES \
237 .PHONY: tests tests.opt cleantests cleantests.opt
238 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
239 tests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-test-opt)
240 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
241 cleantests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-cleantests-opt)
243 %-test: matitac matitaclean
244 -cd $* && make -k clean all
245 %-test-opt: matitac.opt matitaclean.opt
246 -cd $* && make -k clean.opt opt
247 %-cleantests: matitaclean
249 %-cleantests-opt: matitaclean.opt
250 -cd $* && make clean.opt
252 # {{{ Distribution stuff
254 ifeq ($(DISTRIBUTED),yes)
257 dist_library: install_preliminaries
259 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitac -system -noinnertypes)
261 $(H)cd $(WHERE)/ma/standard-library;(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitaclean)
263 $(H)cp $(WHERE)/.matita/matita.db $(WHERE)/metadata.db || true
264 #$(H)rm -rf $(WHERE)/.matita/
269 dist_pre: matitaGeneratedGui.ml
270 $(MAKE) -C dist/ dist_pre
272 WHERE = $(DESTDIR)/$(RT_BASE_DIR)
282 gtkmathview.matita.conf.xml \
287 ifeq ($(HAVE_OCAMLOPT),yes)
288 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
290 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
293 install-arch: install_preliminaries
296 install_preliminaries : install_preliminaries.stamp
298 install_preliminaries.stamp:
299 $(H)install -d $(WHERE)/ma/
300 $(H)cp -a $(INSTALL_STUFF) $(WHERE)
301 ifeq ($(HAVE_OCAMLOPT),yes)
302 $(H)install -s $(INSTALL_STUFF_BIN) $(WHERE)
303 $(H)for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(WHERE)/$$p; done
305 $(H)install $(INSTALL_STUFF_BIN) $(WHERE)
307 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
308 ln -fs matitac $(WHERE)/$$p;\
310 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
311 ln -fs matita $(WHERE)/$$p;\
313 $(H)cp -a library/ $(WHERE)/ma/standard-library
314 $(H)cp -a nlibrary/ $(WHERE)/ma/new-standard-library
316 $(H)touch install_preliminaries.stamp
321 STATIC_LINK = dist/static_link/static_link
325 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
327 gdome gmetadom_gdome_cpp_smart \
332 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
338 STATIC_CLIBS_PROVER = \
347 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
348 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
350 ifeq ($(HAVE_OCAMLOPT),yes)
351 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
354 $(H)echo "Native code compilation is disabled"
356 $(H)echo "Native code compilation is disabled"
360 $(MAKE) -C dist/ $(STATIC_LINK)
362 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
363 $(STATIC_LINK) $(STATIC_LIBS) -- \
364 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
367 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
368 $(STATIC_LINK) $(STATIC_CLIBS) -- \
369 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
370 $(STATIC_EXTRA_CLIBS)
372 matitaclean.opt.static: matitac.opt.static
373 $(H)test -f $@ || ln -s $< $@
380 # }}} End of distribution stuff
382 # {{{ Deps and automatic rules
386 $(H)cd ..; otags -vi -r components/ matita/
392 $(H)$(OCAMLDEP) *.ml *.mli > .depend
394 $(H)echo " OCAMLDEP -native"
395 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt
397 # this should be sligtly better, since should work with 'make all opt'
398 MAKECMDGOALS_DELIM=$(addprefix _x_,$(addsuffix _x_,$(MAKECMDGOALS)))
399 ifneq (,$(findstring _x_all_x_,$(MAKECMDGOALS_DELIM)))
400 # if we 'make all opt' the deps for 'all' should be fine also for opt
401 # if we 'make opt all' it should not work...
402 INCLUDE_MANDATORY=yes
404 TO_DEPEND_ON=$(LIB_DEPS)
405 else ifneq (,$(findstring _x_opt_x_,$(MAKECMDGOALS_DELIM)))
406 INCLUDE_MANDATORY=yes
407 TO_INCLUDE+=.depend.opt
408 TO_DEPEND_ON=$(LIBX_DEPS)
409 else ifneq (,$(findstring _x_world_x_,$(MAKECMDGOALS_DELIM)))
410 ifeq ($(HAVE_OCAMLOPT),yes)
411 INCLUDE_MANDATORY=yes
412 TO_INCLUDE+=.depend.opt
413 TO_DEPEND_ON=$(LIBX_DEPS)
415 INCLUDE_MANDATORY=yes
417 TO_DEPEND_ON=$(LIB_DEPS)
422 TO_DEPEND_ON=$(LIB_DEPS)
425 $(MLI:%.mli=%.cmi) $(ML:%.ml=%.cmo) $(ML:%.ml=%.cmx): $(TO_DEPEND_ON)
427 ifeq (no,$(INCLUDE_MANDATORY))
428 -include $(TO_INCLUDE)
430 include $(TO_INCLUDE)
434 $(H)echo " OCAMLC $<"
435 $(H)$(OCAMLC) $(PKGS) -c $<
437 $(H)echo " OCAMLC $<"
438 $(H)$(OCAMLC) $(PKGS) -c $<
440 $(H)echo " OCAMLOPT $<"
441 $(H)$(OCAMLOPT) $(PKGS) -c $<
443 $(H)echo " OCAMLC -dtypes $<"
444 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
449 ./dep2dot.rb < $< | tred > $@
451 # }}} End of deps and automatic rules
454 # vim: set foldmethod=marker: