From a27fe140c2777efa829ae9ccbf67ff92c38921a8 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Fri, 4 Nov 2005 09:47:03 +0000 Subject: [PATCH] more structured makefile --- helm/matita/Makefile.in | 198 ++++++++++++++++++++++------------------ 1 file changed, 111 insertions(+), 87 deletions(-) diff --git a/helm/matita/Makefile.in b/helm/matita/Makefile.in index b1239778c..ba4a48b12 100644 --- a/helm/matita/Makefile.in +++ b/helm/matita/Makefile.in @@ -27,25 +27,6 @@ OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS) OCAMLOPT = $(OCAMLFIND) opt $(OCAMLC_FLAGS) OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAML_FLAGS) -STATIC_LINK = dist/static_link/static_link -# for matita -STATIC_LIBS = \ - t1 t1x \ - gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \ - gtksourceview-1.0 \ - gdome gmetadom_gdome_cpp_smart \ - stdc++ \ - mysqlclient \ - expat \ - $(NULL) -STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++ -# for matitac & co -STATIC_CLIBS = \ - gdome \ - mysqlclient \ - $(NULL) -STATIC_EXTRA_CLIBS = - MATITA_FLAGS = NODB=false ifeq ($(NODB),true) @@ -106,9 +87,8 @@ MAKECMOS = \ PROGRAMS_BYTE = matita matitac cicbrowser matitadep matitaclean matitamake dump_moo PROGRAMS = $(PROGRAMS_BYTE) matitatop PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE)) -PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT)) -PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC)) +.PHONY: all all: matita.conf.xml $(PROGRAMS) coq.moo matita.conf.xml: matita.conf.xml.sample @@ -137,6 +117,7 @@ coq.moo.opt: coq.ma matitac.opt ./matitac.opt $(MATITA_FLAGS) coq.ma ifeq ($(HAVE_OCAMLOPT),yes) + CMXS = $(patsubst %.cmo,%.cmx,$(CMOS)) CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS)) MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS)) @@ -153,47 +134,32 @@ CLEANLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -forma CLEANLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(CLEANREQUIRES)) MAKELIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MAKEREQUIRES)) MAKELIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MAKEREQUIRES)) +.PHONY: opt opt: $(PROGRAMS_OPT) coq.moo.opt -static: $(PROGRAMS_STATIC) coq.moo.opt +.PHONY: upx upx: $(PROGRAMS_UPX) coq.moo.opt + else -upx: - @echo "Native code compilation is disabled" + opt: @echo "Native code compilation is disabled" -static: - @echo "Native code compilation is disabled" + endif matita: $(LIB_DEPS) $(CMOS) matita.ml $(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml matita.opt: $(LIBX_DEPS) $(CMXS) matita.ml $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml -matita.opt.static: $(LIBX_DEPS) $(CMXS) matita.ml - $(STATIC_LINK) $(STATIC_LIBS) -- \ - $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \ - $(STATIC_EXTRA_LIBS) - strip $@ dump_moo: buildTimeConf.cmo matitaLog.cmo matitaMoo.cmo dump_moo.ml $(OCAMLC) $(PKGS) -linkpkg -o $@ $^ dump_moo.opt: buildTimeConf.cmx matitaLog.cmx matitaMoo.cmx dump_moo.ml $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ -dump_moo.opt.static: buildTimeConf.cmx matitaLog.cmx matitaMoo.cmx dump_moo.ml - $(STATIC_LINK) $(STATIC_CLIBS) -- \ - $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \ - $(STATIC_EXTRA_CLIBS) - strip $@ matitac: $(CLIB_DEPS) $(CCMOS) $(MAINCMOS) matitac.ml $(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml matitac.opt: $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml -matitac.opt.static: $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml - $(STATIC_LINK) $(STATIC_CLIBS) -- \ - $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \ - $(STATIC_EXTRA_CLIBS) - strip $@ matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS) $(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $< @@ -202,77 +168,39 @@ matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS) # $(OCAMLC) $(DEPPKGS) -linkpkg -o $@ $(DEPCMOS) $< # matitadep.opt: matitadep.ml $(DEPLIB_DEPS) $(DEPCMXS) # $(OCAMLOPT) $(DEPPKGS) -linkpkg -o $@ $(DEPCMXS) $< -# matitadep.opt.static: matitadep.ml $(DEPLIB_DEPS) $(DEPCMXS) -# $(STATIC_LINK) $(STATIC_CLIBS) -- \ -# $(OCAMLOPT) $(DEPPKGS) -linkpkg -o $@ $(DEPCMXS) $< \ -# $(STATIC_EXTRA_CLIBS) -# strip $@ matitadep: matitac @test -f $@ || ln -s $< $@ matitadep.opt: matitac.opt @test -f $@ || ln -s $< $@ -matitadep.opt.static: matitac.opt.static - @test -f $@ || ln -s $< $@ # matitaclean: matitaclean.ml $(CLEANLIB_DEPS) $(CLEANCMOS) # $(OCAMLC) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMOS) $< # matitaclean.opt: matitaclean.ml $(CLEANLIB_DEPS) $(CLEANCMXS) # $(OCAMLOPT) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMXS) $< -# matitaclean.opt.static: matitaclean.ml $(CLEANLIB_DEPS) $(CLEANCMXS) -# $(STATIC_LINK) $(STATIC_CLIBS) -- \ -# $(OCAMLOPT) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMXS) $< \ -# $(STATIC_EXTRA_CLIBS) -# strip $@ matitaclean: matitac @test -f $@ || ln -s $< $@ matitaclean.opt: matitac.opt @test -f $@ || ln -s $< $@ -matitaclean.opt.static: matitac.opt.static - @test -f $@ || ln -s $< $@ # matitamake: matitamake.ml $(MAKECMOS) # $(OCAMLC) $(MAKEPKGS) -linkpkg -o $@ $(MAKECMOS) $< # matitamake.opt: matitamake.ml $(MAKECMXS) # $(OCAMLOPT) $(MAKEPKGS) -linkpkg -o $@ $(MAKECMXS) $< -# matitamake.opt.static: matitamake.ml $(MAKECMXS) -# $(STATIC_LINK) $(STATIC_CLIBS) -- \ -# $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(MAKECMXS) $< \ -# $(STATIC_EXTRA_CLIBS) -# strip $@ matitamake: matitac @test -f $@ || ln -s $< $@ matitamake.opt: matitac.opt @test -f $@ || ln -s $< $@ -matitamake.opt.static: matitac.opt.static - @test -f $@ || ln -s $< $@ cicbrowser: matita @test -f $@ || ln -s $< $@ cicbrowser.opt: matita.opt @test -f $@ || ln -s $< $@ -cicbrowser.opt.static: matita.opt.static - @test -f $@ || ln -s $< $@ -cicbrowser.opt.static.upx: matita.opt.static.upx - @test -f $@ || ln -s $< $@ matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade $(LABLGLADECC) -embed $< > matitaGeneratedGui.ml $(OCAMLC) $(PKGS) -i matitaGeneratedGui.ml > matitaGeneratedGui.mli -%.cmi: %.mli - $(OCAMLC) $(PKGS) -c $< -%.cmo %.cmi: %.ml - $(OCAMLC) $(PKGS) -c $< -%.cmx: %.ml - $(OCAMLOPT) $(PKGS) -c $< -%.annot: %.ml - $(OCAMLC) -dtypes $(PKGS) -c $< - -%.upx: % - cp $< $@ - strip $@ - upx $@ - +.PHONY: clean clean: rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \ $(PROGRAMS) \ @@ -280,12 +208,6 @@ clean: $(PROGRAMS_STATIC) \ $(PROGRAMS_UPX) \ $(NULL) -distclean: clean - rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli - rm -f config.log config.status Makefile buildTimeConf.ml - rm -f matita.glade.bak matita.gladep.bak - rm -rf autom4te.cache/ - rm -f configure matita.conf.xml.sample tests: matitac matitadep matitaclean @(cd library && make MATITAC="- ../scripts/do_tests.sh $(DO_TESTS_OPTS) ../matitac ../matitaclean /dev/null" clean all) @@ -301,18 +223,119 @@ cleantests: matitaclean @(cd contribs/LAMBDA-TYPES && make clean) .PHONY: tests tests.opt cleantests +# {{{ Distribution stuff + +STATIC_LINK = dist/static_link/static_link +# for matita +STATIC_LIBS = \ + t1 t1x \ + gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \ + gtksourceview-1.0 \ + gdome gmetadom_gdome_cpp_smart \ + stdc++ \ + mysqlclient \ + expat \ + $(NULL) +STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++ +# for matitac & co +STATIC_CLIBS = \ + gdome \ + mysqlclient \ + $(NULL) +STATIC_EXTRA_CLIBS = +PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT)) +PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC)) + +ifeq ($(HAVE_OCAMLOPT),yes) +static: $(STATIC_LINK) $(PROGRAMS_STATIC) coq.moo.opt +else +upx: + @echo "Native code compilation is disabled" +static: + @echo "Native code compilation is disabled" +endif + +$(STATIC_LINK): + $(MAKE) -C dist/ $(STATIC_LINK) + +matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml + $(STATIC_LINK) $(STATIC_LIBS) -- \ + $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \ + $(STATIC_EXTRA_LIBS) + strip $@ +dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx matitaLog.cmx matitaMoo.cmx dump_moo.ml + $(STATIC_LINK) $(STATIC_CLIBS) -- \ + $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \ + $(STATIC_EXTRA_CLIBS) + strip $@ +matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml + $(STATIC_LINK) $(STATIC_CLIBS) -- \ + $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \ + $(STATIC_EXTRA_CLIBS) + strip $@ +# matitadep.opt.static: $(STATIC_LINK) matitadep.ml $(DEPLIB_DEPS) $(DEPCMXS) +# $(STATIC_LINK) $(STATIC_CLIBS) -- \ +# $(OCAMLOPT) $(DEPPKGS) -linkpkg -o $@ $(DEPCMXS) $< \ +# $(STATIC_EXTRA_CLIBS) +# strip $@ +matitadep.opt.static: matitac.opt.static + @test -f $@ || ln -s $< $@ +# matitaclean.opt.static: $(STATIC_LINK) matitaclean.ml $(CLEANLIB_DEPS) $(CLEANCMXS) +# $(STATIC_LINK) $(STATIC_CLIBS) -- \ +# $(OCAMLOPT) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMXS) $< \ +# $(STATIC_EXTRA_CLIBS) +# strip $@ +matitaclean.opt.static: matitac.opt.static + @test -f $@ || ln -s $< $@ +# matitamake.opt.static: $(STATIC_LINK) matitamake.ml $(MAKECMXS) +# $(STATIC_LINK) $(STATIC_CLIBS) -- \ +# $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(MAKECMXS) $< \ +# $(STATIC_EXTRA_CLIBS) +# strip $@ +matitamake.opt.static: matitac.opt.static + @test -f $@ || ln -s $< $@ +cicbrowser.opt.static: matita.opt.static + @test -f $@ || ln -s $< $@ +cicbrowser.opt.static.upx: matita.opt.static.upx + @test -f $@ || ln -s $< $@ + +.PHONY: distclean +distclean: clean + $(MAKE) -C dist/ clean + rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli + rm -f config.log config.status Makefile buildTimeConf.ml + rm -f matita.glade.bak matita.gladep.bak + rm -rf autom4te.cache/ + rm -f configure matita.conf.xml.sample + +%.upx: % + cp $< $@ + strip $@ + upx $@ + +# }}} End of distribution stuff + tags: TAGS .PHONY: TAGS TAGS: cd ..; otags -vi -r ocaml/ matita/ #.depend: matitaGeneratedGui.ml matitaGeneratedGui.mli *.ml *.mli + +.PHONY: depend depend: $(OCAMLDEP) *.ml *.mli > .depend include .depend -.PHONY: all opt clean distclean depend +%.cmi: %.mli + $(OCAMLC) $(PKGS) -c $< +%.cmo %.cmi: %.ml + $(OCAMLC) $(PKGS) -c $< +%.cmx: %.ml + $(OCAMLOPT) $(PKGS) -c $< +%.annot: %.ml + $(OCAMLC) -dtypes $(PKGS) -c $< $(CMOS): $(LIB_DEPS) $(CMOS:%.cmo=%.cmx): $(LIBX_DEPS) @@ -327,3 +350,4 @@ ifeq ($(MAKECMDGOALS),opt) $(CMOS:%.cmo=%.cmi): $(LIBX_DEPS) endif +# vim: set foldmethod=marker: -- 2.39.2