#
# $Id: Makefile.in,v 1.32 2000/07/15 23:05:08 lha Exp $
#

SHELL		= /bin/sh
srcdir		= @srcdir@
VPATH		= @srcdir@

CC		= @CC@
AR		= ar
RANLIB		= @RANLIB@
RM		= rm

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

prefix 		= @prefix@
exec_prefix	= @exec_prefix@
bindir		= @bindir@
sbindir		= @sbindir@
libdir		= @libdir@
includedir	= @includedir@

DEFS		= @DEFS@ -DRXDEBUG
CFLAGS		= @CFLAGS@
INCLUDES	= -I$(srcdir) -I../include -I$(srcdir)/../include \
		  @KRB4_INC_FLAGS@ -I$(srcdir)/../lib/cmd

LIB		= librx.a
include_HEADERS = rx.h rx_clock.h rx_event.h rx_globs.h rx_mach.h rx_misc.h \
		  rx_multi.h rx_null.h rx_pkt.h rx_queue.h rx_trace.h \
		  rx_user.h rxgencon.h

PROGS		= test_rx_clock rxdebug rxperf

LIB_SOURCES =					\
	rx_clock.c				\
	rx_event.c				\
	rx_user.c				\
	rx.c					\
	rx_globs.c				\
	rx_null.c				\
	rx_misc.c				\
	rx_pkt.c				\
	rx_rdwr.c				\
	rx_trace.c				\
	rx_multi.c

test_rx_clock_SOURCES = test_rx_clock.c
rxdebug_SOURCES = rxdebug.c
rxperf_SOURCES = rxperf.c

SOURCES = 					\
	$(LIB_SOURCES) 				\
	$(test_rx_clock_SOURCES) 		\
	$(rxdebug_SOURCES) 			\
	$(rxperf_SOURCES)

LIB_OBJECTS =					\
	rx_clock.o				\
	rx_event.o				\
	rx_user.o				\
	rx.o					\
	rx_globs.o				\
	rx_null.o				\
	rx_misc.o				\
	rx_pkt.o				\
	rx_rdwr.o				\
	rx_trace.o				\
	rx_multi.o

test_rx_clock_OBJECTS = test_rx_clock.o
rxdebug_OBJECTS = rxdebug.o
rxperf_OBJECTS = rxperf.o

OBJECTS = 					\
	$(LIB_OBJECTS) 				\
	$(test_rx_clock_OBJECTS) 		\
	$(rxdebug_OBJECTS) 			\
	$(rxperf_OBJECTS)

all: $(LIB) $(PROGS)

install: all
	$(MKINSTALLDIRS) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
	$(MKINSTALLDIRS) $(DESTDIR)$(includedir)/rx
	$(MKINSTALLDIRS) $(DESTDIR)$(sbindir) $(DESTDIR)$(bindir)
	$(INSTALL_PROGRAM) rxdebug $(DESTDIR)$(bindir)/rxdebug
	$(INSTALL_PROGRAM) rxperf  $(DESTDIR)$(sbindir)/rxperf
	$(INSTALL_DATA) $(LIB) $(DESTDIR)$(libdir)/$(LIB)
	for x in $(include_HEADERS); do \
		$(INSTALL_DATA) $(srcdir)/$$x $(DESTDIR)$(includedir)/rx/$$x; \
	done

uninstall:
	rm -f $(DESTDIR)$(libdir)/$(LIB)
	rm -f $(DESTDIR)$(bindir)/rxdebug
	rm -f $(DESTDIR)$(sbindir)/rxperf
	for x in $(include_HEADERS); do \
		rm -f $(DESTDIR)$(includedir)/rx/$$x; \
	done

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) $(INCLUDES) $(CFLAGS) $<

clean:
	rm -f $(LIB) $(PROGS) *.o *.a

mostlyclean: clean

distclean: clean
	rm -f Makefile *~

realclean: distclean
	rm -f TAGS

$(LIB): $(LIB_OBJECTS)
	rm -f $@
	$(AR) cr $@ $(LIB_OBJECTS)
	-$(RANLIB) $@

test_rx_clock: $(test_rx_clock_OBJECTS) $(LIB)
	$(CC) -o $@ $(test_rx_clock_OBJECTS) -L. -lrx $(LIBS)

rxdebug: $(rxdebug_OBJECTS) $(LIB)
	$(CC) -o $@ $(rxdebug_OBJECTS) -L../lib/cmd -lcmd -L. -lrx $(LIBS) -L../lwp -llwp @PLWP_LIB_FLAGS@ -L../lib/roken -lroken @LIBS@

rxperf: $(rxperf_OBJECTS) $(LIB)
	$(CC) -o $@ $(rxperf_OBJECTS) -L../lib/cmd -lcmd -L. -lrx $(LIBS) -L../lwp -llwp @PLWP_LIB_FLAGS@ -L../lib/roken -lroken @LIBS@

TAGS:	$(SOURCES)
	etags $(SOURCES)

Makefile: Makefile.in ../config.status
	cd ..; CONFIG_FILES=rx/Makefile CONFIG_HEADERS= ./config.status

.PHONY: all clean mostlyclean distclean realclean install uninstall
