191621Sphantom# $FreeBSD$
291621Sphantom#
391621Sphantom# This include file <bsd.nls.mk> handles building and installing Native
491621Sphantom# Language Support (NLS) catalogs
591621Sphantom#
691621Sphantom# +++ variables +++
791621Sphantom#
891621Sphantom# GENCAT	A program for converting .msg files into compiled NLS
9143378Sphantom#		.cat files. [gencat]
1091621Sphantom#
1191621Sphantom# NLS		Source or intermediate .msg files. [set in Makefile]
1291621Sphantom#
1391621Sphantom# NLSDIR	Base path for National Language Support files
1491621Sphantom#		installation. [${SHAREDIR}/nls]
1591621Sphantom#
1691621Sphantom# NLSGRP	National Language Support files group. [${SHAREGRP}]
1791621Sphantom#
1891621Sphantom# NLSMODE	National Language Support files mode. [${NOBINMODE}]
1991621Sphantom#
2091621Sphantom# NLSOWN	National Language Support files owner. [${SHAREOWN}]
2191621Sphantom
2299257Sru.if !target(__<bsd.init.mk>__)
2399257Sru.error bsd.nls.mk cannot be included directly.
2499257Sru.endif
2594940Sru
26142666SphantomGENCAT?=	gencat
2791621Sphantom
2891621Sphantom.SUFFIXES: .cat .msg
2991621Sphantom
3091621Sphantom.msg.cat:
3191621Sphantom	${GENCAT} ${.TARGET} ${.IMPSRC}
3291621Sphantom
33156813Sru.if defined(NLS) && !empty(NLS) && ${MK_NLS} != "no"
3499257Sru
3591621Sphantom#
3691621Sphantom# .msg file pre-build rules
3791621Sphantom#
3899257SruNLSSRCDIR?=	${.CURDIR}
3991621Sphantom.for file in ${NLS}
4099257Sru.if defined(NLSSRCFILES)
4199257SruNLSSRCFILES_${file}?= ${NLSSRCFILES}
4291628Sphantom.endif
4391621Sphantom.if defined(NLSSRCFILES_${file})
4499257SruNLSSRCDIR_${file}?= ${NLSSRCDIR}
4599257Sru${file}.msg: ${NLSSRCFILES_${file}:S/^/${NLSSRCDIR_${file}}\//}
4691621Sphantom	@rm -f ${.TARGET}
4799257Sru	cat ${.ALLSRC} > ${.TARGET}
4899257SruCLEANFILES+= ${file}.msg
4991621Sphantom.endif
5091621Sphantom.endfor
5191621Sphantom
5291621Sphantom#
5391621Sphantom# .cat file build rules
5491621Sphantom#
5599257SruNLS:=		${NLS:=.cat}
5699257SruCLEANFILES+=	${NLS}
5799257SruFILESGROUPS?=	FILES
5899257SruFILESGROUPS+=	NLS
5999257SruNLSDIR?=	${SHAREDIR}/nls
6091621Sphantom
6191621Sphantom#
6291621Sphantom# installation rules
6391621Sphantom#
6499257Sru.for file in ${NLS}
6599257SruNLSNAME_${file:T}= ${file:T:R}/${NLSNAME}.cat
6699257Sru.if defined(NLSLINKS_${file:R}) && !empty(NLSLINKS_${file:R})
6799257SruNLSLINKS+=	${file:R}
6899257Sru.endif
6999257Sru.for dst in ${NLSLINKS_${file:R}}
7099257SruSYMLINKS+=	../${file:R}/${NLSNAME}.cat ${NLSDIR}/${dst}/${NLSNAME}.cat
7191621Sphantom.endfor
7291632Sphantom.endfor
7391632Sphantom
74156813Sru.endif # defined(NLS) && !empty(NLS) && ${MK_NLS} != "no"
75