#
#  cad/librt -- Ray-Tracing Library
#		Generates librt.a, for use with applications
#
#  Source -
#	SECAD/VLD Computing Consortium, Bldg 394
#	The U. S. Army Ballistic Research Laboratory
#	Aberdeen Proving Ground, Maryland  21005
#  
#  Copyright Notice -
#	This software is Copyright (C) 1985 by the United States Army.
#	All rights reserved.

CFLAGS=-O

# Place librt.a gets installed
LIBDIR=/usr/brl/lib

# Place to find #include <> files
INCLUDE=/usr/include

# Select one of:
#	timer42 (4.2BSD)
#	timer52 (System 5 Release 2)
#	timer52brl (System 5 Release 2 under 4.2BSD)
#	timerhep (Denelcor HEP)
SYS_TIMER=	timer42

PRODUCT=librt.a

CAD_HDRS =	../h/machine.h ../h/db.h ../h/mater.h \
		../h/raytrace.h ../h/vmath.h

RTLIB_HDRS =	complex.h cut.h debug.h plane.h polyno.h \
		rtdir.h

# Change or delete sqrt.{vax,gould}.s as appropriate
RTLIB_OBJS=arb.o ars.o bool.o cut.o complex.o dir.o ell.o error.o \
	mat.o mater.o pg.o polylib.o rec.o roots.o \
	shoot.o spline.o storage.o tgc.o $(SYS_TIMER).o \
	torus.o tree.o \
	sqrt.vax.o

RTLIB_SRCS=arb.c ars.c ell.c rec.c spline.c tgc.c torus.c \
	complex.c mat.c mater.c pg.c polylib.c roots.c $(SYS_TIMER).c \
	dir.c error.c storage.c \
	cut.c bool.c shoot.c tree.c

all:	$(PRODUCT)

librt.a: $(RTLIB_OBJS)
	ar uv librt.a $(RTLIB_OBJS)
	ranlib librt.a

lint:	$(CAD_HDRS) $(RTLIB_HDRS) $(RTLIB_SRCS)
#	lint -haxc 	$(RTLIB_SRCS) >rt.lint
	/usr/5bin/lint 	$(RTLIB_SRCS) >rt.lint

