From 3716d925e42ab021bc3d8b996fd91e4f1ed689e8 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sat, 23 Aug 2008 15:33:57 +0200 Subject: [PATCH] Add a Makefile that generates version.inc.php (used to fill the globals structure). Signed-off-by: Florent Bruneau --- .gitignore | 1 + Makefile | 31 +++++++++++++++++++++++++++++++ classes/plglobals.php | 2 +- include/platal.inc.php | 1 + 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 77c9a60..e2c9476 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /wiki /spool .*.sw? +/include/version.inc.php diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6497d26 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +################################################################################ +# definitions + +VERSNUM := $(shell grep VERSION ChangeLog | head -1 | sed -e "s/VERSION //;s/ .*//") +VERSTAG := $(shell grep VERSION ChangeLog | head -1 | grep 'XX' > /dev/null 2> /dev/null && echo 'beta') +VERSION = $(VERSNUM)$(VERSTAG) + +################################################################################ +# global targets + +all: build + +build: include/version.inc.php + +clean: + -rm include/version.inc.php + +q: + @echo -e "Code statistics\n" + @sloccount $(wildcard */) 2> /dev/null | egrep '^[a-z]*:' + +################################################################################ +# targets + +%: %.in Makefile ChangeLog + sed -e 's,@VERSION@,$(VERSION),g' $< > $@ + +include/version.inc.php: Makefile ChangeLog + echo '' > $@ + +.PHONY: build dist clean q diff --git a/classes/plglobals.php b/classes/plglobals.php index 9089e1f..ab50d9f 100644 --- a/classes/plglobals.php +++ b/classes/plglobals.php @@ -47,7 +47,7 @@ define('DEBUG_SMARTY', 4); */ class PlGlobals { - public $coreVersion = '0.9.17'; + public $coreVersion = PLATAL_CORE_VERSION; /** Debug level. * This is a combination of the DEBUG_ flags. As soon as at least diff --git a/include/platal.inc.php b/include/platal.inc.php index 652dc92..3ab3e2b 100644 --- a/include/platal.inc.php +++ b/include/platal.inc.php @@ -21,6 +21,7 @@ $TIME_BEGIN = microtime(true); +require_once dirname(__FILE__) . '/version.inc.php'; require_once dirname(__FILE__) . '/misc.inc.php'; define('PERMS_EXT', 'ext'); -- 2.1.4