summaryrefslogtreecommitdiffstats
path: root/share/mk/bsd.nls.mk
blob: bbf481b21c5e41ca937c69bfaae0c70a1d6d3c79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#	Based on $NetBSD: bsd.nls.mk,v 1.35 2001/11/28 20:19:08 tv Exp $
# $FreeBSD$
#
# This include file <bsd.nls.mk> handles building and installing Native
# Language Support (NLS) catalogs
#
# +++ variables +++
#
# GENCAT	A program for converting .msg files into compiled NLS
#		.cat files. [gencat -new]
#
# NLS		Source or intermediate .msg files. [set in Makefile]
#
# NLSDIR	Base path for National Language Support files
#		installation. [${SHAREDIR}/nls]
#
# NLSGRP	National Language Support files group. [${SHAREGRP}]
#
# NLSMODE	National Language Support files mode. [${NOBINMODE}]
#
# NLSOWN	National Language Support files owner. [${SHAREOWN}]
#
# NO_NLS	Do not make or install NLS files. [not set]
#
# +++ targets +++
#
#	install:
#		Install compiled NLS files
#
# bsd.obj.mk: cleandir and obj

.include <bsd.init.mk>

GENCAT?=	gencat -new

NLSDIR?=        ${SHAREDIR}/nls
NLSGRP?=        ${SHAREGRP}
NLSMODE?=       ${NOBINMODE}
NLSOWN?=        ${SHAREOWN}

NLS?=
NLSLINKS=

.SUFFIXES: .cat .msg

.msg.cat:
	${GENCAT} ${.TARGET} ${.IMPSRC}

#
# .msg file pre-build rules
#
.for file in ${NLS}
.if !defined(NLSSRCDIR_${file}) && defined(NLSSRCDIR)
NLSSRCDIR_${file}=${NLSSRCDIR}
.endif
.if !defined(NLSSRCFILES_${file}) && defined(NLSSRCFILES)
NLSSRCFILES_${file}=${NLSSRCFILES}
.endif

.if defined(NLSSRCFILES_${file})
${file}:
	@rm -f ${.TARGET}
	cat ${NLSSRCDIR_${file}}/${NLSSRCFILES_${file}} > ${.TARGET}
CLEANFILES+= ${file}
.endif

.if defined(NLSLINKS_${file:C/.msg//g}) && !empty(NLSLINKS_${file:C/.msg//g})
NLSLINKS+= ${file:C/.msg//g}
.endif
.endfor

#
# .cat file build rules
#
NLSALL=		${NLS:.msg=.cat}
CLEANFILES+=	${NLSALL}

#
# installation rules
#
__nlsinstall: .USE
	${INSTALL} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} \
		${.ALLSRC} ${.TARGET}

.for F in ${NLSALL}
_F:=		${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat

${_F}:		${F} __nlsinstall			# install rule
nlsinstall::	${_F}
.PRECIOUS:	${_F}					# keep if install fails
.endfor

links-nls:
.if defined(NLSLINKS) && !empty(NLSLINKS)
.for src in ${NLSLINKS}
.for dst in ${NLSLINKS_${src}}
	ln -fs ../${src}/${NLSNAME}.cat \
		${DESTDIR}${NLSDIR}/${dst}/${NLSNAME}.cat
.endfor
.endfor
.endif

#

.if !defined(NO_NLS) && !empty(NLS)
all-nls: ${NLSALL}
.else
all-nls:
.endif

.if !defined(NO_NLS) && !empty(NLS)
realinstall:	beforeinstall nlsinstall links-nls
.else
realinstall:	beforeinstall
.endif

all:		all-nls
install:	realinstall afterinstall

.if !target(beforeinstall)
beforeinstall:
.endif

.if !target(afterinstall)
afterinstall:
.endif

.include <bsd.obj.mk>
OpenPOWER on IntegriCloud