2001-11-19 07:46:07 +03:00
|
|
|
# $NetBSD: bsd.links.mk,v 1.16 2001/11/19 04:46:07 perry 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
|
1997-05-09 17:25:46 +04:00
|
|
|
realinstall: linksinstall
|
1997-03-25 00:54:12 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Default values
|
|
|
|
LINKS?=
|
|
|
|
SYMLINKS?=
|
|
|
|
|
|
|
|
##### Install rules
|
1997-03-25 00:54:12 +03:00
|
|
|
linksinstall::
|
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"; \
|
1997-03-25 00:54:12 +03:00
|
|
|
echo ".PHONY: $$t"; \
|
1997-05-10 14:55:19 +04: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
|