-
Notifications
You must be signed in to change notification settings - Fork 68
/
Makefile
112 lines (96 loc) · 3 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
NAME=EBGaramond
TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1)
TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
COMMIT := $(shell git rev-parse --short HEAD)
DATE := $(shell git log -1 --format=%cd --date=format:"%Y%m%d")
VERSION := $(TAG:v%=%)
ifneq ($(COMMIT), $(TAG_COMMIT))
VERSION := $(VERSION)-next-$(COMMIT)-$(DATE)
endif
SRC=SFD
BLD=build
WEB=web
SPEC=specimen
PACK=$(NAME)-$(VERSION)
WPCK=$(NAME)-$(VERSION)-web
DIST=$(NAME)-$(VERSION)-complete
#Call script through fontforge, not python. https://github.com/fontforge/fontforge/issues/528
FF=fontforge
#Return to python because we don’t scale the font any longer.
ifeq ($(OS),Windows_NT)
PYTHON?=ffpython
else
PYTHON?=python3
endif
SCRIPT=tools/makefont.py
#SIZES=08 12
#STYLES=Regular SC Allsc Italic Bold
FONTS=08-Regular 08-Italic 12-Regular SC12-Regular 12-AllSC 12-Italic SC08-Regular # SC12-Italic 12-Bold
SFD=$(FONTS:%=$(SRC)/$(NAME)%.sfdir)
OTF=$(FONTS:%=$(BLD)/$(NAME)%.otf)
TTF=$(FONTS:%=$(BLD)/$(NAME)%.ttf)
WOF=$(FONTS:%=$(WEB)/$(NAME)%.woff)
PDF=$(FONTS:%=$(SPEC)/$(NAME)%-Glyphs.pdf)
all: otf ttf webfonts # pdfs
pack: dpack wpack
otf: $(OTF)
ttf: $(TTF)
webfonts: $(WOF)
pdfs: $(PDF)
$(BLD):
@mkdir $@
$(WEB):
@mkdir -p $@
$(SPEC):
@mkdir -p $@
$(BLD)/%.otf: $(SRC)/%.sfdir Makefile $(SCRIPT) | $(BLD)
@echo "Generating $@"
@$(PYTHON) $(SCRIPT) $< $@ $(VERSION)
$(BLD)/%.ttf: $(SRC)/%.sfdir Makefile $(SCRIPT) | $(BLD)
@echo "Generating $@"
@$(PYTHON) $(SCRIPT) $< $@ $(VERSION)
@echo "Autohinting $@"
@ttfautohint -x 0 -a sss $@ [email protected]
@mv [email protected] $@
$(WEB)/%.woff: $(BLD)/%.ttf | $(WEB) $(BLD)
@echo "Generating $@"
@fontforge -lang=ff -c 'Open($$1); Generate($$2)' $< $@
$(SPEC)/%-Glyphs.pdf: $(BLD)/%.ttf $(SPEC)
@echo "Generating $@"
@fntsample -f $< -o $@ -l > [email protected]
@pdfoutline $@ [email protected] $@
dpack: $(OTF) $(TTF)
@echo "Packing fonts to zipfile"
@mkdir -p $(PACK)/otf
@mkdir -p $(PACK)/ttf
@mkdir -p $(PACK)/specimen
@cp $(OTF) $(PACK)/otf
@cp $(TTF) $(PACK)/ttf
# @cp $(PDF) $(PACK)/specimen #Temporarily out of order
@cp $(SPEC)/Specimen.pdf $(PACK)/specimen
@cp Changes README.markdown README.xelualatex COPYING $(PACK)
@zip -r $(PACK).zip $(PACK)
wpack: $(WOF)
@echo "Packing webfonts to zipfile"
@mkdir -p $(WPCK)
@cp $(WOF) README.markdown COPYING $(WPCK)
@zip -r $(WPCK).zip $(WPCK)
dist: $(OTF) $(TTF) $(WOF)
@echo "Making dist tarball"
@mkdir -p $(DIST)/$(SRC)
@mkdir -p $(DIST)/$(BLD)
@mkdir -p $(DIST)/$(WEB)
@mkdir -p $(DIST)/tools
@mkdir -p $(DIST)/$(SPEC)
@cp -r $(SFD) $(DIST)/$(SRC)
@cp $(OTF) $(TTF) $(DIST)/$(BLD)
# @cp $(PDF) $(SPEC)/Specimen.pdf $(DIST)/$(SPEC) #Temporarily out of order
@cp $(SPEC)/Specimen.pdf $(DIST)/$(SPEC)
@cp $(SCRIPT) $(DIST)/tools
@cp Changes Makefile README.md README.xelualatex COPYING $(DIST)
@zip -r $(DIST).zip $(DIST)
cleanpack:
@rm -rf $(PACK) $(PACK).zip $(WPCK) $(WPCK).zip
clean:
@rm -rf $(OTF) $(TTF) $(WOF) $(PDF) $(PACK) $(PACK).zip $(WPCK) $(WPCK).zip $(DIST) $(DIST).zip