Add a Makefile that generates version.inc.php (used to fill the globals structure).
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 23 Aug 2008 13:33:57 +0000 (15:33 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 23 Aug 2008 13:33:57 +0000 (15:33 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
.gitignore
Makefile [new file with mode: 0644]
classes/plglobals.php
include/platal.inc.php

index 77c9a60..e2c9476 100644 (file)
@@ -1,3 +1,4 @@
 /wiki
 /spool
 .*.sw?
+/include/version.inc.php
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
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 '<?php define("PLATAL_CORE_VERSION", "${VERSION}"); ?>' > $@
+
+.PHONY: build dist clean q
index 9089e1f..ab50d9f 100644 (file)
@@ -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
index 652dc92..3ab3e2b 100644 (file)
@@ -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');