PARSERS_DIR = ${PREFIX}/parsers
PLAYERS_DIR = ${PREFIX}/players
EFFECTS_DIR = $(PREFIX)/effects
+MODULES_DIR = $(PREFIX)/modules
# Version number used in naming release files. Defaults to git commit sha.
VERSION ?= $(shell git show -s --pretty=format:%h)
POPCORN_DIST = ${DIST_DIR}/popcorn.js
POPCORN_MIN = ${DIST_DIR}/popcorn.min.js
+# modules
+MODULES_DIST = ${DIST_DIR}/popcorn.modules.js
+MODULES_MIN = ${DIST_DIR}/popcorn.modules.min.js
+
# plugins
PLUGINS_DIST = ${DIST_DIR}/popcorn.plugins.js
PLUGINS_MIN = ${DIST_DIR}/popcorn.plugins.min.js
# 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
+# Grab all popcorn.<effect-name>.js files from effects 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
+# Grab all popcorn.<Module-name>.js files from modules dir
+MODULES_SRC := $(filter-out %unit.js, $(shell find $(MODULES_DIR) -name 'popcorn.*.js' -print))
+
+# Grab all popcorn.<plugin-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 parsers dir
+# Grab all popcorn.<parser-name>.unit.js files from parsers dir
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
+# Grab all popcorn.<effects>.unit.js files from effects dir
EFFECTS_UNIT := $(shell find $(EFFECTS_DIR) -name 'popcorn.*.unit.js' -print)
+# Grab all popcorn.<module-name>.unit.js files from modules dir
+MODULES_UNIT := $(shell find $(MODULES_DIR) -name 'popcorn.*.unit.js' -print)
+
# popcorn + plugins
POPCORN_COMPLETE_LIST := --js ${POPCORN_SRC} \
+ $(shell for js in ${MODULES_SRC} ; do echo --js $$js ; done) \
$(shell for js in ${PLUGINS_SRC} ; do echo --js $$js ; done) \
$(shell for js in ${PARSERS_SRC} ; do echo --js $$js ; done) \
$(shell for js in ${PLAYERS_SRC} ; do echo --js $$js ; done)
@@echo "Building" ${POPCORN_DIST}
@@$(call add_license, $(POPCORN_SRC), $(POPCORN_DIST))
-min: ${POPCORN_MIN} ${PLUGINS_MIN} ${PARSERS_MIN} ${PLAYERS_MIN} $(EFFECTS_MIN) ${POPCORN_COMPLETE_MIN}
+min: ${POPCORN_MIN} ${MODULES_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} $(EFFECTS_SRC) ${DIST_DIR}
+${POPCORN_COMPLETE_MIN}: update ${POPCORN_SRC} ${MODULES_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})
@@rm ${POPCORN_COMPLETE_MIN}.tmp
+modules: ${MODULES_DIST}
+
+${MODULES_MIN}: ${MODULES_DIST}
+ @@echo "Building" ${MODULES_MIN}
+ @@$(call compile, $(shell for js in ${MODULES_SRC} ; do echo --js $$js ; done), ${MODULES_MIN})
+
+${MODULES_DIST}: ${MODULES_SRC} ${DIST_DIR}
+ @@echo "Building ${MODULES_DIST}"
+ @@cat ${MODULES_SRC} > ${MODULES_DIST}
+
plugins: ${PLUGINS_DIST}
${PLUGINS_MIN}: ${PLUGINS_DIST}
@@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
+complete: update ${POPCORN_SRC} ${MODULES_SRC} ${PARSERS_SRC} ${PLUGINS_SRC} ${PLAYERS_SRC} $(EFFECTS_SRC) ${DIST_DIR}
+ @@echo "Building popcorn + modules + plugins + parsers + players + effects..."
+ @@cat ${POPCORN_SRC} ${MODULES_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
@@echo "Checking core unit tests against JSLint..."
@@$(call run_lint,test/popcorn.unit.js)
+lint-modules:
+ @@echo "Checking all modules against JSLint..."
+ @@$(call run_lint,$(MODULES_SRC))
+
lint-plugins:
@@echo "Checking all plugins against JSLint..."
@@$(call run_lint,$(PLUGINS_SRC))
@@echo "Checking all effects against JSLint..."
@@$(call run_lint,$(EFFECTS_SRC))
+lint-modules-tests:
+ @@echo "Checking modules unit tests against JSLint..."
+ @@$(call run_lint,$(MODULES_UNIT))
+
lint-plugin-tests:
@@echo "Checking plugin unit tests against JSLint..."
@@$(call run_lint,$(PLUGINS_UNIT))
@@rm -fr ${TESTING_MIRROR}/AUTHORS ${TESTING_MIRROR}/LICENSE ${TESTING_MIRROR}/LICENSE_HEADER \
${TESTING_MIRROR}/Makefile ${TESTING_MIRROR}/readme.md
@@touch "${TESTING_MIRROR}/THIS IS A TESTING MIRROR -- READ-ONLY"
+ $(call overwrite_js, ${TESTING_MIRROR}/modules)
$(call overwrite_js, ${TESTING_MIRROR}/plugins)
$(call overwrite_js, ${TESTING_MIRROR}/players)
$(call overwrite_js, ${TESTING_MIRROR}/parsers)