$OpenBSD: patch-Makefile,v 1.5 2007/06/15 11:30:38 ajacoutot Exp $
--- Makefile.orig	Fri Jun 15 13:15:56 2007
+++ Makefile	Fri Jun 15 13:22:40 2007
@@ -4,7 +4,7 @@
 #
 # this is the C compiler to use (on SunOS, the standard "cc" does not
 # grok my code, so please use gcc there. On ISC 4.0, use "icc".).
-CC=gcc
+#CC=gcc
 #CC=cc
 #
 #### C Compiler Flags ####
@@ -102,7 +102,7 @@ CC=gcc
 #	    USTAT	  - ustat(), no statfs etc.
 #
 #CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL
-CFLAGS=-O2 -Wall -pipe
+CFLAGS+=-DAUTO_PPP -DPREFIX=\"${PREFIX}\"
 #CFLAGS=-O -DSVR4
 #CFLAGS=-O -DSVR4 -DSVR42
 #CFLAGS=-O -DUSE_POLL
@@ -144,7 +144,7 @@ CFLAGS=-O2 -Wall -pipe
 # For Linux, add "-lutil" if the linker complains about "updwtmp".
 #
 LDFLAGS=
-LIBS=
+LIBS=-lutil
 #LIBS=-lprot -lsocket				# SCO Unix
 #LIBS=-lsocket
 #LIBS=-lbsd					# OSF/1
@@ -164,7 +164,7 @@ LIBS=
 #
 # if your systems doesn't have one, use the shell script that I provide
 # in "inst.sh" (taken from X11R5). Needed on IRIX5.2
-INSTALL=install -c -o bin -g bin
+INSTALL=install -c -o root -g bin
 #INSTALL=install -c -o root -g wheel		# NeXT/BSD
 #INSTALL=/usr/ucb/install -c -o bin -g bin	# AIX, Solaris 2.x
 #INSTALL=installbsd -c -o bin -g bin		# OSF/1, AIX 4.1, 4.2
@@ -172,11 +172,11 @@ INSTALL=install -c -o bin -g bin
 #
 # prefix, where most (all?) of the stuff lives, usually /usr/local or /usr
 #
-prefix=/usr/local
+prefix?=${PREFIX}
 #
 # prefix for all the spool directories (usually /usr/spool or /var/spool)
 #
-spool=/var/spool
+spool?=/var/spool
 #
 # where the mgetty + sendfax binaries live (used for "make install")
 #
@@ -192,7 +192,7 @@ LIBDIR=$(prefix)/lib/mgetty+sendfax
 #
 # where the configuration files (*.config, aliases, fax.allow/deny) go to
 #
-CONFDIR=$(prefix)/etc/mgetty+sendfax
+CONFDIR?=${SYSCONFDIR}/mgetty+sendfax
 #CONFDIR=/etc/default/
 #
 #
@@ -216,7 +216,7 @@ FAX_SPOOL_OUT=$(FAX_SPOOL)/outgoing
 # (it's possible to run faxrunq(d) as root, but the FAX_OUT_USER 
 #  MUST NOT BE root or any other privileged account).
 #
-FAX_OUT_USER=fax
+FAX_OUT_USER=uucp
 #
 #
 # Where section 1 manual pages should be placed
@@ -263,7 +263,7 @@ PERL="/usr/bin/perl -w"
 # If you have Perl with TK extentions, define it here. This may be the
 # same as PERL=... above, or different, if you have TkPerl statically
 # linked.
-TKPERL=/usr/bin/tkperl
+#TKPERL=/usr/bin/tkperl
 #
 #
 # An echo program that understands escapes like "\n" for newline or
@@ -285,7 +285,7 @@ ECHO="echo"
 
 # To maintain security, I recommend creating a new group for
 # users who are allowed to manipulate the recorded voice messages.
-PHONE_GROUP=phone
+PHONE_GROUP=dialer
 PHONE_PERMS=770
 
 # Add -DNO_STRSTR to CFLAGS if you don't have strstr().
@@ -317,7 +317,7 @@ SFAXOBJ=sendfax.o logfile.o locks.o modem.o \
 
 all:	bin-all doc-all
 
-bin-all: mgetty sendfax newslock sedscript subdirs call-back 
+bin-all: mgetty sendfax newslock subdirs call-back vgetty
 
 # a few C files need extra compiler arguments
 
