NetBSD/share/mk/bsd.files.mk
lukem 130ab7336b Rework how MAKEVERBOSE operates:
*	Don't bother prefixing commands with a line of  ${_MKCMD}\
	and instead rely upon "make -s".  This is less intrusive on
	all the Makefiles than the former.  Idea from David Laight.

    *	Rename the variables use to print messages.  The scheme now is:
	    _MKMSG_FOO		Run  _MKMSG 'foo'
	    _MKTARGET_FOO	Run  _MKMSG_FOO ${.TARGET}
	From discussion with Alistair Crooks.
2003-10-21 10:01:19 +00:00

82 lines
1.7 KiB
Makefile

# $NetBSD: bsd.files.mk,v 1.28 2003/10/21 10:01:21 lukem Exp $
.if !defined(_BSD_FILES_MK_)
_BSD_FILES_MK_=1
.include <bsd.init.mk>
.if !target(__fileinstall)
##### Basic targets
.PHONY: filesinstall
realinstall: filesinstall
##### Default values
FILESDIR?= ${BINDIR}
FILESOWN?= ${BINOWN}
FILESGRP?= ${BINGRP}
FILESMODE?= ${NONBINMODE}
##### Install rules
filesinstall:: # ensure existence
__fileinstall: .USE
${_MKTARGET_INSTALL}
${INSTALL_FILE} \
-o ${FILESOWN_${.ALLSRC:T}:U${FILESOWN}} \
-g ${FILESGRP_${.ALLSRC:T}:U${FILESGRP}} \
-m ${FILESMODE_${.ALLSRC:T}:U${FILESMODE}} \
${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
.endif # !target(__fileinstall)
.for F in ${FILES:O:u}
_FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override
_FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override
_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path
.if ${MKUPDATE} == "no"
${_F}! ${F} __fileinstall # install rule
.if !defined(BUILD) && !make(all) && !make(${F})
${_F}! .MADE # no build at install
.endif
.else
${_F}: ${F} __fileinstall # install rule
.if !defined(BUILD) && !make(all) && !make(${F})
${_F}: .MADE # no build at install
.endif
.endif
filesinstall:: ${_F}
.PRECIOUS: ${_F} # keep if install fails
.endfor
.undef _FDIR
.undef _FNAME
.undef _F
#
# BUILDSYMLINKS
#
.if defined(BUILDSYMLINKS) # {
.for _SL _TL in ${BUILDSYMLINKS}
BUILDSYMLINKS.s+= ${_SL}
BUILDSYMLINKS.t+= ${_TL}
${_TL}: ${_SL}
${_MKTARGET_CREATE}
rm -f ${.TARGET}
ln -s ${.ALLSRC} ${.TARGET}
.endfor
realall: ${BUILDSYMLINKS.t}
.PHONY: cleanbuildsymlinks
cleandir: cleanbuildsymlinks
cleanbuildsymlinks:
rm -f ${BUILDSYMLINKS.t}
.endif # }
.endif # !defined(_BSD_FILES_MK_)