# Makefile for swho, a display utility for showing active users and ttys.
#
# Written by Paul Pomes, University of Illinois, Computing Services Office
# Copyright 1985 by Paul Pomes and University of Illinois Board of Trustees
#
# UUCP:		{ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!paul
# ARPANET:	paul%uiucuxc@uiuc.arpa
# CSNET:	paul%uiucuxc@uiuc.csnet
# US Mail:	Univ of Illinois, CSO, 1304 W Springfield Ave, Urbana, IL  61801
#
# $Header$

CFLAGS=  -O
LDFLAGS=
LIBS   = -lcurses -ltermlib
DESTBIN= /usr/local/bin
DESTLIB= /usr/local/lib
MAN    = l

# make depend doesn't work with single file names as grep doesn't prepend
# the "file.c: " string in front of the match.  Quick and dirty kludge is
# to put the filename twice on the SRCS line.

SRCS   = swho.c
OBJS   = swho.o

.DEFAULT:
	co $<

all:	swho

#
# RCS stuff
#
ci:		$(SRCS)
		-ci $?
		@touch ci

coall:
		co -l $(SRCS)

update:
		ci -sDist -u -f$(VERS) $(SRCS)
		@touch ci

swho:	${OBJS}
	cc -o swho ${LDFLAGS} ${OBJS} ${LIBS}

install:	swho
	install -s swho ${DESTBIN}
	cp swho.1 /usr/man/man${MAN}/swho.${MAN}

clean:
	rm -f swho *.o core a.out make.log lint.out

clobber:
	make clean
	rm -f ${SRCS}

lint:	${SRCS}
	lint -habx ${SRCS}

compress:
	make clean
	find . -size +2 \( -name \*.c -o -name \*.f -o -name \*.h \
		-o -name \*.l -o -name \*,v \) -exec compress {} \;

uncompress:
	uncompressdir .

depend:
	grep '^#include' ${SRCS} \
		| sed -e '/"/s/:[^"]*"\([^"]*\)".*/: \1/' \
		      -e '/</s/:[^<]*<\([^>]*\)>.*/: \/usr\/include\/\1/' \
		| sed 's/\.c/.o/' >makedep
	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp Makefile Makefile.bak
	ed - Makefile < eddep
	rm eddep makedep
	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
	echo '# see make depend above' >> Makefile

# DO NOT DELETE THIS LINE -- make depend uses it

swho.o: /usr/include/stdio.h
swho.o: /usr/include/utmp.h
swho.o: /usr/include/strings.h
swho.o: /usr/include/sys/time.h
swho.o: /usr/include/signal.h
swho.o: /usr/include/curses.h
swho.o: /usr/include/sys/types.h
swho.o: /usr/include/sys/stat.h
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
