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