-
Notifications
You must be signed in to change notification settings - Fork 36
/
Makefile
44 lines (32 loc) · 935 Bytes
/
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
SRC_DIR = src
DIST_DIR = ./dist
DATE = $(shell date)
YEAR = $(shell echo `date +%Y`)
VERSION = $(shell echo "$$(cat package.json | grep '"version"' | sed 's/[^0-9\.\-]//g')")
BASE_FILES = ${SRC_DIR}/jribbble.js
JB = ${DIST_DIR}/jribbble.js
JB_MIN = ${DIST_DIR}/jribbble.min.js
UGLIFIER = $(shell uglifyjs -o ${JB_MIN} ${JB} -c -m --comments)
all: core
core: clean jribbble min
@@echo "Build complete."
${DIST_DIR}:
@@mkdir -p ${DIST_DIR}
jribbble: ${JB}
${JB}: ${BASE_FILES} | ${DIST_DIR}
@@echo "Building" ${JB}
@@cat ${BASE_FILES} | \
sed 's/@DATE/'"${DATE}"'/' | \
sed 's/@YEAR/'"${YEAR}"'/' | \
sed "s/@VERSION/${VERSION}/" > ${JB};
min: ${JB_MIN}
${JB_MIN}: ${JB}
@@echo "Minifying Jribbble" ${JB_MIN}
${UGLIFIER}
release:
git tag -a $(VERSION) -m "Releasing version: $(VERSION)"
git push origin $(VERSION)
npm publish
clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR}