]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Rework Makefile, add popcorn + plugin packaging.
authorDavid Humphrey <david.humphrey@senecac.on.ca>
Sat, 19 Feb 2011 22:08:19 +0000 (17:08 -0500)
committerDavid Humphrey <david.humphrey@senecac.on.ca>
Sat, 19 Feb 2011 22:08:19 +0000 (17:08 -0500)
Makefile

index 955c02bf3e450078ac783d71540eb4ea6de18240..e63e97f043eae35b94aac1d8b71c596e3ee3263f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 PREFIX = .
 BUILD_DIR = ${PREFIX}/build
 DIST_DIR = ${PREFIX}/dist
-
+PLUGINS_DIR = ${PREFIX}/plugins
 
 RHINO ?= java -jar ${BUILD_DIR}/js.jar
 
@@ -18,80 +18,61 @@ POPCORN_SRC = ${PREFIX}/popcorn.js
 POPCORN_DIST = ${DIST_DIR}/popcorn.js
 POPCORN_MIN = ${DIST_DIR}/popcorn.min.js
 
-all: popcorn min lint
+# plugins
+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))
+
+
+all: lint popcorn plugins min complete
        @@echo "Popcorn build complete."
 
 ${DIST_DIR}:
        @@mkdir -p ${DIST_DIR}
-       
 
 popcorn: ${POPCORN_DIST}
-p: ${POPCORN_DIST}
 
 ${POPCORN_DIST}: ${POPCORN_SRC} | ${DIST_DIR}
        @@echo "Building" ${POPCORN_DIST}
+       @@cp ${POPCORN_SRC} ${POPCORN_DIST}
 
-       @@cat ${POPCORN_SRC} > ${POPCORN_DIST}; 
-       
-
-min: ${POPCORN_MIN}
+min: ${POPCORN_MIN} ${PLUGINS_MIN}
 
 ${POPCORN_MIN}: ${POPCORN_DIST}
        @@echo "Building" ${POPCORN_MIN}
-
-       @@head -0 ${POPCORN_DIST} > ${POPCORN_MIN}
-       @@${MINJAR} --js ${POPCORN_DIST} --warning_level QUIET --js_output_file ${POPCORN_MIN}.tmp
-       @@cat ${POPCORN_MIN}.tmp >> ${POPCORN_MIN}
-       @@rm -f ${POPCORN_MIN}.tmp      
-       
-
-lint: ${POPCORN_DIST}
-       @@echo "Checking Popcorn against JSLint..."
-       @@${RHINO} build/jslint-check.js        
-       
-clean:
-       @@echo "Removing Distribution directory:" ${DIST_DIR}
-       @@rm -rf ${DIST_DIR}
-
-       
-
-# Make sure $JSSHELL points to your js shell binary in .profile or .bashrc
-TOOLSDIR= ${PREFIX}/tools
-
-# Most targets use commands that need a js shell path specified
-JSSHELL ?= $(error Specify a valid path to a js shell binary in ~/.profile: export JSSHELL=C:\path\js.exe or /path/js)
-
-check: check-lint
-
-check-lint:
-       ${TOOLSDIR}/jslint.py ${JSSHELL} popcorn.js
-
-
-
-PLUGINS_DIR = ${PREFIX}/plugins
-PLUGINS_DIST = ${DIST_DIR}/popcorn.plugins.js
-PLUGINS_MIN = ${DIST_DIR}/popcorn.plugins.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))
+       @@${MINJAR} --js ${POPCORN_DIST} \
+                   --compilation_level SIMPLE_OPTIMIZATIONS \
+                   --js_output_file ${POPCORN_MIN}
 
 plugins: ${PLUGINS_DIST}
 
-${PLUGINS_DIST}: ${PLUGINS_SRC} | ${DIST_DIR}
-       @@echo "Building" ${PLUGINS_DIST}
-
-       @@cat ${PLUGINS_SRC} > ${PLUGINS_DIST}; 
-       
-
-pluginsmin: ${PLUGINS_MIN}
-
 ${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}
 
-       @@head -0 ${PLUGINS_DIST} > ${PLUGINS_MIN}
-       @@${MINJAR} --js ${PLUGINS_DIST} --warning_level QUIET --js_output_file ${PLUGINS_MIN}.tmp
-       @@cat ${PLUGINS_MIN}.tmp >> ${PLUGINS_MIN}
-       @@rm -f ${PLUGINS_MIN}.tmp      
+${PLUGINS_DIST}: ${PLUGINS_SRC} ${DIST_DIR}
+       @@echo "Building ${PLUGINS_DIST}"
+       @@cat ${PLUGINS_SRC} > ${PLUGINS_DIST}
 
+complete: ${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}
 
+lint: ${POPCORN_DIST}
+       @@echo "Checking Popcorn against JSLint..."
+       @@${RHINO} build/jslint-check.js
 
+clean:
+       @@echo "Removing Distribution directory:" ${DIST_DIR}
+       @@rm -rf ${DIST_DIR}