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