Merge pull request #512 from galfert/node_binary_fix
[remotestorage.js] / Makefile
index ebf9c46..822d6eb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ DOC_BIN        = naturaldocs
 DOC_DIR        = ./doc/code
 DOC_CONFIG_DIR = ./doc/config
 DOC_CUSTOM_CSS = custom-1
+UGLIFY_BIN     = ./node_modules/.bin/uglifyjs
 SOURCE_DIR     = ./src
 ASSETS_DIR     = ./assets
 ASSETS_OUT     = $(SOURCE_DIR)/assets.js
@@ -11,31 +12,38 @@ SOURCES        = ${shell find $(SOURCE_DIR) -name "*.js"}
 
 DEFAULT_COMPONENTS = core widget baseclient caching modules debug legacy googledrive dropbox
 NOCACHE_COMPONENTS = core widget baseclient modules debug legacy googledrive dropbox
+NODEJS_COMPONENTS  = core baseclient caching modules legacy nodejs
+
 
 default: help
 
 help:
        @echo "help           - display this text"
-       @echo "all            - build regular, minified and AMD targets, plus all -nocache targets"
+       @echo "all            - build regular, minified AMD and nodejs targets, plus all -nocache targets"
        @echo "build          - build remotestorage.js"
        @echo "build-amd      - build remotestorage.js with AMD wrapper"
+       @echo "build-node     - build remotestorage.js suitable for nodejs"
        @echo "build-nocache  - build remotestorage.js without caching (plus AMD and .min versions of that)"
        @echo "minify         - minify remotestorage.js -> remotestorage.min.js"
        @echo "compile-assets - compile $(ASSETS_DIR)/* into $(ASSETS_OUT)"
        @echo "clean          - remove all builds and editor swapfiles"
 
-all: build build-amd minify build-nocache
+
+all: compile-assets build build-amd minify build-nocache build-node doc
+
 build-all: all
 minify: remotestorage.min.js
 build: remotestorage.js
 build-amd: remotestorage.amd.js
+build-node: remotestorage-node.js
 build-nocache: remotestorage-nocache.js remotestorage-nocache.min.js remotestorage-nocache.amd.js
 compile-assets: $(ASSETS_OUT)
 
 .PHONY: help buildserver build-all compile-assets minify build doc clean
 
 %.min.js: %.js
-       uglifyjs $< -o $@ --mangle --wrap --export-all
+#      uglifyjs $< -o $@ --mangle --wrap --export-all
+       $(UGLIFY_BIN) -o $@ $<
        mv $@ $@.tmp
        head -n1 $< > $@
        cat $@.tmp >> $@
@@ -47,6 +55,9 @@ remotestorage.js: $(SOURCES)
 remotestorage.amd.js: $(SOURCES)
        $(NODEJS) build/do-build.js remotestorage.amd.js --amd $(DEFAULT_COMPONENTS)
 
+remotestorage-node.js: $(SOURCES)
+       $(NODEJS) build/do-build.js remotestorage-node.js --node $(NODEJS_COMPONENTS)
+
 # remotestorage.min.js: remotestorage.js
 #      uglifyjs remotestorage.js -o remotestorage.min.js --mangle --wrap --export-all
 # ## copy version header from original (uglifyjs strips all comments):