$NetBSD: patch-aa,v 1.2 2009/08/18 12:48:04 he Exp $

Install man-pages using ${INSTALL} specifying the correct mode
instead of cp -Rp.
...and do "install-sh -c" instead of "install-sh", which ends up
moving the include files instead of copying them...

--- Makefile.in.orig	2009-08-06 14:44:16.000000000 +0200
+++ Makefile.in
@@ -87,7 +87,7 @@ LINK_LIB	= $(LIBTOOL) --mode=link $(CC) 
 .PHONY: install uninstall install-doc uninstall-doc 
 .PHONY: install-h uninstall-h install-lib uninstall-lib 
 
-all:		copy-headers lib linktest
+all:		copy-headers lib linktest manpages
 
 linktest:	$(srcdir)/linktest.c $(LIBDNS_HEADERS) ldns/util.h ldns/config.h libldns.la
 		$(LIBTOOL) --mode=link $(CC) $(srcdir)/linktest.c $(CPPFLAGS) $(CFLAGS) -lldns $(LIBS) -o linktest
@@ -107,7 +107,7 @@ libldns.la-export-all:	$(LIBDNS_OBJECTS)
 $(addprefix include/ldns/, $(notdir $(LIBDNS_HEADERS))): include/ldns/%.h: $(srcdir)/ldns/%.h
 		@if [ ! -d include ] ; then ($(INSTALL) -d include || echo "include exists") ; fi ;
 		@if [ ! -d include/ldns ] ; then (cd include; ln -s ../ldns ./ldns || echo "include/ldns exists") ; fi ;
-		$(INSTALL) -m 644 $< ./include/ldns/
+		$(INSTALL) -c -m 644 $< ./include/ldns/
 
 copy-headers:	$(addprefix include/ldns/, $(notdir $(LIBDNS_HEADERS)))
 
@@ -119,7 +119,7 @@ doxygen:	manpages
 ifdef doxygen
 		# if we are not in base we need to copy some html files too
 		if [ ! -e doc/header.html ] ; then \
-			$(INSTALL) -m 644 $(srcdir)/doc/header.html doc/ ; \
+			$(INSTALL) -c -m 644 $(srcdir)/doc/header.html doc/ ; \
 		fi ;
 		$(doxygen) $(srcdir)/libdns.doxygen
 endif
@@ -138,12 +138,14 @@ destclean:	uninstall
 install-config:
 	if [ $(INSTALL_LDNS_CONFIG) = "yes" ] ; then \
 		$(INSTALL) -d $(DESTDIR)$(bindir); \
-		$(INSTALL) -m 755 packaging/ldns-config $(DESTDIR)$(bindir)/; \
+		$(INSTALL) -c -m 755 packaging/ldns-config $(DESTDIR)$(bindir)/; \
 	fi
 
 install-manpages:	manpages
 		${INSTALL} -d $(DESTDIR)$(mandir)/man3
-		cp -Rp doc/man/man3/* $(DESTDIR)$(mandir)/man3/
+		for f in doc/man/man3/*; do \
+			${INSTALL} -c -m 444 $$f $(DESTDIR)$(mandir)/man3/; \
+		done
 
 uninstall-manpages:
 		for i in `cat doc/ldns_manpages`; do \
@@ -153,9 +155,9 @@ uninstall-manpages:
 install-h:	lib
 		$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)/ldns
 		for i in $(LIBDNS_HEADERS); do \
-			$(INSTALL) -m 644 $$i $(DESTDIR)$(includedir)/ldns/; done
-		$(INSTALL) -m 644 include/ldns/util.h $(DESTDIR)$(includedir)/ldns/
-		$(INSTALL) -m 644 include/ldns/net.h $(DESTDIR)$(includedir)/ldns/
+			$(INSTALL) -c -m 644 $$i $(DESTDIR)$(includedir)/ldns/; done
+		$(INSTALL) -c -m 644 include/ldns/util.h $(DESTDIR)$(includedir)/ldns/
+		$(INSTALL) -c -m 644 include/ldns/net.h $(DESTDIR)$(includedir)/ldns/
 
 uninstall-h:
 		for i in $(LIBDNS_HEADERS); do \
