forked from christophevg/UmlCanvas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
162 lines (137 loc) · 4.96 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
COMPRESSOR-VERSION=2.4.2
MAKE=make
FETCH=wget -q
GIT-PULL=git pull -q
GIT-CLONE=git clone -q
ZIP=zip -qr
UNZIP=unzip -q
COMPRESS=java -jar ${COMPRESS-JAR} --type js
APP=UmlCanvas
TARGETS=build/${APP}.shared.min.js build/${APP}.standalone.min.js \
build/${APP}.css
VERSION=$(shell git describe --tags | cut -d'-' -f1,2)
SRCS=src/DepCheck.js \
src/UmlCanvas.js \
src/Common.js \
src/Manager.js \
src/Model.js \
src/Diagram.js \
src/Class.js src/Attribute.js src/Operation.js src/Parameter.js \
src/ConnectorHeads.js \
src/Association.js src/Role.js \
src/Dependency.js src/ClientSupplier.js \
src/Interface.js \
src/Inheritance.js \
src/Realization.js \
src/Enumeration.js \
src/Note.js \
src/NoteLink.js \
src/StateDiagrams.js \
src/Widget.js \
src/KickStart.js \
src/PluginManagerRepository.js \
src/plugins/Plugin.js \
src/plugins/Inspector.js \
src/plugins/Sheet.js \
src/plugins/HuC.js \
src/Defaults.js \
src/Config.js \
src/plugins/inspector.css.js
CSSSRCS=src/${APP}.css lib/Canvas2D/build/Canvas2D.css
LIBS=lib/Canvas2D/build/Canvas2D.standalone.js
COMPRESSOR-DIST=yuicompressor-${COMPRESSOR-VERSION}.zip
COMPRESS-JAR=lib/yuicompressor-${COMPRESSOR-VERSION}/build/yuicompressor-${COMPRESSOR-VERSION}.jar
COMPRESSOR-URL=http://www.julienlecomte.net/yuicompressor/${COMPRESSOR-DIST}
CANVAS2D-URL=git://github.com/christophevg/Canvas2D.git
DIST=${APP}-${VERSION}.zip
DISTSRCS=${TARGETS} examples/*.html examples/*.css LICENSE README
DIST-SRC=${APP}-${VERSION}-src.zip
DIST-SRCSRCS=LICENSE README examples/* doc/* src/*.* src/ext/*.* src/plugins/*.*
DIST-SRC-LIBS=lib/Canvas2D/build/Canvas2D.standalone.js
DIST-EXT=${APP}-${VERSION}-ext.zip
DIST-EXTSRCS=LICENSE \
lib/Canvas2D/build/Canvas2D.standalone.min.js \
build/${APP}.shared.min.js \
build/${APP}.css \
src/ext/${APP}.php
all: build
build: .check-deps ${TARGETS}
update-libs:
@(cd lib/Canvas2D; ${GIT-PULL}; ${MAKE} clean; ${MAKE} update-libs; ${MAKE})
.check-deps:
@echo "*** checking dependencies"
@echo " (if you get errors in this section the cmd right before"
@echo " the error, is not found in your PATH)"
@echo " - zip"; which unzip >/dev/null
@echo " - touch"; which touch >/dev/null
@echo " - unzip"; which zip >/dev/null
@echo " - wget"; which wget >/dev/null
@echo " - git"; which git >/dev/null
@echo " - java"; which java >/dev/null
@echo "*** FOUND all required commands on your system"
@touch $@
dist: dist/${DIST} dist/${DIST-SRC} dist/${DIST-EXT}
lib/Canvas2D/build/Canvas2D.standalone.js: lib/Canvas2D
lib/Canvas2D/build/Canvas2D.css: lib/Canvas2D
lib/Canvas2D:
@echo "*** importing $@"
@${GIT-CLONE} ${CANVAS2D-URL} lib/Canvas2D
@(cd lib/Canvas2D; ${MAKE})
${COMPRESS-JAR}:
@echo "*** importing yuicompressor"
@mkdir -p lib
@(cd lib; ${FETCH} ${COMPRESSOR-URL}; ${UNZIP} ${COMPRESSOR-DIST})
@(cd lib/yuicompressor-${COMPRESSOR-VERSION}; ant > /dev/null)
build/${APP}.shared.js: ${SRCS}
@echo "*** building $@"
@mkdir -p build
@echo "var UMLCANVAS_VERSION = \"${VERSION}\";\n" > $@;
@cat ${SRCS} >> $@
build/${APP}.standalone.js: build/${APP}.shared.js ${LIBS}
@echo "*** building $@"
@mkdir -p build
@cat ${LIBS} build/${APP}.shared.js > $@
build/${APP}.shared.min.js: build/${APP}.shared.js ${COMPRESS-JAR}
@echo "*** building $@"
@${COMPRESS} build/${APP}.shared.js > $@
build/${APP}.standalone.min.js: build/${APP}.standalone.js ${COMPRESS-JAR}
@echo "*** building $@"
@${COMPRESS} build/${APP}.standalone.js > $@
build/${APP}.css: ${CSSSRCS}
@echo "*** building $@"
@mkdir -p build
@cat ${CSSSRCS} > $@
publish: dist/${DIST} dist/${DIST-SRC} dist/${DIST-EXT}
@echo "*** publishing distributions to ${PUB}"
@scp dist/${DIST} dist/${DIST-SRC} dist/${DIST-EXT} ${PUB}
dist/${DIST}: ${DISTSRCS}
@echo "*** packaging ${APP} distribution"
@mkdir -p dist/js/${APP}/{examples,build}
@for f in ${DISTSRCS}; do \
cat $$f \
| sed -e 's/includes\.js/..\/UmlCanvas.standalone.min.js/' \
| sed -e 's/\.\.\/build/../' \
> dist/js/${APP}/$$f; done
@mv dist/js/${APP}/build/* dist/js/${APP}/; rm -rf dist/js/${APP}/build
@(cd dist/js; ${ZIP} ../${DIST} ${APP})
dist/${DIST-SRC}: ${DIST-SRCSRCS} ${DIST-SRC-LIBS}
@echo "*** packaging ${APP} src distribution"
@mkdir -p dist/src/${APP}/{doc,src/{ext,plugins},examples,lib}
@for f in ${DIST-SRCSRCS}; do \
cat $$f \
| sed -e 's|Canvas2D/build/||' \
| sed -e 's|\.\.\/build/||' \
> dist/src/${APP}/$$f; done
@cp build/UmlCanvas.css dist/src/${APP}/examples
@cp ${DIST-SRC-LIBS} dist/src/${APP}/lib
@(cd dist/src; ${ZIP} ../${DIST-SRC} ${APP})
dist/${DIST-EXT}: ${DIST-EXTSRCS}
@echo "*** packaging ${APP} Mediawiki extenstion"
@mkdir -p dist/ext/${APP}
@cp -r ${DIST-EXTSRCS} dist/ext/${APP}
@(cd dist/ext; ${ZIP} ../${DIST-EXT} ${APP})
clean:
@find . | grep "~$$" | xargs rm -f
@rm -rf build dist
mrproper: clean
@rm -rf lib .check-deps