RHINO ?= java -jar ${BUILD_DIR}/js.jar
CLOSURE_COMPILER = ${BUILD_DIR}/google-compiler-20100917.jar
+compile = @@${MINJAR} $(1) \
+ --compilation_level SIMPLE_OPTIMIZATIONS \
+ --js_output_file $(2)
# minify
MINJAR ?= java -jar ${CLOSURE_COMPILER}
PLUGINS_DIST = ${DIST_DIR}/popcorn.plugins.js
PLUGINS_MIN = ${DIST_DIR}/popcorn.plugins.min.js
-# popcorn + plugins
-POPCORN_COMPLETE_DIST = ${DIST_DIR/popcorn-complete.js
-POPCORN_COMPLETE_MIN = ${DIST_DIR}/popcorn-complete.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))
+# popcorn + plugins
+POPCORN_COMPLETE_LIST := --js ${POPCORN_SRC} $(shell for js in ${PLUGINS_SRC} ; do echo --js $$js ; done)
+POPCORN_COMPLETE_DIST = ${DIST_DIR}/popcorn-complete.js
+POPCORN_COMPLETE_MIN = ${DIST_DIR}/popcorn-complete.min.js
+
all: lint popcorn plugins min complete
@@echo "Popcorn build complete."
@@echo "Building" ${POPCORN_DIST}
@@cp ${POPCORN_SRC} ${POPCORN_DIST}
-min: ${POPCORN_MIN} ${PLUGINS_MIN}
+min: ${POPCORN_MIN} ${PLUGINS_MIN} ${POPCORN_COMPLETE_MIN}
${POPCORN_MIN}: ${POPCORN_DIST}
@@echo "Building" ${POPCORN_MIN}
- @@${MINJAR} --js ${POPCORN_DIST} \
- --compilation_level SIMPLE_OPTIMIZATIONS \
- --js_output_file ${POPCORN_MIN}
+ $(call compile, --js ${POPCORN_DIST}, ${POPCORN_MIN})
+
+${POPCORN_COMPLETE_MIN}: ${POPCORN_SRC} ${PLUGINS_SRC} ${DIST_DIR}
+ @@echo "Building" ${POPCORN_COMPLETE_MIN}
+ @@$(call compile, ${POPCORN_COMPLETE_LIST}, ${POPCORN_COMPLETE_MIN})
plugins: ${PLUGINS_DIST}
${PLUGINS_MIN}: ${PLUGINS_DIST}
@@echo "Building" ${PLUGINS_MIN}
- @@${MINJAR} $(shell for js in ${PLUGINS_SRC} ; do echo --js $$js ; done) \
- --compilation_level SIMPLE_OPTIMIZATIONS \
- --js_output_file ${PLUGINS_MIN}
+ $(call compile, $(shell for js in ${PLUGINS_SRC} ; do echo --js $$js ; done), ${PLUGINS_MIN})
${PLUGINS_DIST}: ${PLUGINS_SRC} ${DIST_DIR}
@@echo "Building ${PLUGINS_DIST}"
@@cat ${PLUGINS_SRC} > ${PLUGINS_DIST}
-complete: ${DIST_DIR}
+complete: ${POPCORN_SRC} ${PLUGINS_SRC} ${DIST_DIR}
@@echo "Building popcorn + plugins"
- @@${MINJAR} --js ${POPCORN_SRC} \
- $(shell for js in ${PLUGINS_SRC} ; do echo --js $$js ; done) \
- --compilation_level SIMPLE_OPTIMIZATIONS \
- --js_output_file ${POPCORN_COMPLETE_MIN}
+ @@cat ${POPCORN_SRC} ${PLUGINS_SRC} > ${POPCORN_COMPLETE_DIST}
lint: ${POPCORN_DIST}
@@echo "Checking Popcorn against JSLint..."