summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 16bf68fb21f837966bd4b288372205916109466a (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
#!/usr/bin/make -f

fontpath=/usr/share/fonts/truetype/malayalam
fonts=AnjaliOldLipi Dyuthi Kalyani Meera Rachana RaghuMalayalamSans Suruma

version = 6.1

default: clean compile
all: clean compile test webfonts

compile:
# generate ttf files from sfd files
	@for font in `echo ${fonts}`;do \
		./generate.pe $${font}/$${font}.sfd; \
	done;

install: compile
# copy ttf files to system font directory
	@for font in `echo ${fonts}`;do \
		install -D -m 0644  $${font}/$${font}.ttf \
			${DESTDIR}/${fontpath}/$${font}.ttf;\
	done;

# copy fontconfig configuration files to system fontconfig
# configuration directory
	install -D -m 0644 malayalam-fonts.conf\
	 	${DESTDIR}/etc/fonts/conf.avail/67-malayalam-fonts.conf
	if [ ! -d ${DESTDIR}/etc/fonts/conf.d ]; then\
		mkdir ${DESTDIR}/etc/fonts/conf.d; \
	fi;

	ln -sf ../conf.avail/67-malayalam-fonts.conf\
		${DESTDIR}/etc/fonts/conf.d/67-malayalam-fonts.conf

uninstall:
# remove fonts from system font directories
	@for font in `echo ${fonts}`;do \
		if [ -f ${DESTDIR}/${fontpath}/$${font}.ttf ]; then\
			rm -f ${DESTDIR}/${fontpath}/$${font}.ttf;\
		fi \
	done;

# remove fontconfig configuration files from system fontconfig
# configuration directory
	if [ -f ${DESTDIR}/etc/fonts/conf.d/67-malayalam-fonts.conf ]; then \
	rm ${DESTDIR}/etc/fonts/conf.d/67-malayalam-fonts.conf; fi

	if [ -f ${DESTDIR}/etc/fonts/conf.avail/67-malayalam-fonts.conf ];then \
		rm ${DESTDIR}/etc/fonts/conf.avail/67-malayalam-fonts.conf;\
	fi

	if [ -d ${DESTDIR}/${fontpath} -a -z "$(ls -A ${DESTDIR}/${fontpath})" ];\
	then \
		rmdir ${DESTDIR}/${fontpath};\
	fi

clean:
# remove ttf fonts
	@for font in `echo ${fonts}`;do \
		if [ -f $${font}/$${font}.ttf ];then\
			rm -f $${font}/$${font}.ttf;\
		fi \
	done;
	@rm -rf tests/*.pdf webfonts sdist ignore-file;

test: compile
# Test the fonts
	@for font in `echo ${fonts}`;do \
		echo "Testing font $${font}";\
		hb-view $${font}/$${font}.ttf --debug\
		 --text-file tests/tests.txt --output-file tests/$${font}.pdf; \
	done

webfonts: compile
	@echo "Generating webfonts"
	@for font in `echo ${fonts}`;do \
		mkdir -p webfonts/$${font}; \
		sfntly -w $${font}/$${font}.ttf\
			webfonts/$${font}/$${font}.woff; \
		sfntly -e -x $${font}/$${font}.ttf\
		 webfonts/$${font}/$${font}.eot; \
		echo "Webfonts generated for $${font}"; \
	done
sdist: $(fonts) ChangeLog Makefile generate.pe malayalam-fonts.conf
	echo ".git\nignore-file" > ignore-file
	tar --owner root --group root --mode a+rX \
		-X ignore-file -cvf - . | xz -9 >\
		 ../malayalam-fonts-$(version).tar.xz
	touch "$@"