summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/droid/Makefile
blob: 2dce7e326ac0695d06c73a501b25b903c68f73f9 (plain)
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
## Makefile
## Copyright 2010 Mohamed El Morabity
#
# This work may be distributed and/or modified under the conditions of the LaTeX
# Project Public License, either version 1.3 of this license or (at your option)
# any later version. The latest version of this license is in
# http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all
# distributions of LaTeX version 2005/12/01 or later.
#
# This work has the LPPL maintenance status `maintained'.
#
# The Current Maintainer of this work is Mohamed El Morabity
#
# This work consists of all files listed in manifest.txt.

######################
# Fonts informations #
######################

FONT_NAME = droid
FOUNDRY = public
FONT_CODES = fdr fds fdm

# Supported LaTeX encodings
SUPPORTED_ENCODINGS = ot1 t1 ts1 t2a t2b t2c x2 lgr
# Supported LaTeX encodings containing small caps
SUPPORTED_SC_ENCODINGS = $(filter-out ts1,$(SUPPORTED_ENCODINGS))
# Custom encodings provided
CUSTOM_ENCODINGS = $(FONT_NAME)-fixlatin $(FONT_NAME)-fixtextcomp $(FONT_NAME)-fixcyrillic $(FONT_NAME)-fixgreek


#####################
# Installation root #
#####################

TEXMFHOME = $(shell kpsexpand '$$TEXMFHOME')


###########
# Archive #
###########

ARCHIVE_ROOT = $(FONT_NAME)
ARCHIVE = $(FONT_NAME).zip


###########
# Sources #
###########

TRUETYPE_FILES = $(wildcard *.ttf)

# Fontinst files
FONTINST_FILE = $(FONT_NAME)-drv.tex
FONTINST_REGLYPH_FILE = $(FONT_NAME)-reglyph.tex
FONTINST_MAP_FILE = $(FONT_NAME)-map.tex

# Custom Fontinst encoding files
ETX_FILES = $(CUSTOM_ENCODINGS:=.etx)

STYLE_FILES = $(wildcard *.sty)

DOCUMENTATION = $(FONT_NAME).tex $(FONT_NAME).pdf README

# Files to be installed in texmf/source
BUILD_FILES = $(FONTINST_FILE) $(FONTINST_REGLYPH_FILE) $(FONTINST_MAP_FILE) $(ETX_FILES) Makefile ttf2type1.pe $(DOCUMENTATION)

# Source files to be installed
SOURCES_FILES = $(TRUETYPE_FILES) $(STYLE_FILES) $(BUILD_FILES) $(DOCUMENTATION)



###################
# Generated files #
###################

TYPE1_FILES = $(TRUETYPE_FILES:.ttf=.pfb)
AFM_FILES = $(TYPE1_FILES:.pfb=.afm)

# Fontinst log file
FONTINST_REC_FILE = $(FONT_NAME)-rec.tex

# Metrics files
PL_FILES = $(foreach e,$(SUPPORTED_ENCODINGS) $(CUSTOM_ENCODINGS:$(FONT_NAME)-%=%), \
             $(foreach f,$(TRUETYPE_FILES:.ttf=),                                   \
               raw-$(e)-$(f).pl                                                     \
             )                                                                      \
             $(foreach f,$(filter-out %Italic,$(TRUETYPE_FILES:.ttf=)),             \
               raw-$(e)-$(f)-Slanted.pl                                             \
             )                                                                      \
             $(foreach f,$(filter DroidSerif%Italic,$(TRUETYPE_FILES:.ttf=)),       \
               raw-$(e)-$(f)-Upright.pl                                             \
             )                                                                      \
           )
TMP_MTX_FILES = $(PL_FILES:%.pl=%.mtx) $(PL_FILES:raw-%.pl=%.mtx)
VPL_FILES = $(foreach f,$(TRUETYPE_FILES:.ttf=),                             \
              $(foreach e,$(SUPPORTED_ENCODINGS),                            \
                $(e)-$(f).vpl                                                \
              )                                                              \
              $(foreach e,$(SUPPORTED_SC_ENCODINGS),                         \
                $(e)-$(f)-SmallCaps.vpl                                      \
              )                                                              \
            )                                                                \
            $(foreach f,$(filter-out %Italic,$(TRUETYPE_FILES:.ttf=)),       \
              $(foreach e,$(SUPPORTED_ENCODINGS),                            \
                $(e)-$(f)-Slanted.vpl                                        \
              )                                                              \
              $(foreach e,$(SUPPORTED_SC_ENCODINGS),                         \
                $(e)-$(f)-Slanted-SmallCaps.vpl                              \
              )                                                              \
            )                                                                \
            $(foreach f,$(filter DroidSerif%Italic,$(TRUETYPE_FILES:.ttf=)), \
              $(foreach e,$(SUPPORTED_ENCODINGS),                            \
                $(e)-$(f)-Upright.vpl                                        \
              )                                                              \
              $(foreach e,$(SUPPORTED_SC_ENCODINGS),                         \
                $(e)-$(f)-Upright-SmallCaps.vpl                              \
              )                                                              \
            )
TFM_FILES = $(PL_FILES:.pl=.tfm) $(VPL_FILES:.vpl=.tfm)
VF_FILES = $(VPL_FILES:.vpl=.vf)

MAP = $(FONT_NAME).map

# Font definition files
FD_FILES = $(foreach e,$(SUPPORTED_ENCODINGS), \
             $(foreach f,$(FONT_CODES),        \
               $(e)$(f).fd                     \
             )                                 \
           )

