bsd.nls.mk revision 142666
1# $FreeBSD: head/share/mk/bsd.nls.mk 142666 2005-02-27 16:36:54Z phantom $
2#
3# This include file <bsd.nls.mk> handles building and installing Native
4# Language Support (NLS) catalogs
5#
6# +++ variables +++
7#
8# GENCAT	A program for converting .msg files into compiled NLS
9#		.cat files. [gencat -new]
10#
11# NLS		Source or intermediate .msg files. [set in Makefile]
12#
13# NLSDIR	Base path for National Language Support files
14#		installation. [${SHAREDIR}/nls]
15#
16# NLSGRP	National Language Support files group. [${SHAREGRP}]
17#
18# NLSMODE	National Language Support files mode. [${NOBINMODE}]
19#
20# NLSOWN	National Language Support files owner. [${SHAREOWN}]
21#
22# NO_NLS	Do not make or install NLS files. [not set]
23
24.if !target(__<bsd.init.mk>__)
25.error bsd.nls.mk cannot be included directly.
26.endif
27
28GENCAT?=	gencat
29
30.SUFFIXES: .cat .msg
31
32.msg.cat:
33	${GENCAT} ${.TARGET} ${.IMPSRC}
34
35.if defined(NLS) && !empty(NLS) && !defined(NO_NLS)
36
37#
38# .msg file pre-build rules
39#
40NLSSRCDIR?=	${.CURDIR}
41.for file in ${NLS}
42.if defined(NLSSRCFILES)
43NLSSRCFILES_${file}?= ${NLSSRCFILES}
44.endif
45.if defined(NLSSRCFILES_${file})
46NLSSRCDIR_${file}?= ${NLSSRCDIR}
47${file}.msg: ${NLSSRCFILES_${file}:S/^/${NLSSRCDIR_${file}}\//}
48	@rm -f ${.TARGET}
49	cat ${.ALLSRC} > ${.TARGET}
50CLEANFILES+= ${file}.msg
51.endif
52.endfor
53
54#
55# .cat file build rules
56#
57NLS:=		${NLS:=.cat}
58CLEANFILES+=	${NLS}
59FILESGROUPS?=	FILES
60FILESGROUPS+=	NLS
61NLSDIR?=	${SHAREDIR}/nls
62
63#
64# installation rules
65#
66.for file in ${NLS}
67NLSNAME_${file:T}= ${file:T:R}/${NLSNAME}.cat
68.if defined(NLSLINKS_${file:R}) && !empty(NLSLINKS_${file:R})
69NLSLINKS+=	${file:R}
70.endif
71.for dst in ${NLSLINKS_${file:R}}
72SYMLINKS+=	../${file:R}/${NLSNAME}.cat ${NLSDIR}/${dst}/${NLSNAME}.cat
73.endfor
74.endfor
75
76.endif defined(NLS) && !empty(NLS) && !defined(NO_NLS)
77