# 
# Copyright 1986, 1987, 1988, 1989 University of Wisconsin
# 
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of the University of
# Wisconsin not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.  The University of Wisconsin makes no representations about
# the suitability of this software for any purpose.  It is provided "as
# is" without express or implied warranty.
# 
# THE UNIVERSITY OF WISCONSIN DISCLAIMS ALL WARRANTIES WITH REGARD TO
# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS. IN NO EVENT SHALL THE UNIVERSITY OF WISCONSIN  BE LIABLE FOR
# ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# 
# Authors:  Allan Bricker and Michael J. Litzkow,
# 	         University of Wisconsin, Computer Sciences Dept.
# 
# 




#
# The following variables must be passed in to this makefile:
#
#	SRCDIR	=	The pathname (relative or absolute) of the source
#				directory (eg. ../src, /var/home/condor/CONDOR/src)
#
#	DSTDIR	=	The pathname (relative or absolute) of the directory
#				which will contain the installed binaries and libraries.
#				There must be "bin" and "lib" subdirectories within DSTDIR.
#
#	COPTS	=	Default flags to cc (eg -O, -g)
#
#	IDENT	=	Any #defines which are not automatically supplied
#				by cpp (eg. -Dsunos40 or -Dsunos32).  Note that
#				cpp provides definitions for architectures (eg.
#				vax, sun, mc68020, sparc)
#

DIRECTORY=xdr_lib

PDIR=$(SRCDIR)/$(DIRECTORY)
CFLAGS=$(COPTS) -I$(SRCDIR)/h $(IDENT)

#
#	Options to 'ctags'
#
TFLAGS=-dt

#
#	Each file in the CSRC list should be prepended by $(PDIR).
#
CSRC= \
	$(PDIR)/xdr_Init.c \
	$(PDIR)/xdr_io.c \
	$(PDIR)/xdr_ports.c \
	$(PDIR)/xdr_wait.c \
	$(PDIR)/xdr_stat.c \
	$(PDIR)/xdr_timeval.c \
	$(PDIR)/xdr_timezone.c \
	$(PDIR)/xdr_fdset.c \
	$(PDIR)/xdr_ptr.c \
	$(PDIR)/xdr_itimerval.c \
	$(PDIR)/xdr_record.c \
	$(PDIR)/xdr_rlimit.c \
	$(PDIR)/xdr_direntries.c \
	$(PDIR)/xdr_statfs.c \
	$(PDIR)/xdr_rusage.c \
	$(PDIR)/xdr_proc.c \
	$(PDIR)/xdr_expr.c \
	$(PDIR)/xdr_status.c \
	$(PDIR)/xdr_prio_rec.c \
	$(PDIR)/xdr_mach_rec.c \
	$(PDIR)/xdr_strings.c \
	$(PDIR)/xdr_float.c

SSRC=

SRC=$(CSRC) $(SSRC)

OBJ = xdr_Init.o xdr_io.o \
		xdr_ports.o \
		xdr_wait.o xdr_stat.o xdr_timeval.o xdr_timezone.o xdr_fdset.o \
		xdr_ptr.o xdr_itimerval.o xdr_record.o xdr_rlimit.o xdr_direntries.o \
		xdr_statfs.o xdr_rusage.o xdr_proc.o \
		xdr_expr.o xdr_status.o xdr_mach_rec.o xdr_prio_rec.o xdr_strings.o \
		xdr_float.o
LIB=../util_lib/util_lib.a ../xdr_lib/xdr_lib.a

PROGRAMS=xdr_lib.a
CLEANUP=$(OBJ) $(PROGRAMS) $(PDIR)/Makefile.bak

all: $(PROGRAMS)

ALWAYS:

release: $(PROGRAMS)
	@echo No installation for: $(PROGRAMS)

lint: ALWAYS
	lint -Cxdr -DLINT -I$(SRCDIR)/h $(IDENT) $(CSRC)

clean: ALWAYS
	rm -f $(CLEANUP)

tags: ALWAYS
	cd $(PDIR) ; ctags $(TFLAGS) $(CSRC)

#############################################################################
# Put program specific things here
#############################################################################

xdr_lib.a: $(OBJ)
	rm -f xdr_lib.a
	ar r xdr_lib.a $(OBJ)
	ranlib xdr_lib.a

xdr_Init.o: $(PDIR)/xdr_Init.c
	cc -c $(CFLAGS) $(PDIR)/xdr_Init.c

xdr_direntries.o: $(PDIR)/xdr_direntries.c
	cc -c $(CFLAGS) $(PDIR)/xdr_direntries.c

xdr_expr.o: $(PDIR)/xdr_expr.c
	cc -c $(CFLAGS) $(PDIR)/xdr_expr.c

xdr_fdset.o: $(PDIR)/xdr_fdset.c
	cc -c $(CFLAGS) $(PDIR)/xdr_fdset.c

xdr_io.o: $(PDIR)/xdr_io.c
	cc -c $(CFLAGS) $(PDIR)/xdr_io.c

xdr_itimerval.o: $(PDIR)/xdr_itimerval.c
	cc -c $(CFLAGS) $(PDIR)/xdr_itimerval.c

