$NetBSD: patch-Makefile,v 1.7 2020/01/14 22:04:26 jaapb Exp $

Install into correct locations and use BSD_INSTALL_*

--- Makefile.orig	2019-09-24 09:29:51.000000000 +0000
+++ Makefile
@@ -46,10 +46,10 @@ endif
 # These may be overridden from outside; e.g., our opam package description
 # provides its own values of docdir, libdir, and mandir.
 
-bindir          := $(PREFIX)/bin
-docdir		:= $(PREFIX)/share/doc/menhir
-libdir	        := $(PREFIX)/share/menhir
-mandir          := $(PREFIX)/share/man/man1
+bindir          := ${DESTDIR}$(PREFIX)/bin
+docdir		:= ${DESTDIR}$(PREFIX)/share/doc/menhir
+libdir	        := ${DESTDIR}$(PREFIX)/share/menhir
+mandir          := ${DESTDIR}$(PREFIX)/man/man1
 MANS            := doc/menhir.1
 DOCS            := doc/manual.pdf doc/manual.html doc/manual*.png demos
 
@@ -176,10 +176,10 @@ endif
 
 install:
 # Install the executable.
-	mkdir -p $(bindir)
-	install $(BUILDDIR)/menhir.$(TARGET) $(bindir)/menhir$(EXE)
+	${BSD_INSTALL_PROGRAM_DIR} $(bindir)
+	${BSD_INSTALL_PROGRAM} $(BUILDDIR)/menhir.$(TARGET) $(bindir)/menhir$(EXE)
 # Install Menhir's standard library.
-	mkdir -p $(libdir)
+	${BSD_INSTALL_LIB_DIR} $(libdir)
 # Install MenhirLib and MenhirSdk.
 	@if `$(BUILDDIR)/menhir.$(TARGET) --suggest-ocamlfind | tr -d '\r'` ; then \
 	  echo 'Installing MenhirLib and MenhirSdk via ocamlfind.' ; \
@@ -190,13 +190,13 @@ install:
 	  rm -f META ; \
 	else \
 	  echo 'Installing MenhirLib and MenhirSdk manually.' ; \
-	  install -m 644 $(patsubst %,$(BUILDDIR)/%,$(MENHIRLIB)) $(libdir) ; \
-	  install -m 644 $(patsubst %,$(SDKDIR)/%,$(MENHIRSDK)) $(libdir) ; \
+	  $(BSD_INSTALL_DATA) -m 644 $(patsubst %,$(BUILDDIR)/%,$(MENHIRLIB)) $(libdir) ; \
+	  $(BSD_INSTALL_DATA) -m 644 $(patsubst %,$(SDKDIR)/%,$(MENHIRSDK)) $(libdir) ; \
 	fi
 # Install the documentation. (If building from the repository, the documentation
 # may be absent.)
 	if [ -f doc/manual.pdf ] ; then \
-	  mkdir -p $(docdir) $(mandir) ; \
+	  $(BSD_INSTALL_DATA_DIR) -p $(docdir) $(mandir) ; \
 	  cp -r $(DOCS) $(docdir) ; \
 	  cp -r $(MANS) $(mandir) ; \
 	fi
