-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
97 lines (76 loc) · 3.15 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
PROJECT := $(notdir ${PWD})
FONT_NAME := websymbols
################################################################################
## ! DO NOT EDIT BELOW THIS LINE, UNLESS YOU REALLY KNOW WHAT ARE YOU DOING ! ##
################################################################################
TMP_PATH := /tmp/${PROJECT}-$(shell date +%s)
REMOTE_NAME ?= origin
REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)
PWD := $(shell pwd)
BIN := ./node_modules/.bin
dist: font html
dump:
rm -r ./src/svg/
mkdir ./src/svg/
#font-dump.js --hcrop --vcenter -c config.yml -f -i ./src/original/websymbols-fixed.svg -o ./src/svg/ -d diff.yml
${BIN}/svg-font-dump -c `pwd`/config.yml -f -i ./src/original/websymbols-fixed.svg -o ./src/svg/ -d diff.yml
${BIN}/svgo --config `pwd`/dump.svgo.yml -f ./src/svg
font:
@if test ! -d node_modules ; then \
echo "dependencies not found:" >&2 ; \
echo " make dependencies" >&2 ; \
exit 128 ; \
fi
${BIN}/svg-font-create -c config.yml -i ./src/svg -o "./font/$(FONT_NAME).svg"
fontforge -c 'font = fontforge.open("./font/$(FONT_NAME).svg"); font.generate("./font/$(FONT_NAME).ttf")'
@if test `which ttfautohint` ; then \
ttfautohint --latin-fallback --hinting-limit=200 --hinting-range-max=50 --symbol ./font/$(FONT_NAME).ttf ./font/$(FONT_NAME)-hinted.ttf && \
mv ./font/$(FONT_NAME)-hinted.ttf ./font/$(FONT_NAME).ttf ; \
else \
echo "WARNING: ttfautohint not found. Font will not be hinted." >&2 ; \
fi
${BIN}/ttf2eot "./font/$(FONT_NAME).ttf" "./font/$(FONT_NAME).eot"
${BIN}/ttf2woff "./font/$(FONT_NAME).ttf" "./font/$(FONT_NAME).woff"
html:
@${BIN}/jade -O '$(shell node_modules/.bin/js-yaml -j config.yml)' ./src/demo/demo.jade -o ./font
gh-pages:
@if test -z ${REMOTE_REPO} ; then \
echo 'Remote repo URL not found' >&2 ; \
exit 128 ; \
fi
cp -r ./font ${TMP_PATH} && \
touch ${TMP_PATH}/.nojekyll
cd ${TMP_PATH} && \
git init && \
git add . && \
git commit -q -m 'refreshed gh-pages'
cd ${TMP_PATH} && \
git remote add remote ${REMOTE_REPO} && \
git push --force remote +master:gh-pages
rm -rf ${TMP_PATH}
dependencies:
@if test ! `which npm` ; then \
echo "Node.JS and NPM are required for html demo generation." >&2 ; \
echo "This is non-fatal error and you'll still be able to build font," >&2 ; \
echo "however, to build demo with >> make html << you need:" >&2 ; \
echo " - Install Node.JS and NPM" >&2 ; \
echo " - Run this task once again" >&2 ; \
exit 128 ; \
fi
@if test ! `which ttfautohint` ; then \
echo "Trying to install ttf-autohint from repository..." ; \
apt-cache policy -q=2 | grep -q 'Candidate' && \
sudo apt-get install ttfautohint && \
echo "SUCCESS" || echo "FAILED" ; \
fi
@if test ! `which ttfautohint` ; then \
echo "Trying to install ttf-autohint from Debian's repository..." ; \
curl --silent --show-error --output /tmp/ttfautohint.deb \
http://ftp.de.debian.org/debian/pool/main/t/ttfautohint/ttfautohint_0.95-1_amd64.deb && \
sudo dpkg -i /tmp/ttfautohint.deb && \
echo "SUCCESS" || echo "FAILED" ; \
fi
@if test ! -d node_modules ; then \
npm install ; \
fi
.PHONY: font html dist dump gh-pages dependencies