1#         $NetBSD: bsd.nls.mk,v 1.47 2011/09/10 16:57:35 apb Exp $
2
3.include <bsd.init.mk>
4
5##### Basic targets
6realinstall:        nlsinstall
7
8##### Default values
9NLSNAME?= ${PROG:Ulib${LIB}}
10
11NLS?=
12
13##### Build rules
14.if ${MKNLS} != "no"
15
16NLSALL=             ${NLS:.msg=.cat}
17
18realall:  ${NLSALL}
19.NOPATH:  ${NLSALL}
20
21.SUFFIXES: .cat .msg
22
23.msg.cat:
24          @rm -f ${.TARGET}
25          ${_MKTARGET_CREATE}
26          ${TOOL_GENCAT} ${.TARGET} ${.IMPSRC}
27
28.endif # ${MKNLS} != "no"
29
30##### Install rules
31nlsinstall::        # ensure existence
32.PHONY:             nlsinstall
33
34.if ${MKNLS} != "no"
35
36__nlsinstall: .USE
37          ${_MKTARGET_INSTALL}
38          ${INSTALL_FILE} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} \
39                    ${.ALLSRC} ${.TARGET}
40
41.for F in ${NLSALL:O:u}
42_F:=                ${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat # installed path
43
44.if ${MKUPDATE} == "no"
45${_F}!              ${F} __nlsinstall                       # install rule
46.if !defined(BUILD) && !make(all) && !make(${F})
47${_F}!              .MADE                                             # no build at install
48.endif
49.else
50${_F}:              ${F} __nlsinstall                       # install rule
51.if !defined(BUILD) && !make(all) && !make(${F})
52${_F}:              .MADE                                             # no build at install
53.endif
54.endif
55
56nlsinstall::        ${_F}
57.PRECIOUS:          ${_F}                                             # keep if install fails
58.endfor
59
60.undef _F
61.endif # ${MKNLS} != "no"
62
63##### Clean rules
64.if ${MKNLS} != "no" && !empty(NLS)
65CLEANDIRFILES+= ${NLSALL}
66.endif
67
68##### Pull in related .mk logic
69.include <bsd.obj.mk>
70.include <bsd.sys.mk>
71.include <bsd.clean.mk>
72