forked from methodofaction/Method-Draw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (82 loc) · 2.71 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
NAME=method-draw
VERSION=2.6
PACKAGE=$(NAME)
MAKEDOCS=naturaldocs/NaturalDocs
CLOSURE=build/tools/closure-compiler.jar
YUICOMPRESSOR=build/tools/yuicompressor-2.4.7.jar
# All files that will be compiled by the Closure compiler.
JS_FILES=\
lib/pathseg.js \
lib/touch.js \
lib/js-hotkeys/jquery.hotkeys.min.js \
icons/jquery.svgicons.js \
lib/jgraduate/jquery.jgraduate.js \
lib/contextmenu/jquery.contextMenu.js \
src/browser.js \
src/svgtransformlist.js \
src/math.js \
src/units.js \
src/svgutils.js \
src/sanitize.js \
src/history.js \
src/select.js \
src/draw.js \
src/path.js \
src/svgcanvas.js \
src/method-draw.js \
lib/jquery-draginput.js \
lib/contextmenu.js \
lib/jquery-ui/jquery-ui-1.8.17.custom.min.js \
lib/jgraduate/jpicker.min.js \
lib/mousewheel.js \
extensions/ext-eyedropper.js \
extensions/ext-grid.js \
extensions/ext-shapes.js \
lib/requestanimationframe.js \
lib/taphold.js \
lib/filesaver.js
CSS_FILES=\
lib/jgraduate/css/jPicker.css \
lib/jgraduate/css/jgraduate.css \
css/method-draw.css \
JS_INPUT_FILES=$(addprefix editor/, $(JS_FILES))
CSS_INPUT_FILES=$(addprefix editor/, $(CSS_FILES))
JS_BUILD_FILES=$(addprefix $(PACKAGE)/, $(JS_FILES))
CSS_BUILD_FILES=$(addprefix $(PACKAGE)/, $(CSS_FILES))
CLOSURE_JS_ARGS=$(addprefix --js , $(JS_INPUT_FILES))
COMPILED_JS=editor/method-draw.compiled.js
COMPILED_CSS=editor/css/method-draw.compiled.css
all: release
# The build directory relies on the JS being compiled.
$(PACKAGE): $(COMPILED_JS) $(COMPILED_CSS)
rm -rf config;
mkdir config;
if [ -x $(MAKEDOCS) ] ; then $(MAKEDOCS) -i editor/ -o html docs/ -p config/ -oft -r ; fi
# Make build directory and copy all editor contents into it
mkdir -p $(PACKAGE)
cp -r editor/* $(PACKAGE)
# Remove all hidden .svn directories
-find $(PACKAGE) -name .svn -type d | xargs rm -rf {} \;
-find $(PACKAGE) -name .git -type d | xargs rm -rf {} \;
# Create the release version of the main HTML file.
build/tools/ship.py --i=editor/index.html --on=svg_edit_release > $(PACKAGE)/index.html
# NOTE: Some files are not ready for the Closure compiler: (jquery)
# NOTE: Our code safely compiles under SIMPLE_OPTIMIZATIONS
# NOTE: Our code is *not* ready for ADVANCED_OPTIMIZATIONS
# NOTE: WHITESPACE_ONLY and --formatting PRETTY_PRINT is helpful for debugging.
$(COMPILED_CSS):
cat $(CSS_INPUT_FILES) > editor/temp.css;
java -jar $(YUICOMPRESSOR) editor/temp.css -o $(COMPILED_CSS) --line-break 0;
rm editor/temp.css;
$(COMPILED_JS):
java -jar $(CLOSURE) \
--compilation_level SIMPLE_OPTIMIZATIONS \
$(CLOSURE_JS_ARGS) \
--js_output_file $(COMPILED_JS)
compile: $(COMPILED_JS) $(COMPILED_CSS)
release: $(PACKAGE)
clean:
rm -rf config
rm -rf $(PACKAGE)
rm -rf $(COMPILED_JS)
rm -rf $(COMPILED_CSS)