Makefile 1.33 KB
Newer Older
1 2
XGETTEXT=	xgettext -L PHP --from-code=UTF-8 -F --strict --debug
XGETTEXT_PL=	xgettext.pl -P Locale::Maketext::Extract::Plugin::Volt \
3
		-u -w -W
4 5
MSGMERGE=	msgmerge -U -N --backup=off
MSGFMT=		msgfmt --strict
6

7 8 9
PERL_DIR=	/usr/local/lib/perl5/site_perl
PERL_NAME=	Locale/Maketext/Extract/Plugin

10 11
LOCALEDIR=	/usr/local/share/locale/%%LANG%%/LC_MESSAGES

12
# stable
13
LANGUAGES=	de_DE fr_FR ja_JP zh_CN
14
# devel
15
LANGUAGES+=	es_CO mn_MN
16

17
TEMPLATE=	en_US
18
INSTALL=
19
MERGE=
20
PLIST=
21

22 23 24 25 26 27
PAGER?=		less

all:
	@cat ${.CURDIR}/README.md | ${PAGER}


28 29
.for LANG in ${LANGUAGES}
${LANG}DIR=	${LOCALEDIR:S/%%LANG%%/${LANG}/g}
30
install-${LANG}:
31
	@mkdir -p ${DESTDIR}${${LANG}DIR}
32 33 34
	${MSGFMT} -o ${DESTDIR}${${LANG}DIR}/OPNsense.mo ${LANG}.po

plist-${LANG}:
35
	@echo ${${LANG}DIR}/OPNsense.mo
36

37 38 39
merge-${LANG}:
	${MSGMERGE} ${LANG}.po ${TEMPLATE}.pot

40 41
INSTALL+=	install-${LANG}
PLIST+=		plist-${LANG}
42
MERGE+=		merge-${LANG}
43 44 45
.endfor

${TEMPLATE}:
46
	@cp ${.CURDIR}/Volt.pm ${PERL_DIR}/${PERL_NAME}/
47
	@: > ${TEMPLATE}.pot
48 49
	cd ${.CURDIR}/.. && \
	    ${XGETTEXT_PL} -D src -p ${.CURDIR} -o ${TEMPLATE}.pot
50
	cd ${.CURDIR}/.. && find src lang/dynamic/helpers | \
51 52 53
	    xargs ${XGETTEXT} -j -o ${.CURDIR}/${TEMPLATE}.pot

template: ${TEMPLATE}
54 55
install: ${INSTALL}
plist: ${PLIST}
56
merge: ${MERGE}
57

58 59 60
dynamic:
	@${.CURDIR}/dynamic/collect.py ${.CURDIR}/..

61
.PHONY: ${INSTALL} ${PLIST} ${MERGE} ${TEMPLATE} dynamic