# Generated encoding files
ENC_FILES = $(SUPPORTED_ENCODINGS:%=$(FONT_NAME)-%.enc) $(CUSTOM_ENCODINGS:$(FONT_NAME)-%=$(FONT_NAME)-%.enc)

# Generated files to be installed
GENERATED_FILES = $(TYPE1_FILES) $(AFM_FILES) $(TFM_FILES) $(VF_FILES) $(MAP) $(FD_FILES) $(ENC_FILES)




default: all


all: dist


dist: $(ARCHIVE)


%.pfb %.afm: %.ttf
	fontforge ttf2type1.pe $<


%.tfm: %.pl
	pltotf $< $@


%.tfm: %.vpl
	vptovf $^ $


%.vf: %.vpl
	vptovf $^ $@


$(FONTINST_REC_FILE): $(TYPE1_FILES) $(AFM_FILES) $(ETX_FILES) $(FONTINST_FILE) $(FONTINST_REGLYPH_FILE)
	latex $(FONTINST_FILE)


$(PL_FILES) $(VPL_FILES): $(FONTINST_REC_FILE)


$(MAP): $(FONTINST_REC_FILE) $(FONTINST_MAP_FILE)
	latex $(FONTINST_MAP_FILE)


$(FD_FILES) $(ENC_FILES): $(MAP)


texmf-tree: clean-texmf-tree $(GENERATED_FILES) $(SOURCES_FILES)
	mkdir -p $(ARCHIVE_ROOT)/doc/latex/$(FONT_NAME)/
	mkdir -p $(ARCHIVE_ROOT)/tex/latex/$(FONT_NAME)/
	mkdir -p $(ARCHIVE_ROOT)/fonts/{enc,map}/dvips/$(FONT_NAME)/
	mkdir -p $(ARCHIVE_ROOT)/fonts/{afm,tfm,truetype,type1,vf}/$(FOUNDRY)/$(FONT_NAME)/
	mkdir -p $(ARCHIVE_ROOT)/source/$(FONT_NAME)/
	cp -p $(DOCUMENTATION) $(ARCHIVE_ROOT)/doc/latex/$(FONT_NAME)/
	cp -p $(FD_FILES) $(STYLE_FILES) $(ARCHIVE_ROOT)/tex/latex/$(FONT_NAME)/
	cp -p $(ENC_FILES) $(ARCHIVE_ROOT)/fonts/enc/dvips/$(FONT_NAME)/
	cp -p $(MAP) $(ARCHIVE_ROOT)/fonts/map/dvips/$(FONT_NAME)/
	cp -p $(AFM_FILES) $(ARCHIVE_ROOT)/fonts/afm/$(FOUNDRY)/$(FONT_NAME)/
	cp -p $(TFM_FILES) $(ARCHIVE_ROOT)/fonts/tfm/$(FOUNDRY)/$(FONT_NAME)/
	cp -p $(TRUETYPE_FILES) $(ARCHIVE_ROOT)/fonts/truetype/$(FOUNDRY)/$(FONT_NAME)/
	cp -p $(TYPE1_FILES) $(ARCHIVE_ROOT)/fonts/type1/$(FOUNDRY)/$(FONT_NAME)/
	cp -p $(VF_FILES) $(ARCHIVE_ROOT)/fonts/vf/$(FOUNDRY)/$(FONT_NAME)/
	cp -p $(BUILD_FILES) $(ARCHIVE_ROOT)/source/$(FONT_NAME)/
	cp -p README $(ARCHIVE_ROOT)
	cd $(ARCHIVE_ROOT) && find . -type f > manifest.txt


$(ARCHIVE): clean-texmf-tree texmf-tree
	zip -r $@ $(ARCHIVE_ROOT)


install: texmf-tree
	mkdir -p $(TEXMFHOME)
	cp -a $(ARCHIVE_ROOT)/* $(TEXMFHOME)
	texhash
	updmap --enable Map=$(MAP)


uninstall:
	$(RM) -r $(TEXMFHOME)/doc/latex/$(FONT_NAME)/
	$(RM) -r $(TEXMFHOME)/tex/latex/$(FONT_NAME)/
	$(RM) -r $(TEXMFHOME)/fonts/{enc,map}/dvips/$(FONT_NAME)/
	$(RM) -r $(TEXMFHOME)/fonts/{afm,tfm,truetype,type1,vf}/$(FOUNDRY)/$(FONT_NAME)/
	$(RM) -r $(TEXMFHOME)/source/$(FONT_NAME)/
	updmap --disable $(MAP)
	texhash


clean: clean-texmf-tree
	$(RM) $(TYPE1_FILES) $(AFM_FILES)
	$(RM) $(FONTINST_REC_FILE)
	$(RM) $(PL_FILES) $(TYPE1_FILES:.pfb=.pl)
	$(RM) $(TMP_MTX_FILES) $(TYPE1_FILES:.pfb=.mtx)
	$(RM) $(VPL_FILES)
	$(RM) $(TFM_FILES)
	$(RM) $(VF_FILES)
	$(RM) $(MAP)
	$(RM) $(FD_FILES)
	$(RM) $(ENC_FILES)
	$(RM) $(ARCHIVE)
	$(RM) *~ *.log


clean-texmf-tree:
	$(RM) -r $(ARCHIVE_ROOT)


.PHONY: clean clean-texmf-tree texmf-tree