# makefile for bb

CC=CC
DBX= -g
LIBS= -lm
CFLAGS= 
LFLAGS= -hbx
SRC= Area.C BB.C Client.C Entry.C Monitor.C Notifier.C Notifier_entry.C Poster.C Pty.C Tracer.C error_handling.C pty.c
OBJ= Area.o BB.o Client.o Entry.o Monitor.o Notifier.o Notifier_entry.o Poster.o Pty.o Tracer.o error_handling.o pty.o

bb:	${OBJ}
	${CC} ${CFLAGS} ${DBX} -o bb ${OBJ}

clean:
	rm -f core lintout makeout tags makefile.bak *.o

lintout: ${SRC}
	\@rm -f lintout
	lint ${LFLAGS} ${SRC} >lintout

errs:
	\@rm -f makeout
	make  >makeout

tags:	${SRC}
	\@rm -f tags
	ctags ${SRC}

.SUFFIXES: .C
.C.o:
	${CC} ${CFLAGS} ${DBX} -c $*.C

source:
	mv makefile makefile.bak
	head -7 makefile.bak >makefile
	echo SRC= `ls *.C` >>makefile
	echo OBJ= `ls *.C | sed s/C$$/o/` >>makefile
	tail +10 <makefile.bak >>makefile

depend: ${SRC}
	for i in ${SRC};  \
	do \
		/lib/cpp  -M -Y/usr/CC/sun4/incl $$i \
		| grep -v /usr/CC/sun4/incl \
		|  sort -u \
		|  sed -e 's, \./, ,' \
		|  awk ' \
				{ if ($$1 != prev) { \
					if (rec != "")   print rec; \
					rec = $$0;  prev = $$1;\
			 	  } else {print rec "   \\"; rec = "	" $$2}\
				} \
			END { print rec } \
		'; \
	done >makedep
	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo '$$r makedep'
	echo 'w' >>eddep
	cp makefile makefile.bak
	ed - makefile <eddep
	rm eddep makedep
	echo '' >>makefile
	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

Area.o: Area.h   \
	Client.h   \
	Entry.h   \
	List.h   \
	Tracer.h   \
	Area.C
BB.o: Area.h   \
	Client.h   \
	Entry.h   \
	List.h   \
	Notifier.h   \
	Notifier_entry.h   \
	Poster.h   \
	Tracer.h   \
	BB.C
Client.o: Client.h   \
	Tracer.h   \
	Client.C
Entry.o: Client.h   \
	Entry.h   \
	List.h   \
	Tracer.h   \
	Entry.C
Monitor.o: Client.h   \
	List.h   \
	Monitor.h   \
	Pty.h   \
	Tracer.h   \
	Monitor.C
Notifier.o: Client.h   \
	List.h   \
	Notifier.h   \
	Notifier_entry.h   \
	Tracer.h   \
	Notifier.C
Notifier_entry.o: Client.h   \
	Notifier_entry.h   \
	Tracer.h   \
	Notifier_entry.C
Poster.o: Area.h   \
	Client.h   \
	Entry.h   \
	List.h   \
	Poster.h   \
	Tracer.h   \
	Poster.C
Pty.o: Pty.h   \
	Pty.C
Tracer.o: Tracer.h   \
	Tracer.C
error_handling.o: error_handling.C
pty.o: pty.c

# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
