forked from SVG-Edit/svgedit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (89 loc) · 2.92 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
98
99
100
101
102
103
104
NAME=svg-edit
VERSION=2.8.1
PACKAGE=$(NAME)-$(VERSION)
MAKEDOCS=naturaldocs/NaturalDocs
CLOSURE=build/tools/closure-compiler.jar
ZIP=zip
# All files that will be compiled by the Closure compiler.
JS_FILES=\
svgedit.js \
jquery-svg.js \
contextmenu/jquery.contextmenu.js \
pathseg.js \
browser.js \
svgtransformlist.js \
math.js \
units.js \
svgutils.js \
sanitize.js \
history.js \
coords.js \
recalculate.js \
select.js \
draw.js \
path.js \
svgcanvas.js \
svg-editor.js \
locale/locale.js \
contextmenu.js
JS_INPUT_FILES=$(addprefix editor/, $(JS_FILES))
JS_BUILD_FILES=$(addprefix build/$(PACKAGE)/, $(JS_FILES))
CLOSURE_JS_ARGS=$(addprefix --js , $(JS_INPUT_FILES))
COMPILED_JS=editor/svgedit.compiled.js
all: release firefox opera
# The build directory relies on the JS being compiled.
build/$(PACKAGE): $(COMPILED_JS)
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 build/$(PACKAGE)
cp -r editor/* build/$(PACKAGE)
# Remove all hidden .svn directories
-find build/$(PACKAGE) -name .svn -type d | xargs rm -rf {} \;
# Create the release version of the main HTML file.
build/tools/ship.py --i=editor/svg-editor.html --on=svg_edit_release > build/$(PACKAGE)/svg-editor.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_JS):
java -jar $(CLOSURE) \
--compilation_level SIMPLE_OPTIMIZATIONS \
$(CLOSURE_JS_ARGS) \
--js_output_file $(COMPILED_JS)
compile: $(COMPILED_JS)
release: build/$(PACKAGE)
cd build ; $(ZIP) $(PACKAGE).zip -r $(PACKAGE) ; cd ..
tar -z -c -f build/$(PACKAGE)-src.tar.gz \
--exclude='\.svn' \
--exclude='build/*' \
.
firefox: build/$(PACKAGE)
mkdir -p build/firefox/content/editor
cp -r firefox-extension/* build/firefox
rm -rf build/firefox/content/.svn
cp -r build/$(PACKAGE)/* build/firefox/content/editor
rm -f build/firefox/content/editor/embedapi.js
cd build/firefox ; $(ZIP) ../$(PACKAGE).xpi -r * ; cd ../..
opera: build/$(PACKAGE)
mkdir -p build/opera/editor
cp opera-widget/* build/opera
cp -r build/$(PACKAGE)/* build/opera/editor
cd build/opera ; $(ZIP) ../$(PACKAGE).wgt -r * ; cd ../..
chrome:
mkdir -p build/svgedit_app
cp -a chrome-app/* build/svgedit_app
cd build ; $(ZIP) -r $(PACKAGE)-crx.zip svgedit_app ; rm -rf svgedit_app; cd ..
jgraduate:
java -jar $(CLOSURE) --js editor/jgraduate/jquery.jgraduate.js --js_output_file editor/jgraduate/jquery.jgraduate.min.js
clean:
rm -rf config
rm -rf build/$(PACKAGE)
rm -rf build/firefox
rm -rf build/opera
rm -rf build/$(PACKAGE).zip
rm -rf build/$(PACKAGE)-src.tar.gz
rm -rf build/$(PACKAGE).xpi
rm -rf build/$(PACKAGE).wgt
rm -rf $(COMPILED_JS)