1 MAKEFLAGS+=--no-print-directory
2 OCAMLPATH = ../ocaml/METAS/
3 OCAMLFIND = OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH @OCAMLFIND@
5 LABLGLADECC = @LABLGLADECC@
6 REQUIRES = @FINDLIB_REQUIRES@
7 CREQUIRES = @FINDLIB_CREQUIRES@
8 DEPREQUIRES = @FINDLIB_DEPREQUIRES@
9 CLEANREQUIRES = @FINDLIB_CLEANREQUIRES@
10 HAVE_OCAMLOPT = @HAVE_OCAMLOPT@
12 OCAML_FLAGS = -pp $(CAMLP4O)
13 PKGS = -package "$(REQUIRES)"
14 CPKGS = -package "$(CREQUIRES)"
15 DEPPKGS = -package "$(DEPREQUIRES)"
16 CLEANPKGS = -package "$(CLEANREQUIRES)"
17 OCAML_THREADS_FLAGS = -thread
18 OCAML_DEBUG_FLAGS = -g
19 OCAMLC_FLAGS = $(OCAML_FLAGS) $(OCAML_THREADS_FLAGS)
20 OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS)
21 OCAMLOPT = $(OCAMLFIND) opt $(OCAMLC_FLAGS)
22 OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAML_FLAGS)
23 # objects for matita (GTK GUI)
34 matitaDisambiguator.cmo \
39 matitaGeneratedGui.cmo \
44 # objects for matitac (batch compiler)
53 matitaDisambiguator.cmo \
59 MAKECMOS = $(CCMOS) matitamakeLib.cmo
61 all: matita.conf.xml matita matitac matitatop cicbrowser matitadep matitaclean matitamake
63 matita.conf.xml: matita.conf.xml.sample
64 @if diff matita.conf.xml.sample matita.conf.xml 1>/dev/null 2>/dev/null; then\
65 touch matita.conf.xml;\
68 echo "matita.conf.xml.sample is newer than matita.conf.xml";\
70 echo "PLEASE update your configuration file!";\
71 echo "(copying matita.conf.xml.sample should work)";\
76 matita.conf.xml.sample: matita.conf.xml.sample.in
80 @echo "WARNING: The configuration sample file has changed!"
83 ifeq ($(HAVE_OCAMLOPT),yes)
84 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
85 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
86 CLEANCMXS = $(patsubst %.cmo,%.cmx,$(CLEANCMOS))
87 MAKECMXS = $(patsubst %.cmo,%.cmx,$(MAKECMOS))
88 LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(REQUIRES))
89 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(REQUIRES))
90 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(CREQUIRES))
91 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(CREQUIRES))
92 DEPLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(DEPREQUIRES))
93 DEPLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(DEPREQUIRES))
94 CLEANLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(CLEANREQUIRES))
95 CLEANLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(CLEANREQUIRES))
96 MAKELIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MAKEREQUIRES))
97 MAKELIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MAKEREQUIRES))
98 opt: matita.opt matitac.opt cicbrowser.opt matitadep.opt matitaclean.opt matitamake.opt
101 @echo "Native code compilation is disabled"
104 matita: $(LIB_DEPS) $(CMOS) matita.ml
105 $(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml
106 matita.opt: $(LIBX_DEPS) $(CMXS) matita.ml
107 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml
109 matitac: $(CLIB_DEPS) $(CCMOS) matitac.ml
110 $(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) matitac.ml
111 matitac.opt: $(CLIBX_DEPS) $(CCMXS) matitac.ml
112 $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) matitac.ml
114 matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS)
115 $(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $<
117 matitadep: matitadep.ml $(DEPLIB_DEPS) $(CCMOS)
118 $(OCAMLC) $(DEPPKGS) -linkpkg -o $@ $(CCMOS) $<
119 matitadep.opt: matitadep.ml $(DEPLIB_DEPS) $(CCMXS)
120 $(OCAMLOPT) $(DEPPKGS) -linkpkg -o $@ $(CCMXS) $<
122 matitaclean: matitaclean.ml $(CLEANLIB_DEPS) $(CLEANCMOS)
123 $(OCAMLC) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMOS) $<
124 matitaclean.opt: matitaclean.ml $(CLEANLIB_DEPS) $(CLEANCMXS)
125 $(OCAMLOPT) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMXS) $<
127 matitamake: matitamake.ml $(MAKECMOS)
128 $(OCAMLC) $(PKGS) -linkpkg -o $@ $(MAKECMOS) $<
129 matitamake.opt: matitamake.ml $(MAKECMXS)
130 $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(MAKECMXS) $<
133 @test -f $@ || ln -s $< $@
134 cicbrowser.opt: matita.opt
135 @test -f $@ || ln -s $< $@
137 matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade
138 $(LABLGLADECC) -embed $< > matitaGeneratedGui.ml
139 $(OCAMLC) $(PKGS) -i matitaGeneratedGui.ml > matitaGeneratedGui.mli
142 $(OCAMLC) $(PKGS) -c $<
144 $(OCAMLC) $(PKGS) -c $<
146 $(OCAMLOPT) $(PKGS) -c $<
148 $(OCAMLC) -dtypes $(PKGS) -c $<
151 rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \
152 matita matita.opt matitac matitac.opt \
153 cicbrowser cicbrowser.opt \
154 matitadep matitadep.opt \
155 matitaclean matitaclean.opt \
156 matitatop matitatop.opt
158 rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
159 rm -f config.log config.status Makefile buildTimeConf.ml
160 rm -f matita.glade.bak matita.gladep.bak
161 rm -rf autom4te.cache/
162 rm -f configure matita.conf.xml.sample
164 tests: matitac matitadep matitaclean
165 @(cd library && make MATITAC="- ../scripts/do_tests.sh $(DO_TESTS_OPTS) ../matitac ../matitaclean /dev/null" clean all)
166 @(cd tests && make MATITAC="- ../scripts/do_tests.sh $(DO_TESTS_OPTS) ../matitac ../matitaclean /dev/null" clean all)
167 tests.opt: matitac.opt matitadep.opt matitaclean.opt
168 @(cd library && make MATITAC="- ../scripts/do_tests.sh $(DO_TESTS_OPTS) ../matitac.opt ../matitaclean.opt /dev/null" clean.opt opt)
169 @(cd tests && make MATITAC="- ../scripts/do_tests.sh $(DO_TESTS_OPTS) ../matitac.opt ../matitaclean.opt /dev/null" clean.opt opt)
170 cleantests: matitaclean
171 @(cd library && make clean)
172 @(cd tests && make clean)
173 .PHONY: tests tests.opt cleantests
178 cd ..; otags -vi -r ocaml/ matita/
180 #.depend: matitaGeneratedGui.ml matitaGeneratedGui.mli *.ml *.mli
182 $(OCAMLDEP) *.ml *.mli > .depend
186 .PHONY: all opt clean distclean depend
189 $(CMOS:%.cmo=%.cmx): $(LIBX_DEPS)
191 ifeq ($(MAKECMDGOALS),all)
192 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
194 ifeq ($(MAKECMDGOALS),)
195 $(CMOS:%.cmo=%.cmi): $(LIB_DEPS)
197 ifeq ($(MAKECMDGOALS),opt)
198 $(CMOS:%.cmo=%.cmi): $(LIBX_DEPS)