install: $(PRODUCT)
	-mv -f $(LIBDIR)/librt.a $(LIBDIR)/librt.bak.a
	cp librt.a $(LIBDIR)/librt.a
	ranlib $(LIBDIR)/librt.a
	chmod 644 ../dist/h/*.h
	cp $(CAD_HDRS) ../dist/h/.
	cp Makefile *.h *.c ../dist/librt/.

print: $(CAD_HDRS) $(RTLIB_HDRS) $(RTLIB_SRCS)
	pr $(CAD_HDRS) $(RTLIB_HDRS) $(RTLIB_SRCS) | qpr

tags:	${RTLIB_HDRS} ${RTLIB_SRCS}
	ctags ${RTLIB_HDRS} ${RTLIB_SRCS}

clean:
	rm -f *.o *~ librt.a core

clobber: clean
	rm -f $(PRODUCT)

#
#  #include dependencies
#
depend:
	for k in $(RTLIB_SRCS) $(APPL_SRCS); do \
		i=`basename $$k .c`; \
		(echo $$i.o: $$i.c >>makedep; \
		grep '^#include' /dev/null $$i.c | sed \
			-e 's,c:[^"]*"\./\([^"]*\)".*,o: \1,' \
			-e 's,c:[^"]*"/\([^"]*\)".*,o: /\1,' \
			-e 's,c:[^"]*"\([^"]*\)".*,o: \1,' \
			-e '/debug.h/d' \
			-e "s,c:[^<]*<\(.*\)>.*,o: $(INCLUDE)/\1," \
			>>makedep); done
	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
# DEPENDENCIES MUST END AT END OF FILE
arb.o: arb.c
ars.o: ars.c
ell.o: ell.c
rec.o: rec.c
spline.o: spline.c
tgc.o: tgc.c
torus.o: torus.c
complex.o: complex.c
mat.o: mat.c
mater.o: mater.c
arb.o: arb.c
arb.o: /usr/include/stdio.h
arb.o: /usr/include/math.h
arb.o: ../h/machine.h
arb.o: ../h/vmath.h
arb.o: ../h/raytrace.h
ars.o: ars.c
ars.o: /usr/include/stdio.h
ars.o: /usr/include/math.h
ars.o: ../h/machine.h
ars.o: ../h/vmath.h
ars.o: ../h/db.h
ars.o: ../h/raytrace.h
ars.o: rtdir.h
ell.o: ell.c
ell.o: /usr/include/stdio.h
ell.o: /usr/include/math.h
ell.o: ../h/machine.h
ell.o: ../h/vmath.h
ell.o: ../h/db.h
ell.o: ../h/raytrace.h
rec.o: rec.c
rec.o: /usr/include/stdio.h
rec.o: /usr/include/math.h
rec.o: ../h/machine.h
rec.o: ../h/vmath.h
rec.o: ../h/db.h
rec.o: ../h/raytrace.h
spline.o: spline.c
spline.o: /usr/include/stdio.h
spline.o: /usr/include/math.h
spline.o: ../h/machine.h
spline.o: ../h/vmath.h
spline.o: ../h/db.h
spline.o: ../h/raytrace.h
tgc.o: tgc.c
tgc.o: /usr/include/stdio.h
tgc.o: ../h/machine.h
tgc.o: ../h/vmath.h
tgc.o: ../h/db.h
tgc.o: ../h/raytrace.h
tgc.o: polyno.h
tgc.o: complex.h
tgc.o: /usr/include/math.h
torus.o: torus.c
torus.o: /usr/include/stdio.h
torus.o: /usr/include/math.h
torus.o: ../h/machine.h
torus.o: ../h/vmath.h
torus.o: ../h/db.h
torus.o: ../h/raytrace.h
torus.o: polyno.h
torus.o: complex.h
complex.o: complex.c
complex.o: /usr/include/stdio.h
complex.o: /usr/include/math.h
complex.o: ../h/machine.h
complex.o: ../h/vmath.h
complex.o: ../h/raytrace.h
complex.o: complex.h
mat.o: mat.c
mat.o: /usr/include/stdio.h
mat.o: /usr/include/math.h
mat.o: ../h/machine.h
mat.o: ../h/vmath.h
mater.o: mater.c
mater.o: /usr/include/stdio.h
mater.o: ../h/machine.h
mater.o: ../h/vmath.h
mater.o: ../h/db.h
mater.o: ../h/mater.h
mater.o: rtdir.h
mater.o: ../h/raytrace.h
pg.o: pg.c
pg.o: /usr/include/stdio.h
pg.o: /usr/include/math.h
pg.o: ../h/machine.h
pg.o: ../h/vmath.h
pg.o: ../h/db.h
pg.o: ../h/raytrace.h
pg.o: rtdir.h
polylib.o: polylib.c
polylib.o: /usr/include/stdio.h
polylib.o: /usr/include/math.h
polylib.o: /usr/include/signal.h
polylib.o: /usr/include/setjmp.h
polylib.o: ../h/machine.h
polylib.o: ../h/vmath.h
polylib.o: polyno.h
polylib.o: complex.h
roots.o: roots.c
roots.o: /usr/include/math.h
roots.o: /usr/include/stdio.h
roots.o: ../h/machine.h
roots.o: ../h/vmath.h
roots.o: polyno.h
roots.o: complex.h
timer42.o: timer42.c
timer42.o: /usr/include/stdio.h
timer42.o: /usr/include/sys/types.h
timer42.o: /usr/include/sys/time.h
timer42.o: /usr/include/sys/resource.h
dir.o: dir.c
dir.o: /usr/include/stdio.h
dir.o: ../h/machine.h
dir.o: ../h/vmath.h
dir.o: ../h/db.h
dir.o: ../h/raytrace.h
dir.o: rtdir.h
error.o: error.c
error.o: /usr/include/stdio.h
error.o: /usr/include/varargs.h
error.o: ../h/machine.h
error.o: ../h/vmath.h
error.o: ../h/raytrace.h
storage.o: storage.c
storage.o: /usr/include/stdio.h
storage.o: ../h/machine.h
storage.o: ../h/vmath.h
storage.o: ../h/raytrace.h
cut.o: cut.c
cut.o: /usr/include/stdio.h
cut.o: /usr/include/math.h
cut.o: ../h/machine.h
cut.o: ../h/vmath.h
cut.o: ../h/raytrace.h
cut.o: cut.h
bool.o: bool.c
bool.o: /usr/include/stdio.h
bool.o: ../h/machine.h
bool.o: ../h/vmath.h
bool.o: ../h/raytrace.h
shoot.o: shoot.c
shoot.o: /usr/include/stdio.h
shoot.o: ../h/machine.h
shoot.o: ../h/vmath.h
shoot.o: ../h/raytrace.h
shoot.o: cut.h
tree.o: tree.c
tree.o: /usr/include/stdio.h
tree.o: /usr/include/math.h
tree.o: ../h/machine.h
tree.o: ../h/vmath.h
tree.o: ../h/db.h
tree.o: ../h/raytrace.h
tree.o: rtdir.h
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
