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