@@ -573,7 +573,7 @@ bindist: all doc-all sedscript
 	cd bindist; gtar cvvfz mgetty$(MR).$(SR)-bin.tgz *
 
 
-install: install.bin install.doc
+install: install.bin install.doc install-vgetty
 
 install.bin: mgetty sendfax newslock \
 		login.config mgetty.config sendfax.config 
@@ -581,30 +581,31 @@ install.bin: mgetty sendfax newslock \
 # binaries
 #
 	-test -d $(BINDIR)  || ( ./mkidirs $(BINDIR)  ; chmod 755 $(BINDIR)  )
-	$(INSTALL) -m 755 newslock $(BINDIR)
+	$(BSD_INSTALL_PROGRAM) newslock $(BINDIR)
 
 	-test -d $(SBINDIR) || ( ./mkidirs $(SBINDIR) ; chmod 755 $(SBINDIR) )
-	-mv -f $(SBINDIR)/mgetty $(SBINDIR)/mgetty.old
-	-mv -f $(SBINDIR)/sendfax $(SBINDIR)/sendfax.old
-	$(INSTALL) -s -m 700 mgetty $(SBINDIR)
-	$(INSTALL) -s -m 755 sendfax $(SBINDIR)
+#	-mv -f $(SBINDIR)/mgetty $(SBINDIR)/mgetty.old
+#	-mv -f $(SBINDIR)/sendfax $(SBINDIR)/sendfax.old
+	$(BSD_INSTALL_PROGRAM) -m 700 mgetty $(prefix)/libexec
+	$(BSD_INSTALL_PROGRAM) sendfax $(SBINDIR)
+	$(BSD_INSTALL_PROGRAM) callback/callback $(SBINDIR)
 #
 # data files + directories
 #
 	test -d $(LIBDIR)  || \
 		( ./mkidirs $(LIBDIR) &&  chmod 755 $(LIBDIR) )
-	test -d $(CONFDIR) || \
-		( ./mkidirs $(CONFDIR) && chmod 755 $(CONFDIR))
-	test -f $(CONFDIR)/login.config || \
-		$(INSTALL) -o root -m 600 login.config $(CONFDIR)/
-	test -f $(CONFDIR)/mgetty.config || \
-		$(INSTALL) -o root -m 600 mgetty.config $(CONFDIR)/
-	test -f $(CONFDIR)/sendfax.config || \
-		$(INSTALL) -o root -m 644 sendfax.config $(CONFDIR)/
-	test -f $(CONFDIR)/dialin.config || \
-		$(INSTALL) -o root -m 600 dialin.config $(CONFDIR)/
-	test -f $(CONFDIR)/faxrunq.config || \
-		$(INSTALL) -o root -m 644 faxrunq.config $(CONFDIR)/
+#	test -d $(CONFDIR) || \
+#		( ./mkidirs $(CONFDIR) && chmod 755 $(CONFDIR))
+#	test -f $(CONFDIR)/login.config || \
+		$(BSD_INSTALL_DATA) -m 600 login.config ${PREFIX}/share/examples/mgetty+sendfax
+#	test -f $(CONFDIR)/mgetty.config || \
+		$(BSD_INSTALL_DATA) -m 600 mgetty.config ${PREFIX}/share/examples/mgetty+sendfax
+#	test -f $(CONFDIR)/sendfax.config || \
+		$(BSD_INSTALL_DATA) sendfax.config ${PREFIX}/share/examples/mgetty+sendfax
+#	test -f $(CONFDIR)/dialin.config || \
+		$(BSD_INSTALL_DATA) -m 600 dialin.config ${PREFIX}/share/examples/mgetty+sendfax
+#	test -f $(CONFDIR)/faxrunq.config || \
+		$(BSD_INSTALL_DATA) faxrunq.config ${PREFIX}/share/examples/mgetty+sendfax
 #
 # test for outdated stuff
 #
@@ -618,28 +619,28 @@ install.bin: mgetty sendfax newslock \
 #
 # fax spool directories
 #
