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