# -*-Makefile-*- for nwrite 1.9.2
# 
#  Copyright 1993 by Marco Nicosia <marco@csua.berkeley.edu>
#  Copyright 1994-95 by Aaron Smith <aaron@csua.berkeley.edu>
#  Copyright 1995-98 by Alan Coopersmith <alanc@csua.berkeley.edu>
#  All rights reserved.  (see README for license details)
#
# The makefile should be generated automatically with the correct
# options by the configure script - see the INSTALL file for details
#
###################################################################
# 20021103 <tmancill@debian.org> - slight tweaks
#	this thing is hopelessly outdated... :) 
###################################################################

################## Configuration Section##################
# Choose your compiler and other options
# Options:
# 	-DCLEAR_PROCS	- allow users to clear the list of names they
#			  are writing to from the ps output (if your
#			  OS supports it - many don't)

CC	= @CC@
CFLAGS 	= @DEFS@ @CFLAGS@ -DSYSTEM_NWRITERC=\"${SYSTEM_NWRITERC}\"
LDFLAGS	= @LDFLAGS@
LIBS	= @LIBS@

# Install program - choose one with BSD semantics (GNU is okay too, but
# SysV install won't work)
INSTALL = @INSTALL@
INSTALLFLAGS = @INSTALLFLAGS@
# Use this line if your ttys are world writable
#INSTALLFLAGS=-m 755
# Use this line if your ttys are only writable by group tty
#INSTALLFLAGS=-g tty -m 2755

# Where do you want the files installed?
prefix	= @prefix@
exec_prefix = @exec_prefix@
BIN	= @bindir@
MAN	= @mandir@
CONF	= @sysconfdir@

# Some systems like to gzip man pages, if yours is one, set MANGZ=-gz
MANGZ	= @MANGZ@

################## End of configuration ##################
# You shouldn't need to change anything after this point #

SYSTEM_NWRITERC=${CONF}/nwrite.rc

OBJECTS=nwrite.o

all: 	Makefile nwrite

nwrite: $(OBJECTS)
	$(CC) $(CFLAGS) -o nwrite $(OBJECTS) $(LDFLAGS)

install: Makefile installbin installman$(MANGZ) installrc

installbin: nwrite
	# this is unnecessary - there is no old file
	#-mv $(BIN)/nwrite $(BIN)/nwrite.old
	$(INSTALL) -c $(INSTALLFLAGS) nwrite $(BIN)/nwrite
	# this is also unnecessary, debhelper does this for us
	#strip $(BIN)/nwrite

installman: nwrite.1
	#-\rm $(MAN)/man1/nwrite.1 
	$(INSTALL) -c -m 644 nwrite.1 $(prefix)/$(MAN)/man1/nwrite.1

installman-gz: installman
	#-\rm $(MAN)/cat1/nwrite.1.gz
	#gzip $(MAN)/cat1/nwrite.1

installrc: nwrite.rc
	$(INSTALL) -c -m 644 nwrite.rc debian/nwrite/$(SYSTEM_NWRITERC)

Makefile: Makefile.in
	sh ./config.status

config.h: config.h.in
	sh ./config.status

config.h.in: configure.in acconfig.h
	autoheader

nwrite.1: nwrite.1.in
	#-\rm nwrite.1
	sed -e "s%SYSTEM_NWRITERC%$(SYSTEM_NWRITERC)%" nwrite.1.in > nwrite.1

clean:
	-\rm nwrite $(OBJECTS)

distclean: clean
	-\rm Makefile config.cache config.status config.log config.h nwrite.1