-	test -d $(spool) || \
-		( mkdir $(spool) && chmod 755 $(spool) )
-	test -d $(FAX_SPOOL) || \
-		( mkdir $(FAX_SPOOL) && \
-		  chown $(FAX_OUT_USER) $(FAX_SPOOL) && \
-		  chmod 755 $(FAX_SPOOL) )
-	test -d $(FAX_SPOOL_IN) || \
-		( mkdir $(FAX_SPOOL_IN) && chmod 755 $(FAX_SPOOL_IN) )
-	test -d $(FAX_SPOOL_OUT) || \
-		  mkdir $(FAX_SPOOL_OUT)
-	chown $(FAX_OUT_USER) $(FAX_SPOOL_OUT)
-	chmod 755 $(FAX_SPOOL_OUT)
+#	test -d $(spool) || \
+#		( mkdir $(spool) && chmod 755 $(spool) )
+#	test -d $(FAX_SPOOL) || \
+#		( mkdir $(FAX_SPOOL) && \
+#		  chown $(FAX_OUT_USER) $(FAX_SPOOL) && \
+#		  chmod 755 $(FAX_SPOOL) )
+#	test -d $(FAX_SPOOL_IN) || \
+#		( mkdir $(FAX_SPOOL_IN) && chmod 755 $(FAX_SPOOL_IN) )
+#	test -d $(FAX_SPOOL_OUT) || \
+#		  mkdir $(FAX_SPOOL_OUT)
+#	chown $(FAX_OUT_USER) $(FAX_SPOOL_OUT)
+#	chmod 755 $(FAX_SPOOL_OUT)
 #
 # g3 tool programs
 #
-	cd g3 ; $(MAKE) install INSTALL="$(INSTALL)" \
+	cd g3 ; $(MAKE) install INSTALL="$(BSD_INSTALL_PROGRAM)" \
 				BINDIR=$(BINDIR) \
 				LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR)
 #
 # fax programs / scripts / font file
 #
-	cd fax ; $(MAKE) install INSTALL="$(INSTALL)" \
+	cd fax ; $(MAKE) install INSTALL="$(BSD_INSTALL_PROGRAM)" \
 				FAX_OUT_USER=$(FAX_OUT_USER) \
 				BINDIR=$(BINDIR) SBINDIR=$(SBINDIR) \
 				LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR)
@@ -649,14 +650,14 @@ install.bin: mgetty sendfax newslock \
 	if [ ! -z "$(INSTALL_MECHO)" ] ; then \
 	    cd compat ; \
 	    $(CC) $(CFLAGS) -o mg.echo mg.echo.c && \
-	    $(INSTALL) -s -m 755 mg.echo $(BINDIR) ; \
+	    $(BSD_INSTALL_PROGRAM) mg.echo $(BINDIR) ; \
 	fi
 
 #
 # documentation
 #
 install.doc:
-	cd doc ; $(MAKE) install INSTALL="$(INSTALL)" \
+	cd doc ; $(MAKE) install INSTALL="$(BSD_INSTALL_MAN)" \
 				MAN1DIR=$(MAN1DIR) \
 				MAN4DIR=$(MAN4DIR) \
 				MAN5DIR=$(MAN5DIR) \
@@ -667,7 +668,7 @@ install.doc:
 # WWW frontend stuff
 #
 install.www:
-	cd frontends/www ; $(MAKE) install.www INSTALL="$(INSTALL)" \
+	cd frontends/www ; $(MAKE) install.www INSTALL="$(BSD_INSTALL_PROGRAM)" \
 				BINDIR=$(BINDIR) \
 				LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR)
 #
@@ -685,7 +686,7 @@ vgetty:
 
 vgetty-install: sedscript
 	cd voice; $(MAKE) CFLAGS="$(CFLAGS)" CC="$(CC)" LDFLAGS="$(LDFLAGS)" \
-	BINDIR="$(BINDIR)" SBINDIR="$(SBINDIR)" LIBDIR="$(LIBDIR)" \
+	BINDIR="$(BINDIR)" SBINDIR="$(prefix)/libexec" LIBDIR="$(LIBDIR)" \
 	CONFDIR="$(CONFDIR)" MAN1DIR="$(MAN1DIR)" MAN8DIR="$(MAN8DIR)" INSTALL="$(INSTALL)" \
 	PHONE_GROUP="$(PHONE_GROUP)" PHONE_PERMS="$(PHONE_PERMS)" \
 	LN="$(LN)" MV="$(MV)" RM="$(RM)" \
