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