-
Notifications
You must be signed in to change notification settings - Fork 90
/
Makefile
107 lines (82 loc) · 3.45 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
# Copyright 2013 Google Inc. All Rights Reserved
# Author: [email protected] (Sudhakar "Thaths" Chandra)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
TAR=$(shell which tar)
ZIP=$(shell which zip)
RM=$(shell which rm)
LN=$(shell which ln)
MKDIR=$(shell which mkdir)
SCALETOOL=./nototools/scale.py
SUBSETTOOL=./nototools/subset.py
TODAY=$(shell date "+%Y-%m-%d")
TARBALLDIR=packages
ZIPDIR=packages-zip
ANDROIDDIR=packages/android
CROSDIR=packages/cros
HINTEDFONTDIR=../noto-fonts/hinted
UNHINTEDFONTDIR=../noto-fonts/unhinted
UNHINTEDFONTS=$(shell find $(UNHINTEDFONTDIR) -name "*.ttf")
ANDROIDFONTS=$(UNHINTEDFONTS:$(UNHINTEDFONTDIR)/%=$(ANDROIDDIR)/%)
HINTEDFONTS=$(shell find $(HINTEDFONTDIR) -name "*.ttf")
CROSFONTS=$(HINTEDFONTS:$(HINTEDFONTDIR)/%=$(CROSDIR)/%)
all: tarball zip
$(TARBALLDIR) $(ZIPDIR):
$(MKDIR) -p $@
tarball: hintedtarball unhintedtarball
hintedtarball: $(HINTEDFONTDIR)/*.ttf cleanhintedtarball $(TARBALLDIR)
$(TAR) zcvf $(TARBALLDIR)/NotoFonts-hinted-$(TODAY).tgz $(HINTEDFONTDIR)/Noto*.ttf LICENSE
cd $(TARBALLDIR); ln -s NotoFonts-hinted-$(TODAY).tgz NotoFonts-hinted-latest.tgz
unhintedtarball: $(UNHINTEDFONTDIR)/*.ttf cleanunhintedtarball $(TARBALLDIR)
$(TAR) zcvf $(TARBALLDIR)/NotoFonts-unhinted-$(TODAY).tgz $(UNHINTEDFONTDIR)/Noto*.ttf LICENSE
cd $(TARBALLDIR); ln -s NotoFonts-unhinted-$(TODAY).tgz NotoFonts-unhinted-latest.tgz
zip: hintedzip unhintedzip
hintedzip: $(HINTEDFONTDIR)/*.ttf cleanhintedzip $(ZIPDIR)
$(ZIP) $(ZIPDIR)/NotoFonts-hinted-$(TODAY).zip $(HINTEDFONTDIR)/Noto*.ttf LICENSE
cd $(ZIPDIR); ln -s NotoFonts-hinted-$(TODAY).zip NotoFonts-hinted-latest.zip
unhintedzip: $(UNHINTEDFONTDIR)/*.ttf cleanunhintedzip $(ZIPDIR)
$(ZIP) $(ZIPDIR)/NotoFonts-unhinted-$(TODAY).zip $(UNHINTEDFONTDIR)/Noto*.ttf LICENSE
cd $(ZIPDIR); ln -s NotoFonts-unhinted-$(TODAY).zip NotoFonts-unhinted-latest.zip
android: $(ANDROIDFONTS)
$(ANDROIDDIR)/%.ttf: $(UNHINTEDFONTDIR)/%.ttf
@$(MKDIR) -p $(ANDROIDDIR)
@echo Compressing $(notdir $<)
@if [[ $< == *"TamilUI"* || $< == *"MalayalamUI"* ]]; then \
subsetted=$$(mktemp); \
$(SUBSETTOOL) $< $$subsetted; \
echo Scaling $(notdir $<); \
$(SCALETOOL) 0.9 $$subsetted $@; \
else \
$(SUBSETTOOL) $< $@; \
fi
cros: $(CROSFONTS)
$(CROSDIR)/%.ttf: $(HINTEDFONTDIR)/%.ttf
@$(MKDIR) -p $(CROSDIR)
$(SUBSETTOOL) $< $@; \
clean: cleantarball cleanzip
cleantarball: cleanhintedtarball cleanunhintedtarball
cleanhintedtarball:
$(RM) -f $(TARBALLDIR)/NotoFonts-hinted-$(TODAY).tgz
$(RM) -f $(TARBALLDIR)/NotoFonts-hinted-latest.tgz
cleanunhintedtarball:
$(RM) -f $(TARBALLDIR)/NotoFonts-unhinted-$(TODAY).tgz
$(RM) -f $(TARBALLDIR)/NotoFonts-unhinted-latest.tgz
cleanzip: cleanhintedzip cleanunhintedzip
cleanhintedzip:
$(RM) -f $(ZIPDIR)/NotoFonts-hinted-$(TODAY).zip
$(RM) -f $(ZIPDIR)/NotoFonts-hinted-latest.zip
cleanunhintedzip:
$(RM) -f $(ZIPDIR)/NotoFonts-unhinted-$(TODAY).zip
$(RM) -f $(ZIPDIR)/NotoFonts-unhinted-latest.zip
cleanandroid:
$(RM) -rf $(ANDROIDDIR)