# $Id: Makefile.in,v 1.43 1998/02/23 03:57:30 assar Exp $

srcdir		= @srcdir@
VPATH		= @srcdir@

CC		= @CC@

INSTALL		= @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@
MKINSTALLDIRS 	= @top_srcdir@/mkinstalldirs

prefix 		= @prefix@
exec_prefix 	= @exec_prefix@
libdir 		= @libdir@
libexecdir 	= @libexecdir@
bindir 		= @bindir@
sysconfdir	= @sysconfdir@
transform	= @program_transform_name@
ARLACACHEDIR	= @ARLACACHEDIR@
ARLACONFFILE	= @ARLACONFFILE@

ARLA_BIN	= arlad

DEFS		= @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\" \
		  -DARLACACHEDIR=\"$(ARLACACHEDIR)\" \
		  -DARLACONFFILE=\"$(ARLACONFFILE)\"

SHELL		= /bin/sh

CFLAGS		= -g @CFLAGS@

ETAGS		= etags
MAKEDEPEND	= makedepend
AFSWSROOT	= /usr/afsws
RXKADINC	= $(srcdir)/../rxkad @KRB_INC_DIR@
INCLUDES	= $(srcdir)/../util \
		  $(srcdir)/../lwp \
		  $(srcdir)/.. \
		  @KERNEL_INCLUDE@ \
		  ../include \
		  $(srcdir)/../include \
		  . \
		  $(srcdir)/../rx \
		  $(srcdir)/../lib/sl \
		  $(srcdir)/../xfs/include \
		  ../rxdef \
		  $(srcdir)/../lib/roken \
		  $(RXKADINC)
DEFINES		= -DDEBUG
REALCFLAGS	= $(INCLUDES:%=-I%) $(DEFINES) $(CFLAGS)
RXKADLIB	= @RXKAD_LIBS@
LIB_tgetent	= @LIB_tgetent@
LIBS		= -L../rxdef -lrxdefclient -L../rx -lrx -L../lwp -llwp \
		  -L../util -lutil -L../lib/sl -lsl @LIB_readline@ \
		  -L../lib/roken -lroken $(RXKADLIB) @LIBS@
LIBDEPENDS	= ../rxdef/librxdefclient.a ../rx/librx.a ../lwp/liblwp.a \
		  ../util/libutil.a ../lib/sl/libsl.a ../lib/roken/libroken.a
KERNEL_SRCS	= @KERNEL_SRCS@
PROGS		= arlad afsdir_check
SRCS		=				\
		adir.c				\
		afsdir_check.c			\
		arla.c				\
		arladeb.c			\
		cell.c				\
		cmcb.c				\
		conn.c				\
		cred.c				\
		fbuf.c				\
		fcache.c			\
		inter.c				\
		kernel.c			\
		messages.c			\
		ports.c				\
		volcache.c			\
		$(KERNEL_SRCS)

HDRS		=				\
		adir.h			\
		afs_dir.h		\
		arla_local.h		\
		arladeb.h		\
		cell.h			\
		cmcb.h			\
		conn.h			\
		cred.h			\
		fbuf.h			\
		fcache.h		\
		inter.h			\
		kernel.h		\
		messages.h		\
		ports.h			\
		service.h		\
		subr.h			\
		volcache.h		

arlad_OBJS	  = \
		adir.o				\
		arla.o				\
		arladeb.o			\
		cell.o				\
		cmcb.o				\
		conn.o				\
		cred.o				\
		fbuf.o				\
		fcache.o			\
		inter.o				\
		kernel.o			\
		messages.o			\
		ports.o				\
		volcache.o			\
		$(KERNEL_SRCS:.c=.o)

afsdir_check_OBJS = fbuf.o afsdir_check.o

.PHONY: all install depend tags clean

all:		$(PROGS)

.c.o:
		$(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) -I. $(REALCFLAGS) $<

install: all
		$(MKINSTALLDIRS) $(bindir)
		PROG_BIN='$(ARLA_BIN)'; for x in $$PROG_BIN; do \
			$(INSTALL_PROGRAM) $$x $(bindir)/`echo $$x | sed '$(transform)'`; \
		done


arlad:		$(arlad_OBJS) $(LIBDEPENDS)
		$(CC) $(LDFLAGS) -o $@ $(arlad_OBJS) $(LIBS)

afsdir_check:	$(afsdir_check_OBJS)
		$(CC) $(LDFLAGS) -o $@ $(afsdir_check_OBJS) $(LIBS)

Makefile:	Makefile.in ../config.status
		cd ..; CONFIG_FILES=arlad/Makefile CONFIG_HEADERS= $(SHELL) config.status

depend:		$(SRCS)
		$(MAKEDEPEND) -- $(REALCFLAGS) -- $^

tags:		TAGS

TAGS:		$(SRCS) $(HDRS)
		$(ETAGS) -t $(SRCS) $(HDRS)

clean		:
		rm -f $(PROGS) $(OBJS) *~ *.o core *.core

mostlyclean:	clean

distclean:	clean
		rm -f Makefile config.status

realclean:	distclean
		rm -f TAGS
