diff --git a/Makefile b/Makefile index 1b0d29f8..29dfb06d 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ #!/usr/bin/make -f -# +# package=davical version=$(shell cat VERSION) @@ -17,24 +17,24 @@ built-po: built-docs inc/always.php scripts/po/rebuild-translations.sh scripts/p # # Insert the current version number into always.php # -inc/always.php: VERSION inc/always.php.in - sed -e "/^ *.c->version_string *= *'[^']*' *;/ s/^ *.c->version_string *= *'[^']*' *;/\$$c->version_string = '`head -n1 VERSION`';/" inc/always.php +inc/always.php: scripts/build-always.sh VERSION dba/davical.sql inc/always.php.in + scripts/build-always.sh inc/always.php # # Build a release .tar.gz file in the directory above us # -release: built-docs +release: built-docs VERSION -ln -s . $(package)-$(version) tar czf ../$(package)-$(version).tar.gz \ --no-recursion --dereference $(package)-$(version) \ $(shell git ls-files |grep -v '.git'|sed -e s:^:$(package)-$(version)/:) \ $(shell find $(package)-$(version)/docs/api/ ! -name "phpdoc.ini" ) rm $(package)-$(version) - + clean: rm -f built-docs built-po -find . -name "*~" -delete - + clean-all: clean -find docs/api/* ! -name "phpdoc.ini" ! -name ".gitignore" -delete diff --git a/scripts/build-always.sh b/scripts/build-always.sh new file mode 100755 index 00000000..2215515e --- /dev/null +++ b/scripts/build-always.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Apply the current version numbers into always.php from always.php.in +# + +DAVICAL_VERSION="`head -n1 VERSION`" +DB_VERSION="`grep 'SELECT new_db_revision' dba/davical.sql | cut -f2 -d'(' | cut -f1-3 -d,`" + +sed -e "/^ *.c->version_string *= *'[^']*' *;/ s/^ *.c->version_string *= *'[^']*' *;/\$c->version_string = '${DAVICAL_VERSION}';/" \ + -e "/^ *.c->want_dbversion *=.*$/ s/^ *.c->want_dbversion *=.*$/\$c->want_dbversion = array(${DB_VERSION});/"