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