1# 2# Clawsker po Makefile 3# Copyright 2007-2021 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 13NAME = clawsker 14TITLE = \# Translatable strings for Clawsker 15COPYR = \# Copyright (C) 2007 Ricardo Mones <ricardo@mones.org> 16VERSION ?= $(shell git describe) 17PREFIX ?= /usr/local 18DATADIR = ${PREFIX}/share 19LOCALEDIR = ${DATADIR}/locale 20 21XG_ARGS = --keyword=_ --flag=_:1:pass-java-format -L Perl -w 80 --package-name=${NAME} --package-version=${VERSION} --msgid-bugs-address=ricardo@mones.org --from-code=UTF-8 22LINGUAS = es fr nl pt_BR sv nb de ca tr da zh_TW pt_PT 23 24all: build 25 26${NAME}.pot.0: 27 xgettext ${XG_ARGS} -f ./POTFILES -d ${NAME} -o $@ 28 29# remove bogus entry about_title 30${NAME}.pot.1: ${NAME}.pot.0 31 head -17 $< > $@ 32 tail -$(shell expr $(shell wc -l < $<) - 22 ) $< >> $@ 33 rm -f $< 34 35update-pot: ${NAME}.pot.1 36 sed 's,^# SOME DESC.*,${TITLE},;s,^# Copyright.*,${COPYR},' < $< > ${NAME}.pot 37 rm -f $< 38 39%.pox: %.po 40 msgmerge -o $@ --previous $< ${NAME}.pot 41 42build: 43 for po in ${LINGUAS}; \ 44 do msgfmt -v --statistics -c -o t-$${po} $${po}.po && mv -f t-$${po} $${po}.mo; \ 45 done 46 47 48install: all install-dirs 49 for po in ${LINGUAS}; \ 50 do install -m 0644 $${po}.mo ${DESTDIR}${LOCALEDIR}/$${po}/LC_MESSAGES/${NAME}.mo; \ 51 done 52 53install-dirs: 54 for po in ${LINGUAS}; \ 55 do install -d ${DESTDIR}${LOCALEDIR}/$${po}/LC_MESSAGES; \ 56 done 57 58uninstall: 59 for po in ${LINGUAS}; \ 60 do rm -f ${DESTDIR}${LOCALEDIR}/$${po}/LC_MESSAGES/${NAME}.mo; \ 61 done 62 63clean-build: 64 rm -f *.mo 65 66clean-pox: 67 rm -f *.pox 68 69clean: clean-build 70 rm -f *~ 71 72.PHONY: all build install install-dirs uninstall clean clean-pox clean-build update-pot 73 74