]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/Makefile
Recapitalization of sect_tactics.xml
[helm.git] / matita / Makefile
index 75d8787808c055eedd68185baf1b467ae834e25f..749ed0f71ecf3880a5cb9c11ec96512a650bcd0b 100644 (file)
@@ -80,8 +80,6 @@ all: $(PROGRAMS)
 #  coq.moo.opt: library/legacy/coq.ma matitac.opt
 #          ./matitac.opt $(MATITA_FLAGS) $<
 
-ifeq ($(HAVE_OCAMLOPT),yes)
-
 CMXS = $(patsubst %.cmo,%.cmx,$(CMOS))
 CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS))
 MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS))
@@ -89,16 +87,14 @@ LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d
 LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES))
 CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES))
 CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES))
-.PHONY: opt
-opt: $(PROGRAMS_OPT) coq.moo.opt
-.PHONY: upx
-upx: $(PROGRAMS_UPX) coq.moo.opt
+opt: $(PROGRAMS_OPT)
+upx: $(PROGRAMS_UPX)
+.PHONY: opt upx
 
+ifeq ($(HAVE_OCAMLOPT),yes)
+world: all opt
 else
-
-opt:
-       @echo "Native code compilation is disabled"
-
+world: all
 endif
 
 matita: matita.ml $(LIB_DEPS) $(CMOS)
@@ -159,6 +155,15 @@ clean:
                $(PROGRAMS_UPX) \
                $(NULL)
 
+.PHONY: distclean
+distclean: clean
+       $(MAKE) -C dist/ clean
+       rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli
+       rm -f buildTimeConf.ml
+       rm -f matita.glade.bak matita.gladep.bak
+       rm -f matita.conf.xml.sample
+       rm -rf .matita
+
 TEST_DIRS =                            \
        library                         \
        tests                           \
@@ -184,21 +189,37 @@ cleantests.opt: $(foreach d,$(TEST_DIRS),$(d)-cleantests-opt)
 
 # {{{ Distribution stuff
 
-ifeq ($(wildcard matitac.opt),matitac.opt)
+ifeq ($(HAVE_OCAMLOPT),yes)
 BEST=opt
+BEST_EXT=.opt
 else
 BEST=all
+BEST_EXT=
 endif
 
-stdlib:
-       MATITA_RT_BASE_DIR=`pwd` \
-       MATITA_FLAGS="-system -conffile `pwd`/matita.conf.xml.build" \
-               ./matitamake -init build_stdlib
+ifeq ($(DISTRIBUTED),yes)
+
+dist_library: dist_library@library
+dist_library_clean:
+       @echo "MATITACLEAN -system all"
+       $(H)./matitaclean$(BEST_EXT) \
+               -system -conffile `pwd`/matita.conf.xml.build all
+dist_library@%:
+       @echo "MATITAMAKE -system init"
+       $(H)MATITA_RT_BASE_DIR=`pwd` \
+               MATITA_FLAGS="-system -conffile `pwd`/matita.conf.xml.build" \
+               ./matitamake$(BEST_EXT) -conffile `pwd`/matita.conf.xml.build \
+                       init $* `pwd`/$*
+       @echo "MATITAMAKE -system build"
+       $(H)MATITA_RT_BASE_DIR=`pwd` \
+               MATITA_FLAGS="-system -conffile `pwd`/matita.conf.xml.build" \
+               ./matitamake$(BEST_EXT) -conffile `pwd`/matita.conf.xml.build \
+                       build $*
+       touch $@
 
-#          MATITA_RT_BASE_DIR=`pwd` \
-               $(MAKE) MATITA_FLAGS="-system -conffile `pwd`/matita.conf.xml.build" -C library/ $(BEST)
+endif
 
-DEST = @RT_BASE_DIR@
+DESTDIR = $(RT_BASE_DIR)
 INSTALL_STUFF =                        \
        icons/                          \
        matita.gtkrc                    \
@@ -206,21 +227,35 @@ INSTALL_STUFF =                   \
        matita.ma.templ                 \
        core_notation.moo               \
        matita.conf.xml                 \
+       matita.conf.xml.user            \
        closed.xml                      \
        gtkmathview.matita.conf.xml     \
        template_makefile.in            \
-       library/                        \
-       $(PROGRAMS_BYTE)                \
+       AUTHORS                         \
+       LICENSE                         \
        $(NULL)
 ifeq ($(HAVE_OCAMLOPT),yes)
 INSTALL_STUFF += $(PROGRAMS_OPT)
+else
+INSTALL_STUFF += $(PROGRAMS_BYTE)
 endif
 
 install:
-       install -d $(DEST)
-       cp -a .matita/
-       cp -a $(INSTALL_STUFF) $(DEST)
+       # install main dir and executables
+       install -d $(DESTDIR)
+       cp -a $(INSTALL_STUFF) $(DESTDIR)
+       # install the library and corresponding scripts
+       if [ -d $(DESTDIR)/library ]; then rm -rf $(DESTDIR)/library; fi
+       cp -a .matita/xml/matita/ $(DESTDIR)/library/
+       if [ -d $(DESTDIR)/ma ]; then rm -rf $(DESTDIR)/ma; fi
+       install -d $(DESTDIR)/ma
+ifeq ($(HAVE_OCAMLOPT),yes)
+       for p in $(PROGRAMS_BYTE); do ln -s $$p.opt $(DESTDIR)/$$p; done
+endif
+       cp -a library/ $(DESTDIR)/ma/stdlib/
+       cp -a contribs/ $(DESTDIR)/ma/contribs/
 uninstall:
+       rm -rf $(DESTDIR)
 
 STATIC_LINK = dist/static_link/static_link
 # for matita
@@ -244,7 +279,7 @@ PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT))
 PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC))
 
 ifeq ($(HAVE_OCAMLOPT),yes)
-static: $(STATIC_LINK) $(PROGRAMS_STATIC) coq.moo.opt
+static: $(STATIC_LINK) $(PROGRAMS_STATIC)
 else
 upx:
        @echo "Native code compilation is disabled"
@@ -281,14 +316,6 @@ cicbrowser.opt.static: matita.opt.static
 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 buildTimeConf.ml
-       rm -f matita.glade.bak matita.gladep.bak
-       rm -f matita.conf.xml.sample
-
 %.upx: %
        cp $< $@
        strip $@
@@ -299,7 +326,7 @@ distclean: clean
 tags: TAGS
 .PHONY: TAGS
 TAGS:
-       cd ..; otags -vi -r ocaml/ matita/
+       cd ..; otags -vi -r components/ matita/
 
 #.depend: matitaGeneratedGui.ml matitaGeneratedGui.mli *.ml *.mli