]> git.imager.perl.org - bse.git/blobdiff - Makefile
fix default [nightly work]
[bse.git] / Makefile
index 2ea5d13ef616a65d0e04656e1508a99b8147810a..22d1f27af0dc5764d0aca4d0158f8bf81a304f16 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,30 @@
-VERSION=0.15_55
+VERSION=0.25
 DISTNAME=bse-$(VERSION)
 DISTBUILD=$(DISTNAME)
 DISTTAR=../$(DISTNAME).tar
 DISTTGZ=$(DISTTAR).gz
-WEBBASE=/home/httpd/html/bse
+WEBBASE=/home/tony/www/bse
+PERL=$(shell perl -It -MBSE::Test -e 'print BSE::Test::test_perl()')
+PERLBIN=$(shell $(PERL) -MConfig -e 'print $$Config{installbin}')
+
+BSEMODULES=site/cgi-bin/modules/BSE/Modules.pm
+
+NOOP=echo Nothing
+
+HTMLDEPS=$(shell $(PERL) -lane 'print $$F[0] if $$F[0] =~ /\.(pm|pl|pod)$$/' MANIFEST)
+
+MODULES=$(shell grep cgi-bin/.*\.pm MANIFEST | sed -e '/^\#/d' -e 's/[ \t].*//' -e '/^site\/cgi-bin\/modules\/BSE\/\(Modules\|Version\)\.pm/d' )
+VERSIONDEPS=$(shell $(PERL) site/util/bse_versiondeps.pl MANIFEST)
+
+POD2TEXT=$(PERLBIN)/pod2text
+POD2HTML=$(PERLBIN)/pod2html
+
+UTILDIR=$(shell $(PERL) -Ilib -MBSE::Install=util_dir -e 'print util_dir')
+DATADIR=$(shell $(PERL) -Ilib -MBSE::Install=data_dir -e 'print data_dir')
+
+.PHONY: help dist cleantree archive distdir clean docs otherdocs dbinfo
+.PHONY: version modversion testinst test testup checkver regen_known_errors
+.PHONY: manicheck filecheck manifect htmldocs
 
 help:
        @echo make dist - build the tar.gz file and copy to distribution directory
@@ -11,6 +32,7 @@ help:
        @echo make clean - delete generated files
        @echo make distdir - build distribution directory
        @echo make docs - build documentation
+       @echo make testup - upgrade an installation
 
 # this target needs to be modified so that the output directory includes
 # the release number
@@ -18,7 +40,7 @@ dist: cleantree $(DISTTGZ)
        cp $(DISTTGZ) $(WEBBASE)/dists/
        cp site/docs/bse.html $(WEBBASE)/relnotes/bse-$(VERSION).html
        cp site/docs/*.html $(WEBBASE)/docs
-       cvs tag r`echo $(VERSION) | tr . _`
+       git tag -m "$(VERSION) release" r$(VERSION)
 
 # make sure everything is committed
 cleantree:
@@ -26,10 +48,7 @@ cleantree:
          then echo '***' The debugger is still enabled ; \
          exit 1; \
        fi
-       if cvs status 2>/dev/null | grep -q '^\?\|Locally Modified' ; \
-          then echo '***' The tree has modified or unadded files ; \
-          exit 1 ; \
-        fi
+       test -z "`git status -s`" || ( echo "Uncommitted files in the tree"; exit 1 )
 
 archive: $(DISTTGZ)
 
@@ -39,7 +58,7 @@ $(DISTTGZ): distdir
               exit 1 ; \
        fi
        tar cf $(DISTTAR) $(DISTBUILD)
-       -perl -MExtUtils::Command -e rm_rf $(DISTBUILD)
+       -$(PERL) -MExtUtils::Command -e rm_rf $(DISTBUILD)
        gzip $(DISTTAR)
 
 #      tar czf $(DISTFILE) -C .. bse --exclude '*~' --exclude '*,v' --exclude 'pod2html-*cache'
@@ -47,68 +66,91 @@ $(DISTTGZ): distdir
 # recent ExtUtils::Manifest don't copy the executable bit, fix that here
 
 distdir: docs dbinfo version
-       -perl -MExtUtils::Command -e rm_rf $(DISTBUILD)
-       perl -MExtUtils::Manifest=manicopy,maniread -e "manicopy(maniread(), '$(DISTBUILD)')"
+       -$(PERL) -MExtUtils::Command -e rm_rf $(DISTBUILD)
+       $(PERL) -MExtUtils::Manifest=manicopy,maniread -e "manicopy(maniread(), '$(DISTBUILD)')"
+       $(PERL) site/util/make_versions.pl $(DISTBUILD)/$(BSEMODULES)
        mkdir $(DISTBUILD)/site/htdocs/shop
        find $(DISTBUILD) -type f | xargs chmod u+w
-       for i in `cat MANIFEST` ; do if [ -x $$i ] ; then chmod a+x $(DISTBUILD)/$$i ; fi ; done
+       for i in `cat MANIFEST | sed -e 's/\s.*//'` ; do if [ -x $$i ] ; then chmod a+x $(DISTBUILD)/$$i ; fi ; done
 
 clean:
