Home | History | Annotate | Line # | Download | only in mk
bsd.nls.mk revision 1.31
      1 #	$NetBSD: bsd.nls.mk,v 1.31 2001/11/02 05:21:51 tv Exp $
      2 
      3 .include <bsd.init.mk>
      4 
      5 ##### Basic targets
      6 .PHONY:		cleannls nlsinstall
      7 cleandir:	cleannls
      8 realinstall:	nlsinstall
      9 
     10 ##### Default values
     11 GENCAT?=	gencat
     12 NLSNAME?=	${PROG:Ulib${LIB}}
     13 
     14 NLS?=
     15 
     16 ##### Build rules
     17 .if ${MKNLS} != "no"
     18 
     19 NLSALL=		${NLS:.msg=.cat}
     20 
     21 realall:	${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
     33 nlsinstall::	# ensure existence
     34 .if ${MKNLS} != "no"
     35 
     36 nlsinstall::	${DESTDIR}${NLSDIR}
     37 .PRECIOUS:	${DESTDIR}${NLSDIR}
     38 .PHONY:		${DESTDIR}${NLSDIR}
     39 
     40 ${DESTDIR}${NLSDIR}:
     41 	@if [ ! -d ${.TARGET} ] || [ -h ${.TARGET} ] ; then \
     42 		echo creating ${.TARGET}; \
     43 		/bin/rm -rf ${.TARGET}; \
     44 		${INSTALL} ${INSTPRIV} -d -o ${NLSOWN} -g ${NLSGRP} -m 755 \
     45 		    ${.TARGET}; \
     46 	fi
     47 
     48 __nlsinstall: .USE
     49 	${INSTALL} ${INSTPRIV} -d -o ${NLSOWN} -g ${NLSGRP} ${.TARGET:H}
     50 	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${NLSOWN} \
     51 	    -g ${NLSGRP} -m ${NLSMODE} ${.ALLSRC} ${.TARGET}
     52 
     53 .for F in ${NLSALL:O:u}
     54 _F:=		${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat # installed path
     55 
     56 ${_F}:		${F} __nlsinstall			# install rule
     57 nlsinstall::	${_F}
     58 .PRECIOUS:	${_F}					# keep if install fails
     59 .PHONY:		${UPDATE:U${_F}}			# noclobber install
     60 .if !defined(BUILD) && !make(all) && !make(${F})
     61 ${_F}:		.MADE					# no build at install
     62 .endif
     63 .endfor
     64 
     65 .undef _F
     66 .endif # ${MKNLS} != "no"
     67 
     68 ##### Clean rules
     69 cleannls:
     70 .if !empty(NLS)
     71 	rm -f ${NLSALL}
     72 .endif
     73