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