Home | History | Annotate | Line # | Download | only in mk
bsd.links.mk revision 1.13
      1 #	$NetBSD: bsd.links.mk,v 1.13 2000/04/23 07:58:17 simonb Exp $
      2 
      3 .PHONY:		linksinstall
      4 realinstall:	linksinstall
      5 
      6 .if defined(SYMLINKS) && !empty(SYMLINKS)
      7 linksinstall::
      8 	@(set ${SYMLINKS}; \
      9 	 while test $$# -ge 2; do \
     10 		l=$$1; \
     11 		shift; \
     12 		t=${DESTDIR}$$1; \
     13 		shift; \
     14 		if [ -L $$t ]; then \
     15 			cur=`ls -ld $$t | awk '{print $$NF}'` ; \
     16 			if [ "$$cur" = "$$l" ]; then \
     17 				continue ; \
     18 			fi; \
     19 		fi; \
     20 		echo "$$t -> $$l"; \
     21 		rm -rf $$t; ln -s $$l $$t; \
     22 	 done; )
     23 .endif
     24 .if defined(LINKS) && !empty(LINKS)
     25 linksinstall::
     26 	@(set ${LINKS}; \
     27 	 echo ".include <bsd.own.mk>"; \
     28 	 while test $$# -ge 2; do \
     29 		l=${DESTDIR}$$1; \
     30 		shift; \
     31 		t=${DESTDIR}$$1; \
     32 		shift; \
     33 		echo "realall: $$t"; \
     34 		echo ".PHONY: $$t"; \
     35 		echo "$$t:"; \
     36 		echo "	@echo \"$$t -> $$l\""; \
     37 		echo "	@rm -f $$t; ln $$l $$t"; \
     38 	 done; \
     39 	) | ${MAKE} -f- all
     40 .endif
     41 
     42 .if !target(linksinstall)
     43 linksinstall:
     44 .endif
     45