Makefile 1.92 KB
Newer Older
Santhosh Thottingal's avatar
Santhosh Thottingal committed
1 2
#!/usr/bin/make -f

3 4 5
NAME=Manjari
FONTS=Regular Bold Thin
INSTALLPATH=/usr/share/fonts/opentype/malayalam
6 7
PY=python3
version=`cat VERSION`
8 9 10 11
TOOLDIR=tools
SRCDIR=sources
webfontscript=$(TOOLDIR)/webfonts.py
designspace=$(SRCDIR)/Manjari.designspace
Santhosh Thottingal's avatar
Santhosh Thottingal committed
12
tests=tests
13 14
BLDDIR=build
default: otf
15
all: clean lint otf ttf webfonts test
16 17 18
OTF=$(FONTS:%=$(BLDDIR)/$(NAME)-%.otf)
TTF=$(FONTS:%=$(BLDDIR)/$(NAME)-%.ttf)
WOFF2=$(FONTS:%=$(BLDDIR)/$(NAME)-%.woff2)
Santhosh Thottingal's avatar
Santhosh Thottingal committed
19 20 21
PDFS=$(FONTS:%=$(BLDDIR)/$(NAME)-%-ligatures.pdf)  \
	$(FONTS:%=$(BLDDIR)/$(NAME)-%-content.pdf)  \
	$(FONTS:%=$(BLDDIR)/$(NAME)-%-numbers.pdf)
22 23 24

$(BLDDIR)/%.otf: $(SRCDIR)/%.ufo
	@echo "  BUILD    $(@F)"
Santhosh Thottingal's avatar
Santhosh Thottingal committed
25
	@fontmake --verbose=WARNING -o otf --output-dir $(BLDDIR) -u $<
26 27 28

$(BLDDIR)/%.ttf: $(SRCDIR)/%.ufo
	@echo "  BUILD    $(@F)"
Santhosh Thottingal's avatar
Santhosh Thottingal committed
29
	@fontmake --verbose=WARNING -o ttf --output-dir $(BLDDIR) -u $<
Santhosh Thottingal's avatar
Santhosh Thottingal committed
30

Santhosh Thottingal's avatar
Santhosh Thottingal committed
31
$(BLDDIR)/%.woff2: $(BLDDIR)/%.otf
32
	@echo "WEBFONT    $(@F)"
33
	@fonttools ttLib.woff2 compress  $<
34

Santhosh Thottingal's avatar
Santhosh Thottingal committed
35
 $(BLDDIR)/%-ligatures.pdf: $(BLDDIR)/%.ttf
36 37
	@echo "   TEST    $(@F)"
	@hb-view $< --font-size 14 --margin 100 --line-space 1.5 \
Santhosh Thottingal's avatar
Santhosh Thottingal committed
38
		--foreground=333333 --text-file $(tests)/ligatures.txt \
39 40
		--output-file $(BLDDIR)/$(@F);

Santhosh Thottingal's avatar
Santhosh Thottingal committed
41 42 43 44 45 46 47 48 49 50 51 52
$(BLDDIR)/%-content.pdf: $(BLDDIR)/%.ttf
	@echo "   TEST    $(@F)"
	@hb-view $< --font-size 14 --margin 100 --line-space 1.5 \
		--foreground=333333 --text-file $(tests)/content.txt \
		--output-file $(BLDDIR)/$(@F);

$(BLDDIR)/%-numbers.pdf: $(BLDDIR)/%.ttf
	@echo "   TEST    $(@F)"
	@hb-view $< --font-size 14 --margin 100 --line-space 1.5 \
		--foreground=333333 --text-file $(tests)/numbers.txt \
		--features="tnum" --output-file $(BLDDIR)/$(@F);

53 54 55
ttf: $(TTF)
otf: $(OTF)
webfonts: $(WOFF2)
56
lint: ufonormalizer ufolint
57 58
ufolint: $(SRCDIR)/*.ufo
	$@ $^
59 60 61 62 63 64

ufonormalizer: $(SRCDIR)/*.ufo
	@for variant in $^;do \
		ufonormalizer -m $$variant;\
	done;

65 66 67 68
install: otf
	@mkdir -p ${DESTDIR}${INSTALLPATH}
	install -D -m 0644 $(BLDDIR)/*.otf ${DESTDIR}${INSTALLPATH}/

Santhosh Thottingal's avatar
Santhosh Thottingal committed
69
test: otf $(PDFS)
70

Santhosh Thottingal's avatar
Santhosh Thottingal committed
71
clean:
72
	@rm -rf $(BLDDIR)