-       -perl -MExtUtils::Command -e rm_f site/htdocs/index.html site/htdocs/shop/*.html site/htdocs/a/*.html
-       -cd site/htdocs/images ; \
-       for i in *.gif ; do \
-         if [ $$i != trans_pixel.gif ] ; then \
-           rm $$i ; \
-         fi ; \
-       done
-       -perl -MExtUtils::Command -e rm_f site/htdocs/images/*.jpg
-       -perl -MExtUtils::Command -e rm_rf $(DISTBUILD)
+       $(NOOP)
 
 docs: INSTALL.txt INSTALL.html otherdocs
 
 INSTALL.txt: INSTALL.pod
-       pod2text <INSTALL.pod >INSTALL.txt
+       $(POD2TEXT) <INSTALL.pod >INSTALL.tmp
+       mv INSTALL.tmp INSTALL.txt
 
 INSTALL.html: INSTALL.pod
-       pod2html --infile=INSTALL.pod --outfile=INSTALL.html
-       -rm pod2html-dircache pod2html-itemcache
+       $(POD2HTML) --infile=INSTALL.pod --outfile=INSTALL.htmp
+       mv INSTALL.htmp INSTALL.html
+       -rm pod2html-dircache pod2html-itemcache pod2htmd.tmp pod2htmi.tmp
 
 otherdocs:
-       cd site/docs ; make all
+       cd site/docs ; make all PERL=$(PERL)
 
 dbinfo: site/util/mysql.str
 
-site/util/mysql.str: schema/bse.sql
-       perl schema/mysql_build.pl >site/util/mysql.str
+site/util/mysql.str: schema/bse.sql schema/mysql_build.pl
+       $(PERL) schema/mysql_build.pl >site/util/mysql.str
 
 version: site/cgi-bin/modules/BSE/Version.pm
 
-site/cgi-bin/modules/BSE/Version.pm: Makefile
-       echo 'package BSE::Version;' >site/cgi-bin/modules/BSE/Version.pm
-       echo 'use strict;' >>site/cgi-bin/modules/BSE/Version.pm
-       echo  >>site/cgi-bin/modules/BSE/Version.pm
-       echo 'my $$VERSION = "$(VERSION)";' >>site/cgi-bin/modules/BSE/Version.pm
-       echo  >>site/cgi-bin/modules/BSE/Version.pm
-       echo 'sub version { $$VERSION }' >>site/cgi-bin/modules/BSE/Version.pm
-       echo  >>site/cgi-bin/modules/BSE/Version.pm
-       echo '1;' >>site/cgi-bin/modules/BSE/Version.pm
+site/cgi-bin/modules/BSE/Version.pm: $(VERSIONDEPS)
+       $(PERL) site/util/bse_mkgitversion.pl $(VERSION) site/cgi-bin/modules/BSE/Version.pm
+
+modversion: $(BSEMODULES)
+
+$(BSEMODULES): $(MODULES) site/util/make_versions.pl
+       $(PERL) site/util/make_versions.pl $(BSEMODULES)
 
 # this is very rough
 testinst: distdir
-       perl localinst.perl $(DISTBUILD)
-       perl -MExtUtils::Command -e rm_rf $(DISTBUILD)
-       cd `perl -lne 'do { print $$1; exit; } if /^base_dir\s*=\s*(.*)/' test.cfg`/util ; perl loaddata.pl ../data/db
+       $(PERL) localinst.perl $(DISTBUILD)
+       $(PERL) -MExtUtils::Command -e rm_rf $(DISTBUILD)
+       cd $(UTILDIR) ; $(PERL) loaddata.pl $(DATADIR)/db
 
-testfiles: distdir
-       perl localinst.perl $(DISTBUILD) leavedb
-       perl -MExtUtils::Command -e rm_rf $(DISTBUILD)
-       cd `perl -lne 'do { print $$1; exit; } if /^base_dir\s*=\s*(.*)/' test.cfg`/util ; perl loaddata.pl ../data/db
+testupx: checkver distdir
+       $(PERL) localinst.perl $(DISTBUILD) leavedb
+       $(PERL) -MExtUtils::Command -e rm_rf $(DISTBUILD)
+       cd $(UTILDIR) ; $(PERL) upgrade_mysql.pl -b ; $(PERL) loaddata.pl $(DATADIR)/db
 
-test: testinst
-       perl -MTest::Harness=runtests -Isite/cgi-bin/modules -It -e 'runtests glob q!t/*.t!'
+testload :
+       $(PERL) '-MTest::Harness=runtests,$$verbose' -Isite/cgi-bin/modules -It -e '$$verbose=$(TEST_VERBOSE); runtests @ARGV' t/t000load.t
+
+testup : testload checkver distdir
+       $(PERL) localinst.perl $(DISTBUILD) leavedb
+       $(PERL) -MExtUtils::Command -e rm_rf $(DISTBUILD)
+       cd $(UTILDIR) ; $(PERL) upgrade_mysql.pl -b ; $(PERL) loaddata.pl $(DATADIR)/db
+
+checkver:
+       if [ -d .git ] ; then perl site/util/check_versions.pl ; fi
+
+TEST_FILES=t/*.t t/*/*.t
+TEST_VERBOSE=0
+
+test: testupx
+       $(PERL) '-MTest::Harness=runtests,$$verbose' -Isite/cgi-bin/modules -It -e '$$verbose=$(TEST_VERBOSE); runtests @ARGV' $(TEST_FILES)
+
+test_load: testup
+       $(PERL) '-MTest::Harness=runtests,$$verbose' -Isite/cgi-bin/modules -It -e '$$verbose=$(TEST_VERBOSE); runtests @ARGV' t/t000load.t
+
+regen_known_errors:
+       $(PERL) t/900-kwalitee/040-podcheck.t -r
 
 manicheck:
-       perl -MExtUtils::Manifest=manicheck -e 'manicheck()'
+       $(PERL) -MExtUtils::Manifest=manicheck -e 'manicheck()'
 
 filecheck:
-       perl -MExtUtils::Manifest=filecheck -e 'filecheck()'
+       $(PERL) -MExtUtils::Manifest=filecheck -e 'filecheck()'
+
+manifest:
+       $(PERL) -MExtUtils::Manifest=mkmanifest -e mkmanifest
+
+htmldocs: $(HTMLDEPS)
+       if [ -z "$(HTMLDOCDIR)" ] ; then \
+         echo Supply HTMLDOCDIR ; exit 1 ; \
+       fi
+       [ -d "$(HTMLDOCDIR)" ] || mkdir -p "$(HTMLDOCDIR)"
+       $(PERL) makehtmldocs.pl "$(HTMLDOCDIR)"