b41feff50f
when files may have hard links to a a name that only differs by case - change install to unconditionally remove its temporary file when installing hard links with -r. This avoids problems when built with posix rename(2) semantics and reinstalling an existing hard link. - rework hard link targets in bsd.man.mk and bsd.links.mk to use makefile constructs instead of shell constructs - always reinstall hard links that may have case conflicts, even when MKUPDATE=yes, this ensures that they get added to METALOG - remove man pages which were hard linked to themselves in libform - remove improper hard link command for existing man page in libkrb5 - fix libl's makefile to include bsd.lib.mk at end - remove shell quoting in link target for test's [.1 man page
86 lines
1.9 KiB
Makefile
86 lines
1.9 KiB
Makefile
# $NetBSD: bsd.links.mk,v 1.32 2006/09/11 22:24:09 dbj Exp $
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
##### Basic targets
|
|
install: linksinstall
|
|
|
|
##### Default values
|
|
LINKS?=
|
|
SYMLINKS?=
|
|
|
|
__linkinstall: .USE
|
|
${_MKSHMSG_INSTALL} ${.TARGET}; \
|
|
${_MKSHECHO} "${INSTALL_LINK} ${.ALLSRC} ${.TARGET}" && \
|
|
${INSTALL_LINK} ${.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>
|