bsd.nls.mk revision 91621
1#	Based on $NetBSD: bsd.nls.mk,v 1.35 2001/11/28 20:19:08 tv Exp $
2# $FreeBSD: head/share/mk/bsd.nls.mk 91621 2002-03-04 09:50:28Z phantom $
3#
4# This include file <bsd.nls.mk> handles building and installing Native
5# Language Support (NLS) catalogs
6#
7# +++ variables +++
8#
9# GENCAT	A program for converting .msg files into compiled NLS
10#		.cat files. [gencat -new]
11#
12# NLS		Source or intermediate .msg files. [set in Makefile]
13#
14# NLSDIR	Base path for National Language Support files
15#		installation. [${SHAREDIR}/nls]
16#
17# NLSGRP	National Language Support files group. [${SHAREGRP}]
18#
19# NLSMODE	National Language Support files mode. [${NOBINMODE}]
20#
21# NLSOWN	National Language Support files owner. [${SHAREOWN}]
22#
23# NO_NLS	Do not make or install NLS files. [not set]
24#
25# +++ targets +++
26#
27#	install:
28#		Install compiled NLS files
29#
30# bsd.obj.mk: cleandir and obj
31
32GENCAT?=	gencat -new
33# from NetBSD -- to use in libraries
34#NLSNAME?=	${PROG:Ulib${LIB}}
35
36NLSDIR?=        ${SHAREDIR}/nls
37NLSGRP?=        ${SHAREGRP}
38NLSMODE?=       ${NOBINMODE}
39NLSOWN?=        ${SHAREOWN}
40
41NLS?=
42
43.MAIN:		all
44
45.SUFFIXES: .cat .msg
46
47.msg.cat:
48	${GENCAT} ${.TARGET} ${.IMPSRC}
49
50#
51# .msg file pre-build rules
52#
53.for file in ${NLS}
54.if defined(NLSSRCFILES_${file})
55${file}:
56	@rm -f ${.TARGET}
57	cat ${NLSSRCDIR_${file}}/${NLSSRCFILES_${file}} > ${.TARGET}
58.endif
59CLEANFILES+= ${file}
60.endfor
61
62#
63# .cat file build rules
64#
65NLSALL=		${NLS:.msg=.cat}
66CLEANFILES+=	${NLSALL}
67
68#
69# installation rules
70#
71__nlsinstall: .USE
72	${INSTALL} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} \
73		${.ALLSRC} ${.TARGET}
74
75.for F in ${NLSALL}
76_F:=		${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat
77
78${_F}:		${F} __nlsinstall			# install rule
79nlsinstall::	${_F}
80.PRECIOUS:	${_F}					# keep if install fails
81.endfor
82
83#
84
85.if !defined(NO_NLS) && !empty(NLS)
86all-nls: ${NLSALL}
87.else
88all-nls:
89.endif
90
91all:		all-nls _SUBDIR
92install:	beforeinstall nlsinstall afterinstall
93
94.if !target(distribute)
95distribute:
96.endif
97
98.if !target(beforeinstall)
99beforeinstall:
100.endif
101
102.if !target(afterinstall)
103afterinstall:
104.endif
105
106.include <bsd.obj.mk>
107