$NetBSD: patch-aa,v 1.11 2017/10/25 21:38:52 khorben Exp $

- Use BSD_INSTALL_* instead of directly invoking install(1)
- Add DESTDIR support and install all the files in the proper locations.
- Add support for LDFLAGS

--- Makefile.orig	2015-02-18 21:38:03.000000000 +0000
+++ Makefile
@@ -14,12 +14,13 @@ clean:
 	rm -f *~
 
 estd:	estd.c
-	gcc ${CFLAGS} ${LIBS} -o estd estd.c
+	gcc ${CFLAGS} ${LDFLAGS} ${LIBS} -o estd estd.c
 	
 all: estd
 
 install: all
-	install -d -o root -g wheel -m 0755 /usr/local/sbin
-	install -s -o root -g wheel -m 0755 estd /usr/local/sbin/estd
-	install -d -o root -g wheel -m 0755 /usr/local/man/man1
-	install -o root -g wheel -m 0644 estd.1 /usr/local/man/man1/estd.1
+	${BSD_INSTALL_PROGRAM_DIR} ${DESTDIR}${PREFIX}/sbin
+	${BSD_INSTALL_PROGRAM} estd ${DESTDIR}${PREFIX}/sbin/estd
+	${BSD_INSTALL_MAN_DIR} ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+	${BSD_INSTALL_MAN} estd.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/estd.1
+	${BSD_INSTALL_SCRIPT} estd.sh ${DESTDIR}${PREFIX}/share/examples/rc.d/estd
