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
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))
# 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)
# 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) \
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}:
@@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}
@@$(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})
@@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
$(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:
${SEQUENCE_SRC}:
@@echo "Setting-up submodules..."
@@git submodule init
-