]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Add effets/ to all necessary targets, create new effects targets, fix VERSION to...
authorDavid Humphrey <david.humphrey@senecac.on.ca>
Thu, 23 Jun 2011 21:35:41 +0000 (17:35 -0400)
committerDavid Humphrey <david.humphrey@senecac.on.ca>
Thu, 23 Jun 2011 21:35:41 +0000 (17:35 -0400)
Makefile

index fcaa32dfaab88f857ce085bc4bee1d455416444b..a07261ecfda0bd3600a6ea491c63dbab614da382 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,9 +5,10 @@ DIST_DIR = ${PREFIX}/dist
 PLUGINS_DIR = ${PREFIX}/plugins
 PARSERS_DIR = ${PREFIX}/parsers
 PLAYERS_DIR = ${PREFIX}/players
+EFFECTS_DIR = $(PREFIX)/effects
 
-#Version
-VERSION ?= $(error Specify a version for your release (e.g., VERSION=0.5))
+# Version number used in naming release files. Defaults to git commit sha.
+VERSION ?= $(shell git show -s --pretty=format:%h)
 
 RHINO ?= java -jar ${BUILD_DIR}/js.jar
 
@@ -38,6 +39,10 @@ PARSERS_MIN = ${DIST_DIR}/popcorn.parsers.min.js
 PLAYERS_DIST = ${DIST_DIR}/popcorn.players.js
 PLAYERS_MIN = ${DIST_DIR}/popcorn.players.min.js
 
+# effects
+EFFECTS_DIST = $(DIST_DIR)/popcorn.effects.js
+EFFECTS_MIN = $(DIST_DIR)/popcorn.effects.min.js
+
 # Grab all popcorn.<plugin-name>.js files from plugins dir
 PLUGINS_SRC := $(filter-out %unit.js, $(shell find ${PLUGINS_DIR} -name 'popcorn.*.js' -print))
 
