bsd.nls.mk revision 91632
191621Sphantom#	Based on $NetBSD: bsd.nls.mk,v 1.35 2001/11/28 20:19:08 tv Exp $
291621Sphantom# $FreeBSD: head/share/mk/bsd.nls.mk 91632 2002-03-04 12:27:00Z phantom $
391621Sphantom#
491621Sphantom# This include file <bsd.nls.mk> handles building and installing Native
591621Sphantom# Language Support (NLS) catalogs
691621Sphantom#
791621Sphantom# +++ variables +++
891621Sphantom#
991621Sphantom# GENCAT	A program for converting .msg files into compiled NLS
1091621Sphantom#		.cat files. [gencat -new]
1191621Sphantom#
1291621Sphantom# NLS		Source or intermediate .msg files. [set in Makefile]
1391621Sphantom#
1491621Sphantom# NLSDIR	Base path for National Language Support files
1591621Sphantom#		installation. [${SHAREDIR}/nls]
1691621Sphantom#
1791621Sphantom# NLSGRP	National Language Support files group. [${SHAREGRP}]
1891621Sphantom#
1991621Sphantom# NLSMODE	National Language Support files mode. [${NOBINMODE}]
2091621Sphantom#
2191621Sphantom# NLSOWN	National Language Support files owner. [${SHAREOWN}]
2291621Sphantom#
2391621Sphantom# NO_NLS	Do not make or install NLS files. [not set]
2491621Sphantom#
2591621Sphantom# +++ targets +++
2691621Sphantom#
2791621Sphantom#	install:
2891621Sphantom#		Install compiled NLS files
2991621Sphantom#
3091621Sphantom# bsd.obj.mk: cleandir and obj
3191621Sphantom
3291621SphantomGENCAT?=	gencat -new
3391621Sphantom
3491621SphantomNLSDIR?=        ${SHAREDIR}/nls
3591621SphantomNLSGRP?=        ${SHAREGRP}
3691621SphantomNLSMODE?=       ${NOBINMODE}
3791621SphantomNLSOWN?=        ${SHAREOWN}
3891621Sphantom
3991621SphantomNLS?=
4091632SphantomNLSLINKS=
4191621Sphantom
4291621Sphantom.MAIN:		all
4391621Sphantom
4491621Sphantom.SUFFIXES: .cat .msg
4591621Sphantom
4691621Sphantom.msg.cat:
4791621Sphantom	${GENCAT} ${.TARGET} ${.IMPSRC}
4891621Sphantom
4991621Sphantom#
5091621Sphantom# .msg file pre-build rules
5191621Sphantom#
5291621Sphantom.for file in ${NLS}
5391628Sphantom.if !defined(NLSSRCDIR_${file}) && defined(NLSSRCDIR)
5491628SphantomNLSSRCDIR_${file}=${NLSSRCDIR}
5591628Sphantom.endif
5691628Sphantom.if !defined(NLSSRCFILES_${file}) && defined(NLSSRCFILES)
5791628SphantomNLSSRCFILES_${file}=${NLSSRCFILES}
5891628Sphantom.endif
5991628Sphantom
6091621Sphantom.if defined(NLSSRCFILES_${file})
6191621Sphantom${file}:
6291621Sphantom	@rm -f ${.TARGET}
6391621Sphantom	cat ${NLSSRCDIR_${file}}/${NLSSRCFILES_${file}} > ${.TARGET}
6491628SphantomCLEANFILES+= ${file}
6591621Sphantom.endif
6691632Sphantom
6791632Sphantom.if defined(NLSLINKS_${file:C/.msg//g}) && !empty(NLSLINKS_${file:C/.msg//g})
6891632SphantomNLSLINKS+= ${file:C/.msg//g}
6991632Sphantom.endif
7091621Sphantom.endfor
7191621Sphantom
7291621Sphantom#
7391621Sphantom# .cat file build rules
7491621Sphantom#
7591621SphantomNLSALL=		${NLS:.msg=.cat}
7691621SphantomCLEANFILES+=	${NLSALL}
7791621Sphantom
7891621Sphantom#
7991621Sphantom# installation rules
8091621Sphantom#
8191621Sphantom__nlsinstall: .USE
8291621Sphantom	${INSTALL} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} \
8391621Sphantom		${.ALLSRC} ${.TARGET}
8491621Sphantom
8591621Sphantom.for F in ${NLSALL}
8691621Sphantom_F:=		${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat
8791621Sphantom
8891621Sphantom${_F}:		${F} __nlsinstall			# install rule
8991621Sphantomnlsinstall::	${_F}
9091621Sphantom.PRECIOUS:	${_F}					# keep if install fails
9191621Sphantom.endfor
9291621Sphantom
9391632Sphantomlinks-nls:
9491632Sphantom.if defined(NLSLINKS) && !empty(NLSLINKS)
9591632Sphantom.for src in ${NLSLINKS}
9691632Sphantom.for dst in ${NLSLINKS_${src}}
9791632Sphantom	ln -fs ../${src}/${NLSNAME}.cat \
9891632Sphantom		${DESTDIR}${NLSDIR}/${dst}/${NLSNAME}.cat
9991632Sphantom.endfor
10091632Sphantom.endfor
10191632Sphantom.endif
10291632Sphantom
10391621Sphantom#
10491621Sphantom
10591621Sphantom.if !defined(NO_NLS) && !empty(NLS)
10691621Sphantomall-nls: ${NLSALL}
10791621Sphantom.else
10891621Sphantomall-nls:
10991621Sphantom.endif
11091621Sphantom
11191632Sphantom.if !defined(NO_NLS) && !empty(NLS)
11291632Sphantomrealinstall:	beforeinstall nlsinstall links-nls
11391632Sphantom.else
11491632Sphantomrealinstall:	beforeinstall
11591632Sphantom.endif
11691632Sphantom
11791621Sphantomall:		all-nls _SUBDIR
11891632Sphantominstall:	realinstall afterinstall
11991621Sphantom
12091621Sphantom.if !target(distribute)
12191621Sphantomdistribute:
12291621Sphantom.endif
12391621Sphantom
12491621Sphantom.if !target(beforeinstall)
12591621Sphantombeforeinstall:
12691621Sphantom.endif
12791621Sphantom
12891621Sphantom.if !target(afterinstall)
12991621Sphantomafterinstall:
13091621Sphantom.endif
13191621Sphantom
13291621Sphantom.include <bsd.obj.mk>
133