Fix use of undefined value
[clawsker.git] / po / Makefile
1 #
2 # Clawsker po Makefile
3 # Copyright 2007-2016 Ricardo Mones <ricardo@mones.org>
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # See COPYING file for license details.
11 #
12
13 NAME = clawsker
14 VERSION = $(shell cat ../VERSION)
15 PREFIX ?= /usr/local
16 DATADIR = ${PREFIX}/share
17 LOCALEDIR = ${DATADIR}/locale
18
19 XG_ARGS = --keyword=_ --flag=_:1:pass-java-format -L Perl -w 80 --package-name=${NAME} --package-version=${VERSION} --msgid-bugs-address=ricardo@mones.org
20 LINGUAS = es fr it id nl pt_BR sv nb de ca tr
21
22 all: build
23
24 ${NAME}.pot.0:
25         xgettext ${XG_ARGS} -f ./POTFILES -d ${NAME} -o ./${NAME}.pot.0
26
27 # remove bogus entry win_title
28 update-pot: ${NAME}.pot.0
29         head -17 ./${NAME}.pot.0 > ./${NAME}.pot
30         tail -$(shell expr $(shell wc -l < ./${NAME}.pot.0) - 22 ) ./${NAME}.pot.0 >> ./${NAME}.pot
31         rm -f ./${NAME}.pot.0
32
33 %.pox: %.po
34         msgmerge -o $@ --previous $< ${NAME}.pot 
35
36 build:
37         for po in ${LINGUAS}; \
38         do msgfmt -v --statistics -c -o t-$${po} $${po}.po && mv -f t-$${po} $${po}.mo; \
39         done
40         
41
42 install: all install-dirs
43         for po in ${LINGUAS}; \
44         do install -m 0644 $${po}.mo ${DESTDIR}${LOCALEDIR}/$${po}/LC_MESSAGES/${NAME}.mo; \
45         done
46
47 install-dirs:
48         for po in ${LINGUAS}; \
49         do install -d ${DESTDIR}${LOCALEDIR}/$${po}/LC_MESSAGES; \
50         done
51
52 uninstall:
53         for po in ${LINGUAS}; \
54         do rm -f  ${DESTDIR}${LOCALEDIR}/$${po}/LC_MESSAGES/${NAME}.mo; \
55         done
56
57 clean-build:
58         rm -f *.mo
59
60 clean-pox:
61         rm -f *.pox
62
63 clean: clean-build
64         rm -f *~
65
66 .PHONY: all build install install-dirs uninstall clean clean-pox clean-build update-pot
67