$NetBSD: patch-Makefile,v 1.2 2020/11/16 10:51:44 schmonz Exp $

Use a pkgsrc-capable shell on all platforms.
Support DESTDIR.
Defer tests until TEST_TARGET.

--- Makefile.orig	2018-10-14 00:48:50.000000000 +0000
+++ Makefile
@@ -227,8 +227,8 @@ choose compile haswaitp.h1 haswaitp.h2 l
 
 install: \
 installer BIN conf-bin MAN conf-man
-	./installer `head -n 1 conf-bin` <BIN
-	./installer `head -n 1 conf-man` <MAN
+	./installer ${DESTDIR}`head -n 1 conf-bin` <BIN
+	./installer ${DESTDIR}`head -n 1 conf-man` <MAN
 
 installer: \
 load installer.o getln.a unix.a byte.a
@@ -247,7 +247,7 @@ compile iopause.c taia.h tai.h uint64.h 
 	./compile iopause.c
 
 it: \
-rts sysdeps man
+programs sysdeps man
 
 load: \
 conf-ld print-ld.sh systype warn-auto.sh
@@ -357,7 +357,7 @@ compile readproctitle.c error.h
 
 rts: \
 programs rts.sh rts.exp
-	env - /bin/sh rts.sh 2>&1 | cat -v > rts
+	env - ${PKGSRC_SHELL} rts.sh 2>&1 | cat -v > rts
 	diff -u rts.exp rts
 
 rts.exp: \
