bsd.links.mk revision 1.16 1 # $NetBSD: bsd.links.mk,v 1.16 2001/11/19 04:46:07 perry Exp $
2
3 ##### Basic targets
4 .PHONY: linksinstall
5 realinstall: linksinstall
6
7 ##### Default values
8 LINKS?=
9 SYMLINKS?=
10
11 ##### Install rules
12 linksinstall::
13 .if !empty(SYMLINKS)
14 @(set ${SYMLINKS}; \
15 while test $$# -ge 2; do \
16 l=$$1; shift; \
17 t=${DESTDIR}$$1; shift; \
18 if [ -h $$t ]; then \
19 cur=`ls -ld $$t | awk '{print $$NF}'` ; \
20 if [ "$$cur" = "$$l" ]; then \
21 continue ; \
22 fi; \
23 fi; \
24 echo "$$t -> $$l"; \
25 rm -rf $$t; ${INSTALL_SYMLINK} $$l $$t; \
26 done; )
27 .endif
28 .if !empty(LINKS)
29 @(set ${LINKS}; \
30 echo ".include <bsd.own.mk>"; \
31 while test $$# -ge 2; do \
32 l=${DESTDIR}$$1; shift; \
33 t=${DESTDIR}$$1; shift; \
34 echo "realall: $$t"; \
35 echo ".PHONY: $$t"; \
36 echo "$$t:"; \
37 echo " @echo \"$$t -> $$l\""; \
38 echo " @rm -f $$t; ${INSTALL_LINK} $$l $$t"; \
39 done; \
40 ) | ${MAKE} -f- all
41 .endif
42