#
# $Id: Makefile.in,v 1.21 1999/05/30 12:12:24 assar 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@
libdir		= @libdir@
includedir	= @includedir@

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

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

PROGS		= test_rx_clock

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

SOURCES = $(LIB_SOURCES) $(test_rx_clock_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

OBJECTS = $(LIB_OBJECTS) $(test_rx_clock_OBJECTS)

all: $(LIB) $(PROGS)

install: all
	$(MKINSTALLDIRS) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
	$(INSTALL_DATA) $(LIB) $(DESTDIR)$(libdir)/$(LIB)
	for x in $(include_HEADERS); do \
		$(INSTALL_DATA) $(srcdir)/$$x $(DESTDIR)$(includedir)/$$x; \
	done

uninstall:
	rm -f $(DESTDIR)$(libdir)/$(LIB)
	for x in $(include_HEADERS); do \
		rm -f $(DESTDIR)$(includedir)/$$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)
	$(CC) -o $@ $(test_rx_clock_OBJECTS) -L. -lrx $(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
