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= matitaclean
30 MATITA_FLAGS = -noprofile
40 applyTransformation.mli \
47 predefined_virtuals.mli \
55 applyTransformation.mli \
63 # objects for matita (GTK GUI)
64 ML = buildTimeConf.ml matitaGeneratedGui.ml $(MLI:%.mli=%.ml)
65 # objects for matitac (batch compiler)
66 CML = buildTimeConf.ml $(CMLI:%.mli=%.ml)
67 MAINCML = $(MAINCMLI:%.mli=%.ml)
70 matita matitac matitaclean
71 PROGRAMS = $(PROGRAMS_BYTE)
72 PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE))
74 NOINST_PROGRAMS_OPT = $(patsubst %,%.opt,$(EXTRA_PROGRAMS))
77 all: $(PROGRAMS) $(NOINST_PROGRAMS)
79 CMOS = $(ML:%.ml=%.cmo)
80 CCMOS = $(CML:%.ml=%.cmo)
81 MAINCMOS = $(MAINCML:%.ml=%.cmo)
82 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
83 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
84 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
86 $(CMXOS): $(LIBX_DEPS)
88 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES))
89 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
90 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
91 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
92 opt: $(PROGRAMS_OPT) $(NOINST_PROGRAMS_OPT)
96 ifeq ($(HAVE_OCAMLOPT),yes)
97 world: depend.opt opt links
104 $(H)for X in $(INSTALL_PROGRAMS_LINKS_MATITAC) \
105 $(INSTALL_PROGRAMS_LINKS_MATITA); do\
108 $(H)ln -sf matita.opt matita
109 $(H)ln -sf matitac.opt matitac
112 $(H)echo " OCAMLC matita.ml"
113 $(H)$(OCAMLC) $(PKGS) -linkpkg -o matita $(CMOS) $(OCAML_DEBUG_FLAGS) matita.ml
114 $(H)echo " OCAMLC matitac.ml"
115 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o matitac $(CCMOS) $(MAINCMOS) $(OCAML_DEBUG_FLAGS) matitac.ml
117 matita: matita.ml $(LIB_DEPS) $(CMOS)
118 $(H)echo " OCAMLC $<"
119 $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
120 matita.opt: matita.ml $(LIBX_DEPS) $(CMXS)
121 $(H)echo " OCAMLOPT $<"
122 $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
124 matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
125 $(H)echo " OCAMLC $<"
126 $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml
127 matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
128 $(H)echo " OCAMLOPT $<"
129 $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml
131 rottener: rottener.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS)
132 $(H)echo " OCAMLC $<"
133 $(H)$(OCAMLC) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMOS) $(MAINCMOS) rottener.ml
134 rottener.opt: rottener.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS)
135 $(H)echo " OCAMLOPT $<"
136 $(H)$(OCAMLOPT) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMXS) $(MAINCMXS) rottener.ml
138 find . -type f -name "*.ma.*.rottened" -exec rm {} \;
141 $(H)test -f $@ || ln -s $< $@
142 matitaclean.opt: matitac.opt
143 $(H)test -f $@ || ln -s $< $@
145 matitaGeneratedGui.ml: matita.glade.utf8
146 $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
148 matita.glade.utf8: matita.glade
149 $(H)xmllint --encode UTF8 $< > $@
153 $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
154 $(PROGRAMS) $(PROGRAMS_OPT) \
155 rottener rottener.opt \
156 $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \
164 $(H)$(MAKE) -C dist/ clean
165 $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
166 $(H)rm -f buildTimeConf.ml
167 $(H)rm -f matita.glade.bak matita.gladep.bak
168 $(H)rm -f matita.conf.xml.sample
179 contribs/RELATIONAL \
187 # contribs/LAMBDA-TYPES \
190 .PHONY: tests tests.opt cleantests cleantests.opt
191 tests: $(foreach d,$(TEST_DIRS),$(d)-test)
192 tests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-test-opt)
193 cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests)
194 cleantests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-cleantests-opt)
196 %-test: matitac matitaclean
197 -cd $* && make -k clean all
198 %-test-opt: matitac.opt matitaclean.opt
199 -cd $* && make -k clean.opt opt
200 %-cleantests: matitaclean
202 %-cleantests-opt: matitaclean.opt
203 -cd $* && make clean.opt
205 # {{{ Distribution stuff
207 dist_pre: matitaGeneratedGui.ml
208 $(MAKE) -C dist/ dist_pre
210 WHERE = $(DESTDIR)/$(RT_BASE_DIR)
223 ifeq ($(HAVE_OCAMLOPT),yes)
224 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt)
226 INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS)
229 install-arch: install_preliminaries
232 install_preliminaries : install_preliminaries.stamp
234 install_preliminaries.stamp:
235 $(H)install -d $(WHERE)/ma/
236 $(H)cp -a $(INSTALL_STUFF) $(WHERE)
237 ifeq ($(HAVE_OCAMLOPT),yes)
238 $(H)install -s $(INSTALL_STUFF_BIN) $(WHERE)
239 $(H)for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(WHERE)/$$p; done
241 $(H)install $(INSTALL_STUFF_BIN) $(WHERE)
243 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \
244 ln -fs matitac $(WHERE)/$$p;\
246 $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \
247 ln -fs matita $(WHERE)/$$p;\
249 $(H)cp -a lib $(WHERE)/lib
251 $(H)touch install_preliminaries.stamp
256 STATIC_LINK = dist/static_link/static_link
260 gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \
262 gdome gmetadom_gdome_cpp_smart \
267 STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++
273 STATIC_CLIBS_PROVER = \
282 PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
283 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
285 ifeq ($(HAVE_OCAMLOPT),yes)
286 static: $(STATIC_LINK) $(PROGRAMS_STATIC)
289 $(H)echo "Native code compilation is disabled"
291 $(H)echo "Native code compilation is disabled"
295 $(MAKE) -C dist/ $(STATIC_LINK)
297 matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml
298 $(STATIC_LINK) $(STATIC_LIBS) -- \
299 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \
302 matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml
303 $(STATIC_LINK) $(STATIC_CLIBS) -- \
304 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \
305 $(STATIC_EXTRA_CLIBS)
307 matitaclean.opt.static: matitac.opt.static
308 $(H)test -f $@ || ln -s $< $@
315 # }}} End of distribution stuff
317 # {{{ Deps and automatic rules
321 $(H)cd ..; otags -vi -r components/ matita/
327 $(H)$(OCAMLDEP) *.ml *.mli > .depend
329 $(H)echo " OCAMLDEP -native"
330 $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt
332 # this should be sligtly better, since should work with 'make all opt'
333 MAKECMDGOALS_DELIM=$(addprefix _x_,$(addsuffix _x_,$(MAKECMDGOALS)))
334 ifneq (,$(findstring _x_all_x_,$(MAKECMDGOALS_DELIM)))
335 # if we 'make all opt' the deps for 'all' should be fine also for opt
336 # if we 'make opt all' it should not work...
337 INCLUDE_MANDATORY=yes
339 TO_DEPEND_ON=$(LIB_DEPS)
340 else ifneq (,$(findstring _x_opt_x_,$(MAKECMDGOALS_DELIM)))
341 INCLUDE_MANDATORY=yes
342 TO_INCLUDE+=.depend.opt
343 TO_DEPEND_ON=$(LIBX_DEPS)
344 else ifneq (,$(findstring _x_world_x_,$(MAKECMDGOALS_DELIM)))
345 ifeq ($(HAVE_OCAMLOPT),yes)
346 INCLUDE_MANDATORY=yes
347 TO_INCLUDE+=.depend.opt
348 TO_DEPEND_ON=$(LIBX_DEPS)
350 INCLUDE_MANDATORY=yes
352 TO_DEPEND_ON=$(LIB_DEPS)
357 TO_DEPEND_ON=$(LIB_DEPS)
360 $(MLI:%.mli=%.cmi) $(ML:%.ml=%.cmo) $(ML:%.ml=%.cmx): $(TO_DEPEND_ON)
362 ifeq (no,$(INCLUDE_MANDATORY))
363 -include $(TO_INCLUDE)
365 include $(TO_INCLUDE)
369 $(H)echo " OCAMLC $<"
370 $(H)$(OCAMLC) $(PKGS) -c $<
372 $(H)echo " OCAMLC $<"
373 $(H)$(OCAMLC) $(PKGS) -c $<
375 $(H)echo " OCAMLOPT $<"
376 $(H)$(OCAMLOPT) $(PKGS) -c $<
378 $(H)echo " OCAMLC -dtypes $<"
379 $(H)$(OCAMLC) -dtypes $(PKGS) -c $<
384 ./dep2dot.rb < $< | tred > $@
386 # }}} End of deps and automatic rules
388 # vim: set foldmethod=marker: