# This is the Makefile for uupoll and autopoll
# borrowed and hacked from Taylor UUCP 1.04

# Prefix directory for installation directories.
prefix = /usr/local

# The user name/group that should own the resulting executables.
# Both should run suid.
owner = uucp.daemon

# Which mode should the resulting executables have.
emode = 4111

# Where to install autopoll. This definition requires $(prefix)/lib to exist.
lbindir = $(prefix)/lib/uucp

# Where to install uupoll
bbindir = $(prefix)/bin

# Where to install man pages.  Section 8 for daemons.
man8dir = $(prefix)/man/man8
man8ext = .8c

# Define programs and flags
CC = gcc
CFLAGS = -O2
LDFLAGS = -s
LIBS =

INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644

#
# Nothing else to configure
#

SHELL = /bin/sh

VERSION = 1.00

MORECFLAGS = -I. -Wall

PROGRAMS = uupoll autopoll

UUPOLLOBJS = uupoll.o
AUTOOBJS = autopoll.o

ALLOBJS = uupoll.o autopoll.o

all: $(PROGRAMS)

install: $(PROGRAMS)
	if test -d $(lbindir); then true; else mkdir $(lbindir); fi
	if test -d $(bbindir); then true; else mkdir $(bbindir); fi
	-if test -f $(lbindir)/autopoll.old; then rm -f $(lbindir)/autopoll; else mv $(lbindir)/autopoll $(lbindir)/autopoll.old; fi
	-if test -f $(bbindir)/uupoll.old; then rm -f $(bbindir)/uupoll; else mv $(bbindir)/uupoll $(bbindir)/uupoll.old; fi
	$(INSTALL_PROGRAM) autopoll $(lbindir)/autopoll
	$(INSTALL_PROGRAM) uupoll $(bbindir)/uupoll
	chown $(owner) $(lbindir)/autopoll $(bbindir)/uupoll
	chmod $(emode) $(lbindir)/autopoll $(bbindir)/uupoll
	$(INSTALL_DATA) uupoll.8c $(man8dir)/uupoll$(man8ext)
	$(INSTALL_DATA) autopoll.8c $(man8dir)/autopoll$(man8ext)

uninstall:
	rm -f $(lbindir)/autopoll $(bbindir)/uupoll
	rm -f $(man8dir)/autopoll$(man8ext) $(man8dir)/uupoll$(man8ext)
	-cp $(lbindir)/autopoll.old $(lbindir)/autopoll
	-cp $(bbindir)/uupoll.old $(bbindir)/uupoll
	-chown $(owner) $(lbindir)/autopoll $(bbindir)/uupoll
	-chmod $(emode) $(lbindir)/autopoll $(bbindir)/uupoll

uupoll: $(UUPOLLOBJS)
	$(CC) $(LDFLAGS) -o uupoll $(UUPOLLOBJS) $(LIBS)

autopoll: $(AUTOOBJS)
	$(CC) $(LDFLAGS) -o autopoll $(AUTOOBJS) $(LIBS)

.c.o:
	$(CC) -c $(CFLAGS) $(MORECFLAGS) $<


clean:
	rm -f $(ALLOBJS) $(PROGRAMS)

mostlyclean: clean

TAGS:
	etags *.h *.c

# Header file dependencies.  These are maintained by hand.

$(ALLOBJS): conf.h

.NOEXPORT:
