bsd.links.mk revision 1.31 1 # $NetBSD: bsd.links.mk,v 1.31 2006/03/16 18:43:34 jwise Exp $
2
3 .include <bsd.init.mk>
4
5 ##### Basic targets
6 install: linksinstall
7
8 ##### Default values
9 LINKS?=
10 SYMLINKS?=
11
12 ##### Install rules
13 .PHONY: linksinstall
14 linksinstall:: 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} $$l $$t; \
26 ${INSTALL_SYMLINK} $$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} $$l $$t; \
41 ${INSTALL_LINK} $$l $$t; \
42 done ; )
43 .endif
44
45
46 configinstall: configlinksinstall
47 .PHONY: configlinksinstall
48 configlinksinstall:: configfilesinstall
49 .if defined(CONFIGSYMLINKS)
50 @(set ${CONFIGSYMLINKS}; \
51 while test $$# -ge 2; do \
52 l=$$1; shift; \
53 t=${DESTDIR}$$1; shift; \
54 if ttarg=`${TOOL_STAT} -qf '%Y' $$t` && \
55 [ "$$l" = "$$ttarg" ]; then \
56 continue ; \
57 fi ; \
58 ${_MKSHMSG_INSTALL} $$t; \
59 ${_MKSHECHO} ${INSTALL_SYMLINK} $$l $$t; \
60 ${INSTALL_SYMLINK} $$l $$t; \
61 done; )
62 .endif
63 .if defined(CONFIGLINKS) && !empty(CONFIGLINKS)
64 @(set ${CONFIGLINKS}; \
65 while test $$# -ge 2; do \
66 l=${DESTDIR}$$1; shift; \
67 t=${DESTDIR}$$1; shift; \
68 if ldevino=`${TOOL_STAT} -qf '%d %i' $$l` && \
69 tdevino=`${TOOL_STAT} -qf '%d %i' $$t` && \
70 [ "$$ldevino" = "$$tdevino" ]; then \
71 continue ; \
72 fi ; \
73 ${_MKSHMSG_INSTALL} $$t; \
74 ${_MKSHECHO} ${INSTALL_LINK} $$l $$t; \
75 ${INSTALL_LINK} $$l $$t; \
76 done ; )
77 .endif
78
79 .include <bsd.sys.mk>
80