bsd.links.mk revision 1.17 1 # $NetBSD: bsd.links.mk,v 1.17 2002/02/11 21:15:00 mycroft 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 "$$t!"; \
36 echo " @echo \"$$t -> $$l\""; \
37 echo " @rm -f $$t; ${INSTALL_LINK} $$l $$t"; \
38 done; \
39 ) | ${MAKE} -f- all
40 .endif
41