-
Notifications
You must be signed in to change notification settings - Fork 85
/
Makefile
55 lines (43 loc) · 1.64 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
name := font-logos
dest := assets
out_json_ext := .out.json
font_exts := .ttf .woff .woff2 $(out_json_ext)
font_assets := $(foreach ext,$(font_exts),$(dest)/$(name)$(ext))
json_file = $(dest)/$(name).json
version = $(shell jq -r .version package.json)
START_CODEPOINT ?= 0xf300
preview_width := 888
export START_CODEPOINT
export FONT_NAME=$(name)
export OUTPUT_DIR=$(dest)
export JSON_FILE=$(json_file)
export COPYRIGHT=Copyright (c) 2014-$(shell date '+%Y'), Lukas W
export VENDORURL=$(shell jq -r .homepage package.json)
all_files=$(font_assets) $(dest)/$(name).css $(dest)/preview.html $(dest)/readme-header.png README.md
.PHONY: all
all: $(all_files)
.PHONY: pack
pack: $(dest)/$(name)-$(version).zip
$(name)-$(version).tgz: $(all_files)
npm pack
$(dest)/$(name)-$(version).zip: $(name)-$(version).tgz
$(eval dir := $(shell mktemp -d))
npm pack
tar -xf $(name)-$(version).tgz -C $(dir)
cd $(dir) && \
mv $(dir)/package $(dir)/$(name)-$(version) && \
zip -r $(shell pwd)/$(name)-$(version).zip $(name)-$(version)
rm -r $(dir)
.SECONDEXPANSION:
$(json_file): scripts/generate-json.mjs icons.tsv package.json
node scripts/generate-json.mjs
$(font_assets)&: scripts/generate-font.py icons.tsv $(shell find vectors) $(json_file)
if command -v fontforge; then \
fontforge --script $(shell pwd)/$< ; \
else \
python $< ;\
fi
%: templates/$$*.njk icons.tsv scripts/render-template.mjs $(json_file) $(dest)/$(name)$(out_json_ext)
node scripts/render-template.mjs $< $@
$(dest)/readme-header.png: $(dest)/readme-header.html $(font_assets) $(dest)/font-logos.css
wkhtmltoimage --enable-local-file-access --width $(preview_width) --disable-smart-width $< $@