4 DOC_CONFIG_DIR = ./doc/config
5 DOC_CUSTOM_CSS = custom-1
6 UGLIFY_BIN = ./node_modules/.bin/uglifyjs
9 ASSETS_OUT = $(SOURCE_DIR)/assets.js
10 DOC_INPUTS = -i $(SOURCE_DIR)
11 SOURCES = ${shell find $(SOURCE_DIR) -name "*.js"}
13 DEFAULT_COMPONENTS = core widget baseclient caching modules debug legacy googledrive dropbox
14 NOCACHE_COMPONENTS = core widget baseclient modules debug legacy googledrive dropbox
15 NODEJS_COMPONENTS = core baseclient caching modules legacy nodejs
21 @echo "help - display this text"
22 @echo "all - build regular, minified AMD and nodejs targets, plus all -nocache targets"
23 @echo "build - build remotestorage.js"
24 @echo "build-amd - build remotestorage.js with AMD wrapper"
25 @echo "build-node - build remotestorage.js suitable for nodejs"
26 @echo "build-nocache - build remotestorage.js without caching (plus AMD and .min versions of that)"
27 @echo "minify - minify remotestorage.js -> remotestorage.min.js"
28 @echo "compile-assets - compile $(ASSETS_DIR)/* into $(ASSETS_OUT)"
29 @echo "clean - remove all builds and editor swapfiles"
32 all: compile-assets build build-amd minify build-nocache build-node doc
35 minify: remotestorage.min.js
36 build: remotestorage.js
37 build-amd: remotestorage.amd.js
38 build-node: remotestorage-node.js
39 build-nocache: remotestorage-nocache.js remotestorage-nocache.min.js remotestorage-nocache.amd.js
40 compile-assets: $(ASSETS_OUT)
42 .PHONY: help buildserver build-all compile-assets minify build doc clean
45 # uglifyjs $< -o $@ --mangle --wrap --export-all
46 $(UGLIFY_BIN) -o $@ $<
52 remotestorage.js: $(SOURCES)
53 $(NODEJS) build/do-build.js remotestorage.js $(DEFAULT_COMPONENTS)
55 remotestorage.amd.js: $(SOURCES)
56 $(NODEJS) build/do-build.js remotestorage.amd.js --amd $(DEFAULT_COMPONENTS)
58 remotestorage-node.js: $(SOURCES)
59 $(NODEJS) build/do-build.js remotestorage-node.js --node $(NODEJS_COMPONENTS)
61 # remotestorage.min.js: remotestorage.js
62 # uglifyjs remotestorage.js -o remotestorage.min.js --mangle --wrap --export-all
63 # ## copy version header from original (uglifyjs strips all comments):
64 # mv remotestorage.min.js remotestorage.min.js.tmp
65 # head -n1 remotestorage.js > remotestorage.min.js
66 # cat remotestorage.min.js.tmp >> remotestorage.min.js
67 # rm remotestorage.min.js.tmp
69 remotestorage-nocache.js: $(SOURCES)
70 $(NODEJS) build/do-build.js $@ $(NOCACHE_COMPONENTS)
72 remotestorage-nocache.amd.js: $(SOURCES)
73 $(NODEJS) build/do-build.js $@ --amd $(NOCACHE_COMPONENTS)
75 $(ASSETS_OUT): $(ASSETS_DIR)/*
76 $(NODEJS) build/compile-assets.js $(ASSETS_DIR) $(ASSETS_OUT)
79 mkdir -p $(DOC_DIR) $(DOC_CONFIG_DIR)
80 $(DOC_BIN) $(DOC_INPUTS) -o html $(DOC_DIR) -p $(DOC_CONFIG_DIR) -s Default $(DOC_CUSTOM_CSS)
83 rm -f remotestorage.js remotestorage.min.js remotestorage.amd.js remotestorage-nocache.js remotestorage-nocache.amd.js remotestorage-nocache.min.js ${shell find -name "*~"} ${shell find -name "*.swp"}