# Make file for the research project
#
# $Header: makefile,v 1.1 87/03/31 11:13:28 tsay Locked $
# $Source: /oc/kuh/tsay/RESEARCH/PROUD/INPUT/RCS/makefile,v $
#

CFILES	= readin.c readcell.c readcnf.c readnetw.c

COBJS 	= readin.o readcell.o readcnf.o readnetw.o

SUBCOBJS =

HFILES = ../include/prdef.h ../include/prstr.h

TARGET  = bell

SOURCE=	${CFILES}
 
ALLFILES= ${SOURCE} makefile tags .pr

LINTFLAGS =

CFLAGS = -g -X ${LINTFLAGS}

LDFLAGS=

LIBS = -lm

CTAGS	= ctags

.c.o :
	cc ${CFLAGS} ${LIBS} -c $*.c

${TARGET}:	${COBJS} tags
	touch ${TARGET}

test: ${COBJS} test.o
	cc ${CFLAGS} ${LIBS} ${COBJS} test.o -o test

lint:
	lint -hav ${CFILES} > lint.out
 
tags:	${CFILES}
	${CTAGS} -u $?
clean:
	-rm -f ${COBJS} 

lp: .pr
.pr: NONEXISTENT
	csh .pr ${SOURCE} makefile tags
#	touch .pr
NONEXISTENT:
	echo force the make
 
get:
	sccs get ${SOURCE}
edit:
	sccs edit ${SOURCE} ${HFILE}
ip:
	pr -f ${SOURCE} | lpr -Pkip &
 
depend: ${SOURCE}
	grep	'^#include' ${CFILES}		| grep -v '<'		\
	| sed	's/:[^"]*"\([^"]*\)".*/: \1/'				\
	| sed	's/\.c/.o/' | sed 's,../[a-z]*/,,'			\
	| awk	' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; }\
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; }\
		else rec = rec " " $$2 } }				\
		END { print rec } '					\
	> makedep
#	grep	'^#include' ${HFILES}		| grep -v '<'		\
#	| sed	-e 's/:[^"]*"\([^"]*\)".*/: \1/p'			\
#		-e 's/\([^:]*\):.*/	$${TOUCH} \1/'			\
#	>> makedep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d'	>  eddep
	echo '$$r makedep'				>> eddep
	echo 'w'					>> eddep
	ed - < eddep makefile
	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
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
