importer improvements:
[bse.git] / Makefile
CommitLineData
f22ab4f4 1VERSION=0.24
41b9d8ec
TC
2DISTNAME=bse-$(VERSION)
3DISTBUILD=$(DISTNAME)
4DISTTAR=../$(DISTNAME).tar
5DISTTGZ=$(DISTTAR).gz
68991946 6WEBBASE=/home/tony/www/bse
6271b583 7PERL=$(shell perl -It -MBSE::Test -e 'print BSE::Test::test_perl()')
859833f2 8PERLBIN=$(shell $(PERL) -MConfig -e 'print $$Config{installbin}')
41b9d8ec 9
8bf647a0
TC
10BSEMODULES=site/cgi-bin/modules/BSE/Modules.pm
11
6271b583
TC
12NOOP=echo Nothing
13
473afcfa
TC
14HTMLDEPS=$(shell $(PERL) -lane 'print $$F[0] if $$F[0] =~ /\.(pm|pl|pod)$$/' MANIFEST)
15
ed1ff43e 16MODULES=$(shell grep cgi-bin/.*\.pm MANIFEST | sed -e '/^\#/d' -e 's/[ \t].*//' -e '/^site\/cgi-bin\/modules\/BSE\/\(Modules\|Version\)\.pm/d' )
6271b583
TC
17VERSIONDEPS=$(shell $(PERL) site/util/bse_versiondeps.pl MANIFEST)
18
19POD2TEXT=$(PERLBIN)/pod2text
20POD2HTML=$(PERLBIN)/pod2html
75b07edf 21
859833f2
TC
22.PHONY: help dist cleantree archive distdir clean docs otherdocs dbinfo
23.PHONY: version modversion testinst test testup checkver regen_known_errors
24.PHONY: manicheck filecheck manifect htmldocs
25
41b9d8ec 26help:
8b0b2f34 27 @echo make dist - build the tar.gz file and copy to distribution directory
12bcb7ac 28 @echo make 'archive - build the tar.gz (in the parent directory)'
41b9d8ec 29 @echo make clean - delete generated files
6e73144d
TC
30 @echo make distdir - build distribution directory
31 @echo make docs - build documentation
a47e539f 32 @echo make testup - upgrade an installation
41b9d8ec
TC
33
34# this target needs to be modified so that the output directory includes
35# the release number
957a90ca 36dist: cleantree $(DISTTGZ)
227b99dc
TC
37 cp $(DISTTGZ) $(WEBBASE)/dists/
38 cp site/docs/bse.html $(WEBBASE)/relnotes/bse-$(VERSION).html
39 cp site/docs/*.html $(WEBBASE)/docs
0f35f2b7 40 git tag -m "$(VERSION) release" r$(VERSION)
957a90ca
TC
41
42# make sure everything is committed
43cleantree:
85802bd5
TC
44 if grep -q 'perl.*-d:ptkdb' site/cgi-bin/*.pl site/cgi-bin/admin/*.pl ; \
45 then echo '***' The debugger is still enabled ; \
46 exit 1; \
47 fi
0f35f2b7 48 test -z "`git status -s`" || ( echo "Uncommitted files in the tree"; exit 1 )
41b9d8ec 49
8b0b2f34
TC
50archive: $(DISTTGZ)
51
41b9d8ec
TC
52$(DISTTGZ): distdir
53 if [ -e $(DISTTGZ) ] ; \
54 then echo $(DISTTGZ) already exists ; \
55 exit 1 ; \
56 fi
57 tar cf $(DISTTAR) $(DISTBUILD)
6271b583 58 -$(PERL) -MExtUtils::Command -e rm_rf $(DISTBUILD)
41b9d8ec
TC
59 gzip $(DISTTAR)
60
61# tar czf $(DISTFILE) -C .. bse --exclude '*~' --exclude '*,v' --exclude 'pod2html-*cache'
62
e9c9a2be
TC
63# recent ExtUtils::Manifest don't copy the executable bit, fix that here
64
8bf647a0 65distdir: docs dbinfo version
6271b583
TC
66 -$(PERL) -MExtUtils::Command -e rm_rf $(DISTBUILD)
67 $(PERL) -MExtUtils::Manifest=manicopy,maniread -e "manicopy(maniread(), '$(DISTBUILD)')"
68 $(PERL) site/util/make_versions.pl $(DISTBUILD)/$(BSEMODULES)
6e73144d
TC
69 mkdir $(DISTBUILD)/site/htdocs/shop
70 find $(DISTBUILD) -type f | xargs chmod u+w
e9c9a2be 71 for i in `cat MANIFEST` ; do if [ -x $$i ] ; then chmod a+x $(DISTBUILD)/$$i ; fi ; done
41b9d8ec
TC
72
73clean:
6271b583 74 $(NOOP)
41b9d8ec 75
6e73144d 76docs: INSTALL.txt INSTALL.html otherdocs
41b9d8ec 77
6e73144d 78INSTALL.txt: INSTALL.pod
859833f2
TC
79 $(POD2TEXT) <INSTALL.pod >INSTALL.tmp
80 mv INSTALL.tmp INSTALL.txt
41b9d8ec
TC
81
82INSTALL.html: INSTALL.pod
859833f2
TC
83 $(POD2HTML) --infile=INSTALL.pod --outfile=INSTALL.htmp
84 mv INSTALL.htmp INSTALL.html
0f35f2b7 85 -rm pod2html-dircache pod2html-itemcache pod2htmd.tmp pod2htmi.tmp
41b9d8ec
TC
86
87otherdocs:
6271b583 88 cd site/docs ; make all PERL=$(PERL)
6e73144d 89
b19047a6
TC
90dbinfo: site/util/mysql.str
91
bee8ef2b 92site/util/mysql.str: schema/bse.sql schema/mysql_build.pl
6271b583 93 $(PERL) schema/mysql_build.pl >site/util/mysql.str
b19047a6 94
d2730773
TC
95version: site/cgi-bin/modules/BSE/Version.pm
96
ed1ff43e 97site/cgi-bin/modules/BSE/Version.pm: $(VERSIONDEPS)
6271b583 98 $(PERL) site/util/bse_mkgitversion.pl $(VERSION) site/cgi-bin/modules/BSE/Version.pm
7057fbc0 99
8bf647a0 100modversion: $(BSEMODULES)
75b07edf 101
8bf647a0 102$(BSEMODULES): $(MODULES) site/util/make_versions.pl
6271b583 103 $(PERL) site/util/make_versions.pl $(BSEMODULES)
75b07edf 104
6e73144d
TC
105# this is very rough
106testinst: distdir
6271b583
TC
107 $(PERL) localinst.perl $(DISTBUILD)
108 $(PERL) -MExtUtils::Command -e rm_rf $(DISTBUILD)
109 cd `$(PERL) -lne 'do { print $$1; exit; } if /^base_dir\s*=\s*(.*)/' test.cfg`/util ; $(PERL) loaddata.pl ../data/db
34bc5961 110
cb7fd78d 111testup: checkver distdir
6271b583
TC
112 $(PERL) localinst.perl $(DISTBUILD) leavedb
113 $(PERL) -MExtUtils::Command -e rm_rf $(DISTBUILD)
114 cd `$(PERL) -lne 'do { print $$1; exit; } if /^base_dir\s*=\s*(.*)/' test.cfg`/util ; $(PERL) upgrade_mysql.pl -b ; $(PERL) loaddata.pl ../data/db
09a131dd 115
cb7fd78d 116checkver:
0f35f2b7 117 if [ -d .git ] ; then perl site/util/check_versions.pl ; fi
cb7fd78d 118
58f0ca94 119TEST_FILES=t/*.t t/*/*.t
e4a9e7c6 120TEST_VERBOSE=0
87b53bfa
TC
121
122test: testup
6271b583 123 $(PERL) '-MTest::Harness=runtests,$$verbose' -Isite/cgi-bin/modules -It -e '$$verbose=$(TEST_VERBOSE); runtests @ARGV' $(TEST_FILES)
35c0719f 124
983772f8 125regen_known_errors:
71bafa2a 126 $(PERL) t/900-kwalitee/040-podcheck.t -r
983772f8 127
35c0719f 128manicheck:
6271b583 129 $(PERL) -MExtUtils::Manifest=manicheck -e 'manicheck()'
35c0719f
TC
130
131filecheck:
6271b583 132 $(PERL) -MExtUtils::Manifest=filecheck -e 'filecheck()'
91238c38
TC
133
134manifest:
6271b583 135 $(PERL) -MExtUtils::Manifest=mkmanifest -e mkmanifest
473afcfa
TC
136
137htmldocs: $(HTMLDEPS)
138 if [ -z "$(HTMLDOCDIR)" ] ; then \
139 echo Supply HTMLDOCDIR ; exit 1 ; \
140 fi
141 [ -d "$(HTMLDOCDIR)" ] || mkdir -p "$(HTMLDOCDIR)"
142 $(PERL) makehtmldocs.pl "$(HTMLDOCDIR)"