[BACK]Return to bsd.links.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

File: [cvs.NetBSD.org] / src / share / mk / bsd.links.mk (download)

Revision 1.32.24.1, Sat Jun 6 22:10:12 2009 UTC (14 years, 10 months ago) by bouyer
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, matt-nb5-pq3-base, matt-nb5-pq3
Changes since 1.32: +14 -3 lines

Pull up following revision(s) (requested by snj in ticket #790):
	share/mk/bsd.lib.mk: revision 1.298
	share/mk/bsd.man.mk: revision 1.100
	share/mk/bsd.hostprog.mk: revision 1.55
	distrib/sets/maketars: revision 1.66
	share/zoneinfo/Makefile: revision 1.43
	share/mk/bsd.kmodule.mk: revision 1.19
	usr.bin/xinstall/xinstall.c: revisions 1.106 - 1.108 via patch
	share/mk/bsd.prog.mk: revision 1.241
	share/dict/Makefile: revision 1.17
	share/mk/bsd.README: revision 1.249
	distrib/common/parselist.awk: revision 1.16
	share/mk/bsd.links.mk: revision 1.34
Explicitly sort entries on preparing set files from METALOG.
METALOG could have different order due to install(1) race
on parallel builds, and mtree(8) doesn't sort files.
Should fix inconsistent shared sets among builds as seen in
/pub/NetBSD-daily/netbsd-5/200904010000Z/shared/ and
/pub/NetBSD-daily/netbsd-5/200904010002Z/shared/ dirs.
Okay'ed by snj@.
Changes for installing with a metalog:
* When installing hard links and using a metalog, if -o, -g, -m, or -f
  args were explicitly specified on the command line, then believe them,
  but do not implicitly believe uname/gname/mode/flags from the file
  system.
* Output fields in the same order used by mtree.
Fix -Wshadow -Wcast-qual issues
Re-calculate size and digestresult after stripping, to ensure that
correct values appear in the metalog.
Add LINKSOWN, LINKSGRP, and LINKSMODE variables for use by bsd.links.mk
when installing hard links.  They have no effect except when using a
metalog, in which case the information is added to the metalog.  In
the future, these variables may be replaced by a method for explicitly
recording hard links in a metadata log.
Also change a few things that called ${INSTALL_LINK} without going
through bsd.links.mk.
Reviewed by perry and joerg.  This should fix PR 24457 and PR 41155.

#	$NetBSD: bsd.links.mk,v 1.32.24.1 2009/06/06 22:10:12 bouyer Exp $

.include <bsd.init.mk>

##### Basic targets
install:	linksinstall

##### Default values
LINKS?=
SYMLINKS?=
LINKSOWN?=	${BINOWN}
LINKSGRP?=	${BINGRP}
LINKSMODE?=	${NONBINMODE}

__linkinstall: .USE
	${_MKSHMSG_INSTALL} ${.TARGET}; \
	${_MKSHECHO} "${INSTALL_LINK} \
	    -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \
	    -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \
	    -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \
	    ${.ALLSRC} ${.TARGET}" && \
	${INSTALL_LINK} \
	    -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \
	    -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \
	    -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \
	    ${.ALLSRC} ${.TARGET}

##### Install rules
.PHONY:		linksinstall
linksinstall::	realinstall
.if !empty(SYMLINKS)
	@(set ${SYMLINKS}; \
	 while test $$# -ge 2; do \
		l=$$1; shift; \
		t=${DESTDIR}$$1; shift; \
		if  ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \
		    [ "$$l" = "$$ttarg" ]; then \
			continue ; \
		fi ; \
		${_MKSHMSG_INSTALL} $$t; \
		${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \
		${INSTALL_SYMLINK} $$l $$t; \
	 done; )
.endif

.for _src _dst in ${LINKS}
_l:=${DESTDIR}${_src}
_t:=${DESTDIR}${_dst}

# Handle case conflicts carefully, when _dst occurs
# more than once after case flattening
.if ${MKUPDATE} == "no" || ${LINKS:tl:M${_dst:tl:Q}:[\#]} > 1
${_t}!		${_l} __linkinstall
.else
${_t}:		${_l} __linkinstall
.endif

linksinstall::	${_t}
.PRECIOUS:	${_t}
.endfor

configinstall:		configlinksinstall
.PHONY:			configlinksinstall
configlinksinstall::	configfilesinstall
.if defined(CONFIGSYMLINKS)
	@(set ${CONFIGSYMLINKS}; \
	 while test $$# -ge 2; do \
		l=$$1; shift; \
		t=${DESTDIR}$$1; shift; \
		if  ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \
		    [ "$$l" = "$$ttarg" ]; then \
			continue ; \
		fi ; \
		${_MKSHMSG_INSTALL} $$t; \
		${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \
		${INSTALL_SYMLINK} $$l $$t; \
	 done; )
.endif

.for _src _dst in ${CONFIGLINKS}
_l:=${DESTDIR}${_src}
_t:=${DESTDIR}${_dst}

# Handle case conflicts carefully, when _dst occurs
# more than once after case flattening
.if ${MKUPDATE} == "no" || ${CONFIGLINKS:tl:M${_dst:tl:Q}:[\#]} > 1
${_t}!		${_l} __linkinstall
.else
${_t}:		${_l} __linkinstall
.endif

configlinksinstall::	${_t}
.PRECIOUS:	${_t}
.endfor

.include <bsd.sys.mk>