-
Notifications
You must be signed in to change notification settings - Fork 56
/
Makefile
65 lines (58 loc) · 2.12 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
SRC_DIR = src
DIST_DIR = dist
JS_ENGINE ?= `which uglifyjs`
COMPILER = ${JS_ENGINE} --unsafe --no-copyright
VER = $(shell git describe --tags --abbrev=0)
MIN_HEAD = "/*! JS Avro Phonetic ${VER} http://omicronlab.com | https://raw.github.com/torifat/jsAvroPhonetic/master/MPL-1.1.txt */\n"
all: min tmpclean
@@echo "Avro Phonetic JS Version "${VER}
clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR}
@@mkdir -p ${DIST_DIR}
copy: clean
@@echo "Versioning";
@@cat ${SRC_DIR}/avro-lib.js > ${DIST_DIR}/avro-lib-${VER}.js
@@cat ${SRC_DIR}/avro.jquery.js > ${DIST_DIR}/avro.jquery-${VER}.js
@@cat ${SRC_DIR}/avro-bookmarklet.js > ${DIST_DIR}/avro-bookmarklet-${VER}.js
@@sed '1,26d' ${DIST_DIR}/avro-lib-${VER}.js > tmp.js
@@cat ${DIST_DIR}/avro.jquery-${VER}.js tmp.js > ${DIST_DIR}/avro-${VER}.js
min: copy
@@if test ! -z ${JS_ENGINE}; then \
echo "Minifying Library"; \
${COMPILER} ${SRC_DIR}/avro-lib.js | \
sed 's/find/f/g' | \
sed 's/replace/r/g' | \
sed 's/matches/m/g' | \
sed 's/scope/s/g' | \
sed 's/type/t/g' | \
sed 's/tof/typeof/g' | \
sed 's/rules/u/g' | \
sed 's/vowel/v/g' | \
sed 's/consonant/c/g' | \
sed 's/punctuation/p/g' | \
sed 's/exact/e/g' | \
sed 's/suffix/s/g' | \
sed 's/prefix/p/g' | \
sed 's/prefix/p/g' | \
sed 's/value/v/g' \
> tmp.js; \
echo ${MIN_HEAD}`cat tmp.js` > ${DIST_DIR}/avro-lib-${VER}.min.js; \
echo "Minifying jQuery Plugins"; \
${COMPILER} ${SRC_DIR}/avro.jquery.js > tmp2.js; \
echo ${MIN_HEAD}`cat tmp2.js` > ${DIST_DIR}/avro.jquery-${VER}.min.js; \
echo "Creating minified avro.js"; \
echo ${MIN_HEAD}`cat tmp.js tmp2.js` > ${DIST_DIR}/avro-${VER}.min.js; \
echo "Creating latest avro.js"; \
cp ${DIST_DIR}/avro-${VER}.min.js ${DIST_DIR}/avro-latest.js; \
echo "Minifying Bookmarklet"; \
${COMPILER} ${SRC_DIR}/avro-bookmarklet.js > tmp.js; \
echo "javascript:"`cat tmp.js` > ${DIST_DIR}/avro-bookmarklet-${VER}.min.js; \
else \
echo "You must have UglifyJS installed in order to minify Avro Phonetic JS."; \
fi
tmpclean:
@@echo "Cleaning all temp files"
@@rm -f tmp.js tmp2.js;
tag:
@@git tag -a -f -m "${VER}" ${VER}