$NetBSD$

Link against ncursesw and adapt install target for pkgsrc.

--- Makefile.orig	2019-02-22 01:00:59.000000000 +0000
+++ Makefile
@@ -18,7 +18,8 @@ endif
 # PREFIX is the base directory under which to install the binary and man
 # page; generally either /usr/local or /usr (or perhaps /opt...).
 
-PREFIX = /usr/local
+DESTDIR ?=
+PREFIX ?= /usr/local
 
 #--------------------------------------------------------------
 # Defaults are for the standard curses setup:
@@ -37,7 +38,7 @@ ifeq ($(OS),Windows_NT)
 	E = .exe
 else
 	CURS_DIR = .
-	LIBS = -lcurses
+	LIBS = -lncursesw
 	RM = rm -f
 	SEP = ;
 	E =
@@ -94,7 +95,7 @@ $(IOBJS) : %.o: $(isrc)/%.cc
 	$(CXX) $(OPTS) -I$(CURS_DIR) -c $<
 
 mm$(E):	$(MOBJS) $(IOBJS)
-	$(CXX) -o mm$(E) $(MOBJS) $(IOBJS) $(LIBS)
+	$(CXX) -o mm$(E) $(MOBJS) $(IOBJS) $(LIBS) $(LDFLAGS)
 	$(POST)
 
 dep:
@@ -106,9 +107,9 @@ clean:
 	$(RM) mm$(E)
 
 install::
-	install -c -s mm $(PREFIX)/bin
-	install -c -m 644 mm.1 $(HELPDIR)
-	$(RM) $(HELPDIR)/mmail.1
-	ln $(HELPDIR)/mm.1 $(HELPDIR)/mmail.1
+	install -c -s mm $(DESTDIR)$(PREFIX)/bin
+	install -c -m 644 mm.1 $(DESTDIR)$(HELPDIR)
+	$(RM) $(DESTDIR)$(HELPDIR)/mmail.1
+	ln $(HELPDIR)/mm.1 $(DESTDIR)$(HELPDIR)/mmail.1
 
 include depend
