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