xref: /netbsd-src/share/mk/bsd.links.mk (revision 69b6d498973bb4d7230c2d3c12bd9a032738ec8e)
1#	$NetBSD: bsd.links.mk,v 1.29 2004/06/25 02:05:39 christos Exp $
2
3.include <bsd.init.mk>
4
5##### Basic targets
6install:	linksinstall
7
8##### Default values
9LINKS?=
10SYMLINKS?=
11
12##### Install rules
13.PHONY:		linksinstall
14linksinstall::	realinstall
15.if !empty(SYMLINKS)
16	@(set ${SYMLINKS}; \
17	 while test $$# -ge 2; do \
18		l=$$1; shift; \
19		t=${DESTDIR}$$1; shift; \
20		if  ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \
21		    [ "$$l" = "$$ttarg" ]; then \
22			continue ; \
23		fi ; \
24		${_MKSHMSG_INSTALL} $$t; \
25		${_MKSHECHO} ${INSTALL_SYMLINK} ${SYSPKGTAG} $$l $$t; \
26		${INSTALL_SYMLINK} ${SYSPKGTAG} $$l $$t; \
27	 done; )
28.endif
29.if !empty(LINKS)
30	@(set ${LINKS}; \
31	 while test $$# -ge 2; do \
32		l=${DESTDIR}$$1; shift; \
33		t=${DESTDIR}$$1; shift; \
34		if  ldevino=`${TOOL_STAT} -qf '%d %i' $$l` && \
35		    tdevino=`${TOOL_STAT} -qf '%d %i' $$t` && \
36		    [ "$$ldevino" = "$$tdevino" ]; then \
37			continue ; \
38		fi ; \
39		${_MKSHMSG_INSTALL} $$t; \
40		${_MKSHECHO} ${INSTALL_LINK} ${SYSPKGTAG} $$l $$t; \
41		${INSTALL_LINK} ${SYSPKGTAG} $$l $$t; \
42	done ; )
43.endif
44
45
46configinstall:		configlinksinstall
47configlinksinstall::	.PHONY
48.if defined(CONFIGSYMLINKS)
49	@(set ${CONFIGSYMLINKS}; \
50	 while test $$# -ge 2; do \
51		l=$$1; shift; \
52		t=${DESTDIR}$$1; shift; \
53		if  ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \
54		    [ "$$l" = "$$ttarg" ]; then \
55			continue ; \
56		fi ; \
57		${_MKSHMSG_INSTALL} $$t; \
58		${_MKSHECHO} ${INSTALL_SYMLINK} ${SYSPKGTAG} $$l $$t; \
59		${INSTALL_SYMLINK} ${SYSPKGTAG} $$l $$t; \
60	 done; )
61.endif
62.if defined(CONFIGLINKS) && !empty(CONFIGLINKS)
63	@(set ${CONFIGLINKS}; \
64	 while test $$# -ge 2; do \
65		l=${DESTDIR}$$1; shift; \
66		t=${DESTDIR}$$1; shift; \
67		if  ldevino=`${TOOL_STAT} -qf '%d %i' $$l` && \
68		    tdevino=`${TOOL_STAT} -qf '%d %i' $$t` && \
69		    [ "$$ldevino" = "$$tdevino" ]; then \
70			continue ; \
71		fi ; \
72		${_MKSHMSG_INSTALL} $$t; \
73		${_MKSHECHO} ${INSTALL_LINK} ${SYSPKGTAG} $$l $$t; \
74		${INSTALL_LINK} ${SYSPKGTAG} $$l $$t; \
75	done ; )
76.endif
77
78.include <bsd.sys.mk>
79