xdr_off_t.o: $(PDIR)/xdr_off_t.c
	cc -c $(CFLAGS) $(PDIR)/xdr_off_t.c

xdr_ports.o: $(PDIR)/xdr_ports.c
	cc -c $(CFLAGS) $(PDIR)/xdr_ports.c

xdr_proc.o: $(PDIR)/xdr_proc.c
	cc -c $(CFLAGS) $(PDIR)/xdr_proc.c

xdr_ptr.o: $(PDIR)/xdr_ptr.c
	cc -c $(CFLAGS) $(PDIR)/xdr_ptr.c

xdr_record.o: $(PDIR)/xdr_record.c
	cc -c $(CFLAGS) $(PDIR)/xdr_record.c

xdr_rlimit.o: $(PDIR)/xdr_rlimit.c
	cc -c $(CFLAGS) $(PDIR)/xdr_rlimit.c

xdr_rusage.o: $(PDIR)/xdr_rusage.c
	cc -c $(CFLAGS) $(PDIR)/xdr_rusage.c

xdr_stat.o: $(PDIR)/xdr_stat.c
	cc -c $(CFLAGS) $(PDIR)/xdr_stat.c

xdr_statfs.o: $(PDIR)/xdr_statfs.c
	cc -c $(CFLAGS) $(PDIR)/xdr_statfs.c

xdr_timeval.o: $(PDIR)/xdr_timeval.c
	cc -c $(CFLAGS) $(PDIR)/xdr_timeval.c

xdr_timezone.o: $(PDIR)/xdr_timezone.c
	cc -c $(CFLAGS) $(PDIR)/xdr_timezone.c

xdr_wait.o: $(PDIR)/xdr_wait.c
	cc -c $(CFLAGS) $(PDIR)/xdr_wait.c

xdr_status.o: $(PDIR)/xdr_status.c
	cc -c $(CFLAGS) $(PDIR)/xdr_status.c

xdr_prio_rec.o: $(PDIR)/xdr_prio_rec.c
	cc -c $(CFLAGS) $(PDIR)/xdr_prio_rec.c

xdr_mach_rec.o: $(PDIR)/xdr_mach_rec.c
	cc -c $(CFLAGS) $(PDIR)/xdr_mach_rec.c

xdr_strings.o: $(PDIR)/xdr_strings.c
	cc -c $(CFLAGS) $(PDIR)/xdr_strings.c

xdr_float.o: $(PDIR)/xdr_float.c
	cc -c $(CFLAGS) $(PDIR)/xdr_float.c

depend: ALWAYS
	grep '^#include' $(CSRC) $(PDIR)/Makefile | grep -v '<' | \
	      sed 's/:[^"]*"\([^"]*\)".*/: \1/' | \
	      sed 's/\.c/.o/' | \
		  sed 's;$(PDIR)/;;' | \
		  sed 's;: ;: $$\(SRCDIR)/h/;' | \
	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
	echo '$$r makedep' >>eddep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	/bin/cp $(PDIR)/Makefile $(PDIR)/Makefile.bak
	ed - $(PDIR)/Makefile < eddep
	rm eddep makedep

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

xdr_Init.o: $(SRCDIR)/h/debug.h $(SRCDIR)/h/xdr_lib.h
xdr_io.o: $(SRCDIR)/h/debug.h $(SRCDIR)/h/except.h $(SRCDIR)/h/trace.h
xdr_ports.o: $(SRCDIR)/h/sched.h
xdr_stat.o: $(SRCDIR)/h/trace.h $(SRCDIR)/h/except.h $(SRCDIR)/h/xdr_lib.h
xdr_timeval.o: $(SRCDIR)/h/trace.h $(SRCDIR)/h/except.h
xdr_timezone.o: $(SRCDIR)/h/trace.h $(SRCDIR)/h/except.h $(SRCDIR)/h/xdr_lib.h
xdr_fdset.o: $(SRCDIR)/h/condor_types.h
xdr_ptr.o: $(SRCDIR)/h/xdr_lib.h
xdr_itimerval.o: $(SRCDIR)/h/trace.h $(SRCDIR)/h/except.h $(SRCDIR)/h/xdr_lib.h
xdr_rlimit.o: $(SRCDIR)/h/trace.h $(SRCDIR)/h/except.h $(SRCDIR)/h/xdr_lib.h
xdr_direntries.o: $(SRCDIR)/h/except.h $(SRCDIR)/h/trace.h
xdr_direntries.o: $(SRCDIR)/h/xdr_lib.h
xdr_statfs.o: $(SRCDIR)/h/trace.h $(SRCDIR)/h/except.h $(SRCDIR)/h/xdr_lib.h
xdr_rusage.o: $(SRCDIR)/h/trace.h $(SRCDIR)/h/except.h $(SRCDIR)/h/xdr_lib.h
xdr_proc.o: $(SRCDIR)/h/trace.h $(SRCDIR)/h/except.h $(SRCDIR)/h/xdr_lib.h
xdr_proc.o: $(SRCDIR)/h/proc.h
xdr_expr.o: $(SRCDIR)/h/trace.h $(SRCDIR)/h/except.h $(SRCDIR)/h/expr.h
xdr_mach_rec.o: $(SRCDIR)/h/expr.h $(SRCDIR)/h/manager.h
