#! /bin/sh -e
## 
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description. 

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi  
case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac            

exit 0
@DPATCH@
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -4,6 +4,8 @@
 #
 
 NROFF=nroff
+
+INSTALL=install
 #
 #
 MAN1PAGES=g32pbm.1 g3cat.1 pbm2g3.1 sff2g3.1 fax.1 \
@@ -12,11 +14,11 @@ MAN4PAGES=mgettydefs.4
 MAN5PAGES=faxqueue.5
 MAN8PAGES=sendfax.8 mgetty.8 callback.8 faxrunqd.8 faxq-helper.8
 MANSRC=$(MAN1PAGES) $(MAN4PAGES) $(MAN5PAGES) $(MAN8PAGES)
-MAN1DIR=/usr/local/man/man1
-MAN4DIR=/usr/local/man/man4
-MAN5DIR=/usr/local/man/man5
-MAN8DIR=/usr/local/man/man8
-INFODIR=/usr/local/info
+MAN1DIR=$(PREFIX)/usr/share/man/man1
+MAN4DIR=$(PREFIX)/usr/share/man/man4
+MAN5DIR=$(PREFIX)/usr/share/man/man5
+MAN8DIR=$(PREFIX)/usr/share/man/man8
+INFODIR=$(PREFIX)/usr/share/info
 
 #
 # formatted man pages
@@ -26,18 +28,19 @@ MAN_FMT_PRG=$(NROFF) -man
 
 all: manpages fmt-manpages mgetty.texi
 
-doc-all: mgetty.asc mgetty.info mgetty.dvi mgetty.ps fmt-manpages $(MANSRC) 
+doc-all: mgetty.info mgetty.dvi mgetty.ps fmt-manpages $(MANSRC) # mgetty.asc
 
 manpages: $(MANSRC)
 
 fmt-manpages:
 	-$(MAKE) `for i in $(MANSRC) ; do echo \`expr $$i : "\([^.]*\)"\`.man ; done `
 
-mgetty.asc: mgetty.ms
-	-$(NROFF) -ms mgetty.ms >mgetty.asc
+# commented out since I couldn't find texi2roff
+#mgetty.asc: mgetty.ms
+#	-$(NROFF) -ms mgetty.ms >mgetty.asc
 
-mgetty.ms: mgetty.texi
-	-texi2roff -ms <mgetty.texi >mgetty.ms
+#mgetty.ms: mgetty.texi
+#	-texi2roff -ms <mgetty.texi >mgetty.ms
 
 mgetty.html: mgetty.texi
 	-texi2any --verbose --html --force --no-split mgetty.texi
@@ -79,7 +82,7 @@ install: $(MANSRC) mgetty.info
 		$(INSTALL) -m 644 $$i $(MAN8DIR) ; \
 	done
 	if [ -f mgetty.info ] ; then\
-	    test -d $(INFODIR) || mkdir $(INFODIR) 2>/dev/null ; \
+	    test -d $(INFODIR) || mkdir -p $(INFODIR) 2>/dev/null ; \
 	    for i in mgetty.info* ; do \
 		$(INSTALL) -m 644 $$i $(INFODIR) ; \
 	    done ; \
@@ -92,8 +95,8 @@ doc-tar: ../mgetty0$(VS)doc.tar.gz
 ../mgetty0$(VS)doc.tar.gz: doc-all mgetty.html
 	gtar cvvf ../mgetty0$(VS)doc.tar mgetty.texi mgetty.info* \
 				         mgetty.dvi mgetty.ps \
-				         mgetty.ms mgetty.asc \
 					 mgetty.html *.man
+#				         mgetty.ms mgetty.asc
 	gzip -f -9 -v ../mgetty0$(VS)doc.tar
 
 # explicit man page dependencies
