From: Stefano Zacchiroli Date: Wed, 2 Nov 2005 17:48:14 +0000 (+0000) Subject: enable static linking of executables (try "make static") X-Git-Tag: V_0_7_2_3~155 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=7f842db771e5c3a4e9dbefb56dd1005b229ed214;p=helm.git enable static linking of executables (try "make static") --- diff --git a/helm/matita/Makefile.in b/helm/matita/Makefile.in index b4cb75bd4..c1e1c094e 100644 --- a/helm/matita/Makefile.in +++ b/helm/matita/Makefile.in @@ -1,5 +1,7 @@ export SHELL=/bin/bash +NULL = + MAKEFLAGS+=--no-print-directory OCAMLPATH = ../ocaml/METAS/ OCAMLFIND = OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH @OCAMLFIND@ @@ -23,15 +25,25 @@ 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 +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++ -cclib -lart_lgpl_2 + MATITA_FLAGS = NODB=false ifeq ($(NODB),true) MATITA_FLAGS += -nodb endif - # objects for matita (GTK GUI) -NULL = CMOS = \ buildTimeConf.cmo \ matitaLog.cmo \ @@ -72,9 +84,10 @@ CCMOS = \ $(NULL) CLEANCMOS = $(CCMOS) MAKECMOS = $(CCMOS) -PROGRAMS_BYTE = matita matitac cicbrowser matitadep matitaclean matitamake -PROGRAMS = $(PROGRAMS_BYTE) matitatop dump_moo +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)) all: matita.conf.xml $(PROGRAMS) coq.moo @@ -119,23 +132,41 @@ CLEANLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -fo MAKELIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MAKEREQUIRES)) MAKELIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MAKEREQUIRES)) opt: $(PROGRAMS_OPT) coq.moo.opt +static: $(PROGRAMS_STATIC) coq.moo.opt + strip *.static else 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) 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_LIBS) -- \ + $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \ + $(STATIC_EXTRA_LIBS) matitac: $(CLIB_DEPS) $(CCMOS) matitac.ml $(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) matitac.ml matitac.opt: $(CLIBX_DEPS) $(CCMXS) matitac.ml $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) matitac.ml +matitac.opt.static: $(CLIBX_DEPS) $(CCMXS) matitac.ml + $(STATIC_LINK) $(STATIC_LIBS) -- \ + $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) matitac.ml \ + $(STATIC_EXTRA_LIBS) matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS) $(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $< @@ -144,21 +175,35 @@ matitadep: matitadep.ml $(DEPLIB_DEPS) $(CCMOS) $(OCAMLC) $(DEPPKGS) -linkpkg -o $@ $(CCMOS) $< matitadep.opt: matitadep.ml $(DEPLIB_DEPS) $(CCMXS) $(OCAMLOPT) $(DEPPKGS) -linkpkg -o $@ $(CCMXS) $< +matitadep.opt.static: matitadep.ml $(DEPLIB_DEPS) $(CCMXS) + $(STATIC_LINK) $(STATIC_LIBS) -- \ + $(OCAMLOPT) $(DEPPKGS) -linkpkg -o $@ $(CCMXS) $< \ + $(STATIC_EXTRA_LIBS) 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_LIBS) -- \ + $(OCAMLOPT) $(CLEANPKGS) -linkpkg -o $@ $(CLEANCMXS) $< \ + $(STATIC_EXTRA_LIBS) matitamake: matitamake.ml $(MAKECMOS) $(OCAMLC) $(PKGS) -linkpkg -o $@ $(MAKECMOS) $< matitamake.opt: matitamake.ml $(MAKECMXS) $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(MAKECMXS) $< +matitamake.opt.static: matitamake.ml $(MAKECMXS) + $(STATIC_LINK) $(STATIC_LIBS) -- \ + $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(MAKECMXS) $< \ + $(STATIC_EXTRA_LIBS) cicbrowser: matita @test -f $@ || ln -s $< $@ cicbrowser.opt: matita.opt @test -f $@ || ln -s $< $@ +cicbrowser.opt.static: matita.opt.static + @test -f $@ || ln -s $< $@ matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade $(LABLGLADECC) -embed $< > matitaGeneratedGui.ml @@ -174,14 +219,11 @@ matitaGeneratedGui.ml matitaGeneratedGui.mli: matita.glade $(OCAMLC) -dtypes $(PKGS) -c $< clean: - rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \ - matita matita.opt matitac matitac.opt \ - cicbrowser cicbrowser.opt \ - matitadep matitadep.opt \ - matitaclean matitaclean.opt \ - matitamake matitamake.opt \ - matitatop matitatop.opt \ - dump_moo + rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \ + $(PROGRAMS) \ + $(PROGRAMS_OPT) \ + $(PROGRAMS_STATIC) \ + $(NULL) distclean: clean rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli rm -f config.log config.status Makefile buildTimeConf.ml diff --git a/helm/matita/configure.ac b/helm/matita/configure.ac index 6f154dded..012b54793 100644 --- a/helm/matita/configure.ac +++ b/helm/matita/configure.ac @@ -62,22 +62,22 @@ do done OCAMLFIND_COMMANDS="" -AC_CHECK_PROG(HAVE_OCAMLC_OPT, ocamlc.opt, yes, no) -if test $HAVE_OCAMLC_OPT = "yes"; then - if test "$OCAMLFIND_COMMANDS" = ""; then - OCAMLFIND_COMMANDS="ocamlc=ocamlc.opt" - else - OCAMLFIND_COMMANDS="$OCAMLFIND_COMMANDS ocamlc=ocamlc.opt" - fi -fi -AC_CHECK_PROG(HAVE_OCAMLOPT_OPT, ocamlopt.opt, yes, no) -if test $HAVE_OCAMLOPT_OPT = "yes"; then - if test "$OCAMLFIND_COMMANDS" = ""; then - OCAMLFIND_COMMANDS="ocamlopt=ocamlopt.opt" - else - OCAMLFIND_COMMANDS="$OCAMLFIND_COMMANDS ocamlopt=ocamlopt.opt" - fi -fi +# AC_CHECK_PROG(HAVE_OCAMLC_OPT, ocamlc.opt, yes, no) +# if test $HAVE_OCAMLC_OPT = "yes"; then +# if test "$OCAMLFIND_COMMANDS" = ""; then +# OCAMLFIND_COMMANDS="ocamlc=ocamlc.opt" +# else +# OCAMLFIND_COMMANDS="$OCAMLFIND_COMMANDS ocamlc=ocamlc.opt" +# fi +# fi +# AC_CHECK_PROG(HAVE_OCAMLOPT_OPT, ocamlopt.opt, yes, no) +# if test $HAVE_OCAMLOPT_OPT = "yes"; then +# if test "$OCAMLFIND_COMMANDS" = ""; then +# OCAMLFIND_COMMANDS="ocamlopt=ocamlopt.opt" +# else +# OCAMLFIND_COMMANDS="$OCAMLFIND_COMMANDS ocamlopt=ocamlopt.opt" +# fi +# fi if test "$OCAMLFIND_COMMANDS" != ""; then OCAMLFIND="OCAMLFIND_COMMANDS='$OCAMLFIND_COMMANDS' $OCAMLFIND" fi