Add the LICENSE.txt file
[armadillo.git] / Makefile
index caf3e9cdea34070738b3a14456b18f18cc54a463..613d109356638e3ea8cd31c80df5e7aeb6d87675 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,9 +6,9 @@
 # Foundation, either version 3 of the License, or any later version.
 
 VERSION_MAJOR=0
-VERSION_MINOR=8
+VERSION_MINOR=9
 VERSION_NAMESPACE=armadillo.Version
-VERSION_FILE=frontend/version.js.proto2
+VERSION_FILE=frontend/version.js.proto
 VERSION_SOURCE=$(basename $(VERSION_FILE))
 
 FRONTEND_SOURCES=frontend/jquery-1.7.1.js \
@@ -21,42 +21,59 @@ FRONTEND_SOURCES=frontend/jquery-1.7.1.js \
        frontend/main.js
 FRONTEND_BIN=frontend/armadillo.js
 
-all: backend dev
+# Default target, used to produce the backend and uncompiled frontend.
+all: backend version frontend ignore_fe_bin
 
+# Creates the compiled frontend code.
+release: backend version compiled ignore_fe_bin
+
+# Performs a release build and stamps the actual version file.
+dist: backend version copy_version_src compiled stamp ignore_fe_bin
+
+# Compiles the backend server.
 backend:
        go build -v .
 
+# Compiles the frontend code for development.
 frontend: $(FRONTEND_BIN)
 
 $(FRONTEND_BIN): $(FRONTEND_SOURCES)
        echo $(foreach f,$^,"document.write('<script src="fe/$(notdir $f)"></script>');\n") > $(FRONTEND_BIN)
 
-dev: version frontend
-
+# Compiles the frontend code for release.
 compiled: SOURCES_FLAGS=$(foreach f,$(FRONTEND_SOURCES),--js=$f)
-compiled: version
+compiled:
        java -jar closure-compiler.jar \
                $(SOURCES_FLAGS) \
                --js_output_file=$(FRONTEND_BIN) \
                --compilation_level=SIMPLE_OPTIMIZATIONS
 
-stamp:
-       gitcrement next
+.PHONY: $(VERSION_FILE)
 
-version: STAMP=$(shell date +%s)
-version: BUILD=$(shell gitcrement current)
+# Builds the version file template.
 version:
+       if [[ -f $(VERSION_FILE) ]]; then $(MAKE) $(VERSION_FILE); fi
+$(VERSION_FILE):
+       which gitcrement
        @echo "// This file is automatically generated." > $(VERSION_FILE)
        @echo >> $(VERSION_FILE)
        @echo "$$.namespace('$(VERSION_NAMESPACE)');" >> $(VERSION_FILE)
        @echo >> $(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)
+       echo "$(VERSION_NAMESPACE).BUILD = $(shell gitcrement next);" >> $(VERSION_FILE)
+       echo "$(VERSION_NAMESPACE).STAMP = $(shell date +%s);" >> $(VERSION_FILE)
 
-stamp_version: stamp version
+# Copies the version template to the source.
+copy_version_src:
        cp $(VERSION_FILE) $(VERSION_SOURCE)
-       git commit $(VERSION_SOURCE) \
+
+# Commits the version source and the frontend bin.
+stamp:
+       git commit $(VERSION_SOURCE) $(FRONTEND_BIN) \
                --author='Armadillo Build Script <armadillo@bluestatic.org>' \
                -m 'Stamp version.js @ $(shell gitcrement current)'
+
+# Marks the frontend binary as unmodified.
+ignore_fe_bin: $(FRONTEND_BIN)
+       git update-index --assume-unchanged $(FRONTEND_BIN)