#
#   Makefile for phone client          20 December 1985
#


# What all this stuff means::
#  SERVICES   - define this is you have an entry for phone in /etc/services
#  PORT       - if SERVICES is not defined, set this to the port number that
#               phone should use (this overrides the default)
#  LOCAL_ECHO - if this is defined, what the user types will be echoed
#               locally, and the remote echo will be ignored. The option
#               is really an old relic, and should always be on.
#
# Also:
#   o  Add "-lresolv" to the library if you want to use the network name
#      server and have the library routines.
#   o  Add "-Dvoid=int" if your compiler doesn't know about the void type.


CC     = cc
CFLAGS = -O -DSERVICES -DLOCAL_ECHO
LIBS   = -lcurses -ltermlib -lresolv

LPR    = lpr -Pvax
RDEST  = /usr/local/phone

HDRS = defs.h

SRCS = alias.c calls.c check_invite.c connect_daemon.c cmd.c \
		getdaemon.c kb.c main.c message.c misc.c names.c \
		parse.c readctl.c readrc.c readstream.c runprog.c \
		sendit.c set.c sig.c stop.c strsave.c tilde.c timer.c \
		who.c windows.c

OBJS = alias.o calls.o check_invite.o connect_daemon.o cmd.o \
		getdaemon.o kb.o main.o message.o misc.o names.o \
		parse.o readctl.o readrc.o readstream.o runprog.o \
		sendit.o set.o sig.o stop.o strsave.o tilde.o timer.o \
		who.o windows.o

DEST = phone


.DEFAULT:
	co $<

all:	${DEST}

${DEST}: ${OBJS}
	/bin/rm -f ${DEST}
	${CC} ${CFLAGS} -o ${DEST} ${OBJS} ${LIBS}

${OBJS}: ${HDRS}

install: ${DEST}
	/bin/rm -f ${RDEST}
	cp ${DEST} ${RDEST}

print:	${HDRS} ${SRCS}
	pr -f ${HDRS} ${SRCS} | expand -4 | ${LPR}

tags:	/dev/null
	ctags -w ${HDRS} ${SRCS}

tar: ${HDRS} ${SRCS}
	tar cf client.tar ${HDRS} ${SRCS} Makefile

shar:	Makefile ${HDRS} ${SRCS}
	shar -v Makefile ${HDRS} ${SRCS} > ../shar.client

clean:
	/bin/rm -f ${OBJS} ${DEST} core

lint: ${HDRS} ${SRCS}
	lint ${CFLAGS} ${SRCS} > lint.out

dist:	${DEST}
	-rcp ${DEST} buddy:${RDEST}
	-rcp ${DEST} franny:${RDEST}
	-rcp ${DEST} holden:${RDEST}
	-rcp ${DEST} seymour:${RDEST}
	-rcp ${DEST} zooey:${RDEST}
	-rcp ${DEST} miro:${RDEST}
	-rcp ${DEST} cory:${RDEST}


depend: ${SRCS}
	mv Makefile makefile.old
	sed '/^# Dependencies follow/,$$d' makefile.old > Makefile
	echo '# Dependencies follow' >> Makefile
	includes -so ${SRCS} >> Makefile
	echo ' ' >> Makefile
	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
	echo '# see depend: above' >> Makefile

# DO NOT DELETE THE FOLLOWING LINE
# Dependencies follow

who.o: /usr/include/sys/file.h

who.o: /usr/include/utmp.h

runprog.o: /usr/include/fcntl.h

runprog.o: /usr/include/sys/resource.h

runprog.o: /usr/include/sys/wait.h

tilde.o names.o: /usr/include/pwd.h

windows.o stop.o runprog.o readstream.o misc.o kb.o: /usr/include/sgtty.h

windows.o stop.o runprog.o readstream.o misc.o kb.o: /usr/include/curses.h

windows.o stop.o sig.o runprog.o readstream.o misc.o kb.o: \
/usr/include/sys/ttydev.h

windows.o stop.o sig.o runprog.o readstream.o misc.o kb.o: \
/usr/include/sys/ttychars.h

windows.o windows.o stop.o sig.o runprog.o readstream.o misc.o kb.o: \
/usr/include/sys/ioctl.h

runprog.o main.o getdaemon.o: /usr/include/errno.h

windows.o strsave.o stop.o sig.o message.o main.o getdaemon.o \
connect_daemon.o: /usr/include/signal.h

sendit.o runprog.o getdaemon.o calls.o: /usr/include/time.h

sendit.o runprog.o getdaemon.o calls.o: /usr/include/sys/time.h

who.o names.o connect_daemon.o calls.o: /usr/include/netdb.h

who.o runprog.o readstream.o readctl.o names.o main.o getdaemon.o \
connect_daemon.o check_invite.o calls.o: ./../common.h

windows.o strsave.o stop.o runprog.o readstream.o readrc.o names.o misc.o \
message.o main.o kb.o connect_daemon.o calls.o: /usr/include/stdio.h

windows.o who.o stop.o set.o sendit.o runprog.o readstream.o readrc.o \
readctl.o names.o misc.o message.o main.o kb.o getdaemon.o connect_daemon.o \
check_invite.o calls.o alias.o: /usr/include/netinet/in.h

windows.o who.o stop.o set.o sendit.o runprog.o readstream.o readrc.o \
readctl.o names.o misc.o message.o main.o kb.o getdaemon.o connect_daemon.o \
check_invite.o calls.o alias.o: /usr/include/sys/socket.h

windows.o who.o stop.o set.o sendit.o runprog.o runprog.o readstream.o \
readrc.o readctl.o names.o misc.o message.o main.o kb.o getdaemon.o \
connect_daemon.o check_invite.o calls.o alias.o: /usr/include/sys/types.h

windows.o who.o stop.o set.o sendit.o runprog.o readstream.o readrc.o \
readctl.o names.o misc.o message.o main.o kb.o getdaemon.o connect_daemon.o \
check_invite.o calls.o alias.o: ./defs.h
 
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see depend: above