@@ -47,6 +52,9 @@ PARSERS_SRC := $(filter-out %unit.js, $(shell find ${PARSERS_DIR} -name 'popcorn
 # Grab all popcorn.<player-name>.js files from players dir
 PLAYERS_SRC := $(filter-out %unit.js, $(shell find ${PLAYERS_DIR} -name 'popcorn.*.js' -print))
 
+# Grab all popcorn.<effect-name>.js files from players dir
+EFFECTS_SRC := $(filter-out %unit.js, $(shell find $(EFFECTS_DIR) -name 'popcorn.*.js' -print))
+
 # Grab all popcorn.<player-name>.unit.js files from plugins dir
 PLUGINS_UNIT := $(shell find ${PLUGINS_DIR} -name 'popcorn.*.unit.js' -print)
 
@@ -56,6 +64,9 @@ PARSERS_UNIT := $(shell find ${PARSERS_DIR} -name 'popcorn.*.unit.js' -print)
 # Grab all popcorn.<player-name>.unit.js files from players dir
 PLAYERS_UNIT := $(shell find ${PLAYERS_DIR} -name 'popcorn.*.unit.js' -print)
 
+# Grab all popcorn.<effects>.unit.js files from players dir
+EFFECTS_UNIT := $(shell find $(EFFECTS_DIR) -name 'popcorn.*.unit.js' -print)
+
 # popcorn + plugins
 POPCORN_COMPLETE_LIST := --js ${POPCORN_SRC} \
                          $(shell for js in ${PLUGINS_SRC} ; do echo --js $$js ; done) \
@@ -68,7 +79,10 @@ POPCORN_COMPLETE_MIN = ${DIST_DIR}/popcorn-complete.min.js
 add_license = cat ${PREFIX}/LICENSE_HEADER | sed -e 's/@VERSION/${VERSION}/' > $(2) ; \
                            cat $(1) >> $(2)
 
-all: setup lint lint-plugins lint-parsers lint-players popcorn plugins parsers players complete min
+# Run the file through jslint
+run_lint = @@$(RHINO) build/jslint-check.js $(1)
+
+all: setup lint lint-plugins lint-parsers lint-players lint-effects popcorn plugins parsers players effects complete min
        @@echo "Popcorn build complete."
 
 ${DIST_DIR}:
@@ -80,7 +94,7 @@ ${POPCORN_DIST}: ${POPCORN_SRC} | ${DIST_DIR}
        @@echo "Building" ${POPCORN_DIST}
        @@$(call add_license, $(POPCORN_SRC), $(POPCORN_DIST))
 
-min: ${POPCORN_MIN} ${PLUGINS_MIN} ${PARSERS_MIN} ${PLAYERS_MIN} ${POPCORN_COMPLETE_MIN}
+min: ${POPCORN_MIN} ${PLUGINS_MIN} ${PARSERS_MIN} ${PLAYERS_MIN} $(EFFECTS_MIN) ${POPCORN_COMPLETE_MIN}
 
 ${POPCORN_MIN}: ${POPCORN_DIST}
        @@echo "Building" ${POPCORN_MIN}
@@ -88,7 +102,7 @@ ${POPCORN_MIN}: ${POPCORN_DIST}
        @@$(call add_license, ${POPCORN_MIN}.tmp, ${POPCORN_MIN})
        @@rm ${POPCORN_MIN}.tmp
 
-${POPCORN_COMPLETE_MIN}: update ${POPCORN_SRC} ${PLUGINS_SRC} ${PARSERS_SRC} ${DIST_DIR}
+${POPCORN_COMPLETE_MIN}: update ${POPCORN_SRC} ${PLUGINS_SRC} ${PARSERS_SRC} $(EFFECTS_SRC) ${DIST_DIR}
        @@echo "Building" ${POPCORN_COMPLETE_MIN}
        @@$(call compile, ${POPCORN_COMPLETE_LIST}, ${POPCORN_COMPLETE_MIN}.tmp)
        @@$(call add_license, ${POPCORN_COMPLETE_MIN}.tmp, ${POPCORN_COMPLETE_MIN})
@@ -124,41 +138,59 @@ ${PLAYERS_DIST}: ${PLAYERS_SRC} ${DIST_DIR}
        @@echo "Building ${PLAYERS_DIST}"
        @@cat ${PLAYERS_SRC} > ${PLAYERS_DIST}
 
-complete: update ${POPCORN_SRC} ${PARSERS_SRC} ${PLUGINS_SRC} ${PLAYERS_SRC} ${DIST_DIR}
-       @@echo "Building popcorn + plugins + parsers + players..."
-       @@cat ${POPCORN_SRC} ${PLUGINS_SRC} ${PARSERS_SRC} ${PLAYERS_SRC} > ${POPCORN_COMPLETE_DIST}.tmp
+effects: $(EFFECTS_DIST)
+
+$(EFFECTS_MIN): $(EFFECTS_DIST)
+       @@echo "Building" $(EFFECTS_MIN)
+       @@$(call compile, $(shell for js in $(EFFECTS_SRC) ; do echo --js $$js ; done), $(EFFECTS_MIN))
+
+$(EFFECTS_DIST): $(EFFECTS_SRC) $(DIST_DIR)
+       @@echo "Building $(EFFECTS_DIST)"
+       @@cat $(EFFECTS_SRC) > $(EFFECTS_DIST)
+
+complete: update ${POPCORN_SRC} ${PARSERS_SRC} ${PLUGINS_SRC} ${PLAYERS_SRC} $(EFFECTS_SRC) ${DIST_DIR}
+       @@echo "Building popcorn + plugins + parsers + players + effects..."
+       @@cat ${POPCORN_SRC} ${PLUGINS_SRC} ${PARSERS_SRC} ${PLAYERS_SRC} $(EFFECTS_SRC) > ${POPCORN_COMPLETE_DIST}.tmp
        @@$(call add_license, ${POPCORN_COMPLETE_DIST}.tmp, ${POPCORN_COMPLETE_DIST})
        @@rm ${POPCORN_COMPLETE_DIST}.tmp
 
 lint:
        @@echo "Checking Popcorn against JSLint..."
-       @@${RHINO} build/jslint-check.js popcorn.js
+       @@$(call run_lint,popcorn.js)
 
 lint-plugins:
        @@echo "Checking all plugins against JSLint..."
-       @@${RHINO} build/jslint-check.js ${PLUGINS_SRC}
+       @@$(call run_lint,$(PLUGINS_SRC))
 
 lint-parsers:
        @@echo "Checking all parsers against JSLint..."
-       @@${RHINO} build/jslint-check.js ${PARSERS_SRC}
+       @@$(call run_lint,$(PARSERS_SRC))
 
 lint-players:
        @@echo "Checking all players against JSLint..."
-       @@${RHINO} build/jslint-check.js ${PLAYERS_SRC}
+       @@$(call run_lint,$(PLAYERS_SRC))
+
+lint-effects:
+       @@echo "Checking all effects against JSLint..."
+       @@$(call run_lint,$(EFFECTS_SRC))
 
 lint-plugin-tests:
        @@echo "Checking plugin unit tests against JSLint..."
-       @@${RHINO} build/jslint-check.js ${PLUGINS_UNIT}
-       
+       @@$(call run_lint,$(PLUGINS_UNIT))
+
 lint-parser-tests:
        @@echo "Checking parser unit tests against JSLint..."
-       @@${RHINO} build/jslint-check.js ${PARSERS_UNIT}
-       
+       @@$(call run_lint,$(PARSERS_UNIT))
+
+lint-effects-tests:
+       @@echo "Checking effectsr unit tests against JSLint..."
+       @@$(call run_lint,$(EFFECTS_UNIT))
+
 lint-player-tests:
        @@echo "Checking player unit tests against JSLint..."
-       @@${RHINO} build/jslint-check.js ${PLAYERS_UNIT}
-       
-lint-unit-tests: lint-plugin-tests lint-parser-tests lint-player-tests
+       @@$(call run_lint,$(PLAYERS_UNIT))
+
+lint-unit-tests: lint-plugin-tests lint-parser-tests lint-player-tests lint-effects-tests
        @@echo "completed"
 
 # Create a mirror copy of the tree in dist/ using popcorn-complete.js
@@ -181,6 +213,7 @@ testing: complete
        $(call overwrite_js, ${TESTING_MIRROR}/plugins)
        $(call overwrite_js, ${TESTING_MIRROR}/players)
        $(call overwrite_js, ${TESTING_MIRROR}/parsers)
+       $(call overwrite_js, ${TESTING_MIRROR}/effects)
        @@cp ${POPCORN_COMPLETE_DIST} ${TESTING_MIRROR}/popcorn.js
 
 clean:
@@ -200,4 +233,3 @@ update:
 ${SEQUENCE_SRC}:
        @@echo "Setting-up submodules..."
        @@git submodule init
-