Add support for stamping the version file and committing it.
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 12 Aug 2012 16:44:23 +0000 (12:44 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 12 Aug 2012 16:44:23 +0000 (12:44 -0400)
Makefile

index 10bb605216ed73c24b047caa098ad047bc6028a7..caf3e9cdea34070738b3a14456b18f18cc54a463 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,9 +5,15 @@
 # the terms of the GNU General Public License as published by the Free Software
 # Foundation, either version 3 of the License, or any later version.
 
+VERSION_MAJOR=0
+VERSION_MINOR=8
+VERSION_NAMESPACE=armadillo.Version
+VERSION_FILE=frontend/version.js.proto2
+VERSION_SOURCE=$(basename $(VERSION_FILE))
+
 FRONTEND_SOURCES=frontend/jquery-1.7.1.js \
        frontend/utils.js \
-       frontend/version.js \
+       $(VERSION_SOURCE) \
        frontend/tv_renamer.js \
        frontend/path_control.js \
        frontend/actor.js \
@@ -15,9 +21,7 @@ FRONTEND_SOURCES=frontend/jquery-1.7.1.js \
        frontend/main.js
 FRONTEND_BIN=frontend/armadillo.js
 
-VERSION_MAJOR=0
-VERSION_MINOR=8
-VERSION_FILE=frontend/version.js.proto2
+all: backend dev
 
 backend:
        go build -v .
@@ -44,9 +48,15 @@ version: BUILD=$(shell gitcrement current)
 version:
        @echo "// This file is automatically generated." > $(VERSION_FILE)
        @echo >> $(VERSION_FILE)
-       @echo "$.namespace('armadillo.Version');" >> $(VERSION_FILE)
+       @echo "$$.namespace('$(VERSION_NAMESPACE)');" >> $(VERSION_FILE)
        @echo >> $(VERSION_FILE)
-       echo "armadillo.Version.MAJOR = $(VERSION_MAJOR);" >> $(VERSION_FILE)
-       echo "armadillo.Version.MINOR = $(VERSION_MINOR);" >> $(VERSION_FILE)
-       echo "armadillo.Version.BUILD = $(BUILD);" >> $(VERSION_FILE)
-       echo "armadillo.Version.STAMP = $(STAMP);" >> $(VERSION_FILE)
+       echo "$(VERSION_NAMESPACE).MAJOR = $(VERSION_MAJOR);" >> $(VERSION_FILE)
+       echo "$(VERSION_NAMESPACE).MINOR = $(VERSION_MINOR);" >> $(VERSION_FILE)
+       echo "$(VERSION_NAMESPACE).BUILD = $(BUILD);" >> $(VERSION_FILE)
+       echo "$(VERSION_NAMESPACE).STAMP = $(STAMP);" >> $(VERSION_FILE)
+
+stamp_version: stamp version
+       cp $(VERSION_FILE) $(VERSION_SOURCE)
+       git commit $(VERSION_SOURCE) \
+               --author='Armadillo Build Script <armadillo@bluestatic.org>' \
+               -m 'Stamp version.js @ $(shell gitcrement current)'