# $Id: Makefile.in,v 1.6.2.1 2000/10/11 18:58:48 lha Exp $

srcdir		= @srcdir@
VPATH		= @srcdir@

CC		= @CC@
LN_S		= @LN_S@

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@
transform	= @program_transform_name@
EXECSUFFIX	= @EXECSUFFIX@

APPL_BIN	= klog tokens unlog up

DEFS		= @DEFS@

SHELL		= /bin/sh

CFLAGS		= @CFLAGS@
X_CFLAGS	= @X_CFLAGS@

ETAGS		= etags
MAKEDEPEND	= makedepend
RXKADINC	= -I$(srcdir)/../../rxkad
INCLUDES	= -I$(srcdir)/../.. \
		  -I$(srcdir)/../../include \
		  -I$(srcdir)/../lib \
		  -I$(srcdir)/../../lib/cmd \
		  -I../../include \
		  -I../../rxdef \
		  -I. \
		  $(KERNEL_INCLUDE) \
		  -I$(srcdir)/../../xfs/include \
		  -I$(srcdir)/../../arlad \
		  $(RXKADINC) 

DEFINES		=
REALCFLAGS	= $(INCLUDES) @KRB4_INC_FLAGS@ $(DEFINES) $(CFLAGS) \
		  $(X_CFLAGS) @PLWP_INC_FLAGS@
RXKAD_LIBS	= @MILKO_RXKAD_LIBS@
KERNEL_INCLUDE  = @KERNEL_INCLUDE@
KAFS_LIBS	= @AIX_EXTRA_KAFS@ @KAFS_LIBS@
LIBS		= -L../lib -larlalib \
		  -L../../rxdef -lrxdefclient \
		  -L../../lib/cmd -lcmd \
		  -L../../rx -lrx \
		  -L../../lwp -llwp @PLWP_LIB_FLAGS@ \
		  -L../../lib/ko -lko -L../../util -lutil \
		  -L../../lib/roken -lroken \
		  $(RXKAD_LIBS) \
		  $(KAFS_LIBS) \
		  $(RXKAD_LIBS) \
		  @LIBS@

LIBDEPENDS	= ../../rxdef/librxdefclient.a ../../rx/librx.a ../../lwp/liblwp.a \
		  ../../util/libutil.a ../../lib/sl/libsl.a ../../lib/roken/libroken.a \
		  ../../lib/ko/libko.a

PROGS		= klog sys tokens unlog up
KLOG_SRCS	= klog.c
SYS_SRCS	= sys.c
TOKENS_SRCS	= tokens.c
UNLOG_SRCS	= unlog.c
UP_SRCS		= up.c
SRCS		= $(KLOG_SRCS)			\
		  $(SYS_SRCS)			\
		  $(TOKENS_SRCS)		\
		  $(UNLOG_SRCS)			\
		  $(UP_SRCS)
KLOG_OBJS	= klog.o
SYS_OBJS	= sys.o
TOKENS_OBJS	= tokens.o
UNLOG_OBJS	= unlog.o
UP_OBJS		= up.o
HDRS		= 

all:		$(PROGS)

.PHONY: all install uninstall depend tags clean

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

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

uninstall:
		PROG_BIN='$(APPL_BIN)'; for x in $$PROG_BIN; do \
			f=`echo $$x | sed '$(transform)'`; \
			rm -f $(DESTDIR)$(bindir)/$$f; \
		done

klog:		$(KLOG_OBJS) $(LIBDEPENDS)
		$(CC) $(LDFLAGS) -o $@ $(KLOG_OBJS) $(LIBS)

sys:		$(SYS_OBJS) $(LIBDEPENDS)
		$(CC) $(LDFLAGS) -o $@ $(SYS_OBJS) $(LIBS)

tokens:		$(TOKENS_OBJS) $(LIBDEPENDS)
		$(CC) $(LDFLAGS) -o $@ $(TOKENS_OBJS) $(LIBS)

unlog:		$(UNLOG_OBJS) $(LIBDEPENDS)
		$(CC) $(LDFLAGS) -o $@ $(UNLOG_OBJS) $(LIBS)

up:		$(UP_OBJS) $(LIBDEPENDS)
		$(CC) $(LDFLAGS) -o $@ $(UP_OBJS) $(LIBS)

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

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

tags:		TAGS

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

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

mostlyclean:	clean

distclean:	clean
		rm -f Makefile config.status

realclean:	distclean
		rm -f TAGS
