2002-04-30 18:29:01 +04:00
|
|
|
# $NetBSD: bsd.links.mk,v 1.19 2002/04/30 14:29:01 sommerfeld Exp $
|
1997-05-07 00:54:31 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Basic targets
|
1997-05-07 00:54:31 +04:00
|
|
|
.PHONY: linksinstall
|
2002-03-21 15:59:56 +03:00
|
|
|
install: linksinstall
|
1997-03-25 00:54:12 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Default values
|
|
|
|
LINKS?=
|
|
|
|
SYMLINKS?=
|
|
|
|
|
|
|
|
##### Install rules
|
2002-04-30 18:29:01 +04:00
|
|
|
linksinstall:: realinstall
|
2001-11-02 08:21:47 +03:00
|
|
|
.if !empty(SYMLINKS)
|
2000-02-10 21:18:01 +03:00
|
|
|
@(set ${SYMLINKS}; \
|
1997-03-25 00:54:12 +03:00
|
|
|
while test $$# -ge 2; do \
|
2001-11-02 08:21:47 +03:00
|
|
|
l=$$1; shift; \
|
|
|
|
t=${DESTDIR}$$1; shift; \
|
2000-07-07 08:35:35 +04:00
|
|
|
if [ -h $$t ]; then \
|
2000-04-23 11:58:17 +04:00
|
|
|
cur=`ls -ld $$t | awk '{print $$NF}'` ; \
|
|
|
|
if [ "$$cur" = "$$l" ]; then \
|
|
|
|
continue ; \
|
|
|
|
fi; \
|
|
|
|
fi; \
|
|
|
|
echo "$$t -> $$l"; \
|
2001-11-19 07:46:07 +03:00
|
|
|
rm -rf $$t; ${INSTALL_SYMLINK} $$l $$t; \
|
2000-04-23 11:58:17 +04:00
|
|
|
done; )
|
1997-03-25 00:54:12 +03:00
|
|
|
.endif
|
2001-11-02 08:21:47 +03:00
|
|
|
.if !empty(LINKS)
|
2000-02-10 21:18:01 +03:00
|
|
|
@(set ${LINKS}; \
|
2000-01-24 09:54:27 +03:00
|
|
|
echo ".include <bsd.own.mk>"; \
|
1997-03-25 00:54:12 +03:00
|
|
|
while test $$# -ge 2; do \
|
2001-11-02 08:21:47 +03:00
|
|
|
l=${DESTDIR}$$1; shift; \
|
|
|
|
t=${DESTDIR}$$1; shift; \
|
2000-02-10 21:18:01 +03:00
|
|
|
echo "realall: $$t"; \
|
2002-02-12 00:14:58 +03:00
|
|
|
echo "$$t!"; \
|
1997-03-25 00:54:12 +03:00
|
|
|
echo " @echo \"$$t -> $$l\""; \
|
2001-11-19 07:46:07 +03:00
|
|
|
echo " @rm -f $$t; ${INSTALL_LINK} $$l $$t"; \
|
2000-02-10 21:18:01 +03:00
|
|
|
done; \
|
|
|
|
) | ${MAKE} -f- all
|
1997-03-25 00:54:12 +03:00
|
|
|
.endif
|