xref: /netbsd/share/mk/bsd.links.mk (revision c4a72b64)
1#	$NetBSD: bsd.links.mk,v 1.21 2002/10/22 18:48:28 perry Exp $
2
3##### Basic targets
4.PHONY:		linksinstall
5install:	linksinstall
6
7##### Default values
8LINKS?=
9SYMLINKS?=
10
11##### Install rules
12linksinstall::	realinstall
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		${INSTALL_SYMLINK} ${SYSPKGTAG} $$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 "	@${INSTALL_LINK} ${SYSPKGTAG} $$l $$t"; \
38	 done; \
39	) | ${MAKE} -f- all
40.endif
41