-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
157 lines (128 loc) · 3.63 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Project directories
BUILD_DIR := build
REPORTS_DIR := reports
SCRIPTS_DIR := scripts
SOURCES_DIR := sources
# Font sources
LILEX_ROMAN_SOURCE = $(SOURCES_DIR)/Lilex.glyphs
LILEX_ITALIC_SOURCE = $(SOURCES_DIR)/Lilex-Italic.glyphs
# Internal build variables
OS := $(shell uname)
VENV_DIR = ./venv
VENV = . $(VENV_DIR)/bin/activate;
define build-font
@$(VENV) python $(SCRIPTS_DIR)/font.py \
build $(1)
endef
define check-font
$(VENV) fontbakery check-$(2) \
--auto-jobs \
--full-lists \
--html "$(REPORTS_DIR)/$(2)_$(1).html" \
-x com.google.fonts/check/fontdata_namecheck \
"$(BUILD_DIR)/$(1)/"*
endef
define check-ttf-file
$(VENV) fontbakery check-$(2) \
--auto-jobs \
--html "$(REPORTS_DIR)/$(2)_$(1).html" \
-x com.google.fonts/check/fontdata_namecheck \
"$(BUILD_DIR)/ttf/Lilex-$(1).ttf"
endef
.PHONY: help
help: ## print this message
@awk \
'BEGIN {FS = ":.*?## "} \
/^[a-zA-Z_-]+:.*?## / \
{printf "\033[33m%-20s\033[0m %s\n", $$1, $$2}' \
$(MAKEFILE_LIST)
.PHONY: configure
configure: requirements.txt ## setup build environment
@rm -rf $(VENV_DIR)
@make $(VENV_DIR)
@$(VENV) python -m youseedee A > /dev/null
.PHONY: configure
configure-preview: ## setup preview environment
@cd preview; pnpm install
.PHONY: print-updates
print-updates: ## print list of outdated packages
@$(VENV) pip list --outdated
@cd preview; pnpm outdated
.PHONY: check
check: clean-reports ## check font quality
@$(call check-font,"ttf","googlefonts")
@$(call check-font,"variable","googlefonts")
.PHONY: check-sequential
check-sequential: clean-reports ## check each font file quality
@$(call check-ttf-file,"Bold","googlefonts")
@$(call check-ttf-file,"ExtraLight","googlefonts")
@$(call check-ttf-file,"Medium","googlefonts")
@$(call check-ttf-file,"Regular","googlefonts")
@$(call check-ttf-file,"Thin","googlefonts")
@$(call check-font,"variable","googlefonts")
.PHONY: lint
lint: ## check code quality
$(VENV) ruff check $(SCRIPTS_DIR)/
$(VENV) pylint $(SCRIPTS_DIR)/
cd preview; pnpm eslint 'src/**/*.{svlete,ts}'
.PHONY: preview
preview: ## show CLI special symbols preview
@$(VENV) python $(SCRIPTS_DIR)/show.py
.PHONY: generate
generate: ## regenerate the font sources with classes and features
@$(VENV) python $(SCRIPTS_DIR)/font.py \
--config "sources/family_config.yaml" \
generate
.PHONY: build
build: ## build the font
@make clean-build
@$(call build-font)
.PHONY: build-preview
build-preview: ## build the preview
cd preview; pnpm run build
.PHONY: run-preview
run-preview: ## run the preview
cd preview; pnpm run dev
.PHONY: release
release:
@make build
.PHONY: release-notes
release-notes:
echo $(ARGS)
# @mkdir -p ./$(BUILD_DIR)
# $(VENV) python ./scripts/changelog.py notes Next > "./$(BUILD_DIR)/release-notes.md"
.PHONY: clean
clean: ## clean up
@make clean-build
@make clean-reports
.PHONY: clean-build
clean-build: ## clean up build artifacts
@rm -rf "$(BUILD_DIR)"
.PHONY: clean-reports
clean-reports: ## clean up reports
@rm -rf "$(REPORTS_DIR)"
@mkdir "$(REPORTS_DIR)"
.PHONY: ttf
ttf: ## build ttf font
$(call build-font,ttf)
.PHONY: otf
otf: ## build otf font
$(call build-font,otf)
.PHONY: variable
variable: ## build variable font
$(call build-font,variable)
.PHONY: install
install: ## install font to system (macOS and Linux only)
@make install-$(OS)
.PHONY: install-Darwin
install-Darwin:
@rm -rf ~/Library/Fonts/Lilex
@cp -r build/variable ~/Library/Fonts/Lilex
install-Linux:
@rm -rf ~/.fonts/Lilex
@cp -r build/ttf ~/.fonts/Lilex
$(VENV_DIR): requirements.txt
@rm -rf "$(VENV_DIR)"
@python3.11 -m venv "$(VENV_DIR)"
@$(VENV) pip install wheel
@$(VENV) pip install -r requirements.txt