Subject: bsd.*.mk changes for less things to change unnecessarily.
To: None <tech-install@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: tech-install
Date: 04/18/2000 13:24:36
Any problems with the following?  It changes SYMLINKS in bsd.kinc.mk and
bsd.links.mk so that the link isn't recreated if it already points to
the right place (much the same as bsd.obj.mk already does), and doesn't
overwrite catman pages if there's no difference between the old and the
new.

They probably should be updated for the new ".for X Y" syntax, but I've
been using these for a little while without problems.

Simon.
--
Index: bsd.kinc.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.kinc.mk,v
retrieving revision 1.11
diff -p -u -r1.11 bsd.kinc.mk
--- bsd.kinc.mk	2000/02/26 19:02:40	1.11
+++ bsd.kinc.mk	2000/04/18 03:01:40
@@ -116,19 +116,20 @@ ${DESTDIR}${INCSDIR}/$I: ${DESTDIR}${INC
 .if defined(SYMLINKS) && !empty(SYMLINKS)
 incinstall::
 	@(set ${SYMLINKS}; \
-	 echo ".include <bsd.own.mk>"; \
 	 while test $$# -ge 2; do \
 		l=$$1; \
 		shift; \
 		t=${DESTDIR}$$1; \
 		shift; \
-		echo "realall: $$t"; \
-		echo ".PHONY: $$t"; \
-		echo "$$t:"; \
-		echo "	@echo \"$$t -> $$l\""; \
-		echo "	@rm -rf $$t; ln -s $$l $$t"; \
-	 done; \
-	) | ${MAKE} -f- all
+		if [ -L $$t ]; then \
+			cur=`ls -ld $$t | awk '{print $$NF}'` ; \
+			if [ "$$cur" = "$$l" ]; then \
+				continue ; \
+			fi; \
+		fi; \
+		echo "$$t -> $$l"; \
+		rm -rf $$t; ln -s $$l $$t; \
+	 done; )
 .endif
 
 .if !target(incinstall)
Index: bsd.links.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.links.mk,v
retrieving revision 1.12
diff -p -u -r1.12 bsd.links.mk
--- bsd.links.mk	2000/02/26 19:02:40	1.12
+++ bsd.links.mk	2000/04/18 03:01:40
@@ -6,19 +6,20 @@ realinstall:	linksinstall
 .if defined(SYMLINKS) && !empty(SYMLINKS)
 linksinstall::
 	@(set ${SYMLINKS}; \
-	 echo ".include <bsd.own.mk>"; \
 	 while test $$# -ge 2; do \
 		l=$$1; \
 		shift; \
 		t=${DESTDIR}$$1; \
 		shift; \
-		echo "realall: $$t"; \
-		echo ".PHONY: $$t"; \
-		echo "$$t:"; \
-		echo "	@echo \"$$t -> $$l\""; \
-		echo "	@rm -f $$t; ln -s $$l $$t"; \
-	 done; \
-	) | ${MAKE} -f- all
+		if [ -L $$t ]; then \
+			cur=`ls -ld $$t | awk '{print $$NF}'` ; \
+			if [ "$$cur" = "$$l" ]; then \
+				continue ; \
+			fi; \
+		fi; \
+		echo "$$t -> $$l"; \
+		rm -rf $$t; ln -s $$l $$t; \
+	 done; )
 .endif
 .if defined(LINKS) && !empty(LINKS)
 linksinstall::
Index: bsd.man.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.man.mk,v
retrieving revision 1.51
diff -p -u -r1.51 bsd.man.mk
--- bsd.man.mk	2000/02/19 22:54:08	1.51
+++ bsd.man.mk	2000/04/18 03:01:41
@@ -69,7 +69,9 @@ __installpage: .USE
 	@chown ${MANOWN}:${MANGRP} ${.TARGET}
 	@chmod ${MANMODE} ${.TARGET}
 .else
-	${MINSTALL} ${.ALLSRC} ${.TARGET}
+	@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
+	    (echo "${MINSTALL} ${.ALLSRC} ${.TARGET}" && \
+	     ${MINSTALL} ${.ALLSRC} ${.TARGET})
 .endif