# $Id: Makefile.in,v 1.45 2000/05/19 01:47:45 assar Exp $

srcdir		= @srcdir@
VPATH		= @srcdir@

CC		= @CC@
AR		= ar
RANLIB		= @RANLIB@

DEFS		= @DEFS@

SHELL		= /bin/sh

CFLAGS		= @CFLAGS@

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

prefix 		= @prefix@
exec_prefix	= @exec_prefix@
libdir		= @libdir@
includedir	= @includedir@

RM		= rm
YDR		= ../ydr/ydr
YDRFLAGS	= -I$(srcdir)
ETAGS		= etags
MAKEDEPEND	= makedepend
DEFINES		=
INCLUDES	= -I../include \
		  -I$(srcdir)/../include \
		  -I$(srcdir)/.. 
REALCFLAGS	= $(INCLUDES) @KRB4_INC_FLAGS@ $(DEFINES) $(CFLAGS)
XGFILES		= $(srcdir)/vldb.xg \
		  $(srcdir)/fs.xg \
		  $(srcdir)/cb.xg \
		  $(srcdir)/pts.xg \
		  $(srcdir)/bos.xg \
		  $(srcdir)/volumeserver.xg 
HDRS		= vldb.h cb.h fs.h pts.h # volumeserver.h bos.h ubik.h
MOREHDRS	= vldb.cs.h vldb.ss.h cb.cs.h cb.ss.h fs.cs.h fs.ss.h \
		  pts.cs.h pts.ss.h ubik.cs.h ubik.ss.h \
		  bos.cs.h pts.ss.h
CFILES		= vldb.ss.c vldb.cs.c vldb.ydr.c \
		  fs.ss.c fs.cs.c fs.ydr.c \
		  cb.ss.c cb.cs.c cb.ydr.c \
		  pts.ss.c pts.cs.c pts.ydr.c \
		  bos.ss.c bos.cs.c bos.ydr.c \
		  volumeserver.ss.c volumeserver.cs.c volumeserver.ydr.c \
		  ubik.ss.c ubik.cs.c ubik.ydr.c \
		  ka.ss.c ka.cs.c ka.ydr.c
OBJS		= $(CFILES:.c=.o)
SRCS		= $(CFILES) $(HDRS)

FSSERVERLIB	= librxfsserver.a
VLSERVERLIB	= librxvlserver.a
VOLSERVERLIB	= librxvolserver.a
PTSERVERLIB	= libptserver.a
PTCLIENTLIB	= libptclient.a
BOSSERVERLIB	= libbosserver.a
BOSCLIENTLIB	= libbosclient.a
KACLIENTLIB	= libkaclient.a
KASERVERLIB	= libkaserver.a
CLIENTLIB	= librxdefclient.a

#vldb.ydr.o fs.ydr.o  cb.ydr.o volumeserver.ydr.o 
CLIENTOBJS	= vldb.cs.o fs.cs.o cb.ss.o volumeserver.cs.o \
		  pts.cs.o ubik.cs.o bos.cs.o
FSSERVEROBJS	= fs.ss.o cb.cs.o
VLSERVEROBJS	= vldb.ss.o vldb.ydr.o ubik.ss.o
VOLSERVEROBJS	= volumeserver.ss.o volumeserver.ydr.o
PTSERVEROBJS	= pts.ydr.o pts.ss.o
PTCLIENTOBJS	= pts.ydr.o pts.cs.o
BOSSERVEROBJS	= bos.ydr.o bos.ss.o
BOSCLIENTOBJS	= bos.ydr.o bos.cs.o
KACLIENTOBJS	= ka.ydr.o ka.cs.o
KASERVEROBJS	= ka.ydr.o ka.ss.o
RESTSERVEROBJS  = pts.ss.o ubik.ss.o

LIBS		= $(CLIENTLIB) $(FSSERVERLIB) $(VLSERVERLIB) $(VOLSERVERLIB) $(PTSERVERLIB) $(PTCLIENTLIB) $(BOSSERVERLIB) $(BOSCLIENTLIB) $(KACLIENTLIB) $(KASERVERLIB)

.PHONY: all install depend tags clean

all:		$(LIBS)

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

install: all
	$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
	for LIB in $(LIBS) ; do $(INSTALL_DATA) $$LIB $(DESTDIR)$(libdir)/$$LIB ; done
	$(MKINSTALLDIRS) $(DESTDIR)$(includedir)
	for INC in $(HDRS) $(MOREHDRS) ; do $(INSTALL_DATA) $$INC $(DESTDIR)$(includedir)/$$INC ; done


uninstall:
	for LIB in $(LIBS); do rm -f $(DESTDIR)$(libdir)/$$LIB ; done
	for INC in $(HDRS) $(MOREHDRS); do rm -f $(DESTDIR)$(includedir)/$$INC ; done

ydr:		$(XGFILES)
		../ydr/ydr $< 

# $(SERVEROBJS) $(CLIENTOBJS): $(XGFILES) $(CFILES) $(HDRS)


$(CLIENTLIB):	$(CLIENTOBJS)
		$(AR) cr $@ $(CLIENTOBJS)
		$(RANLIB) $@

$(FSSERVERLIB):	$(FSSERVEROBJS)
		$(AR) cr $@ $(FSSERVEROBJS)
		$(RANLIB) $@

$(VLSERVERLIB):	$(VLSERVEROBJS)
		$(AR) cr $@ $(VLSERVEROBJS)
		$(RANLIB) $@

$(VOLSERVERLIB): $(VOLSERVEROBJS)
		$(AR) cr $@ $(VOLSERVEROBJS)
		$(RANLIB) $@

$(PTSERVERLIB): $(PTSERVEROBJS)
		$(AR) cr $@ $(PTSERVEROBJS)
		$(RANLIB) $@

$(PTCLIENTLIB): $(PTCLIENTOBJS)
		$(AR) cr $@ $(PTCLIENTOBJS)
		$(RANLIB) $@

$(BOSSERVERLIB): $(BOSSERVEROBJS)
		$(AR) cr $@ $(BOSSERVEROBJS)
		$(RANLIB) $@

$(BOSCLIENTLIB): $(BOSCLIENTOBJS)
		$(AR) cr $@ $(BOSCLIENTOBJS)
		$(RANLIB) $@

$(KACLIENTLIB): $(KACLIENTOBJS)
		$(AR) cr $@ $(KACLIENTOBJS)
		$(RANLIB) $@

$(KASERVERLIB): $(KASERVEROBJS)
		$(AR) cr $@ $(KASERVEROBJS)
		$(RANLIB) $@

#%.cs.c %.cs.h %.ss.c %.ss.h %.ydr.c %.h: %.xg
#		$(YDR) $(YDRFLAGS) $(srcdir)/$(<F)

vldb.cs.c vldb.cs.h vldb.ss.c vldb.ss.h vldb.ydr.c vldb.h: vldb.xg
		$(YDR) $(YDRFLAGS) $(srcdir)/vldb.xg

fs.cs.c fs.cs.h fs.ss.c fs.ss.h fs.ydr.c fs.h: fs.xg
		$(YDR) $(YDRFLAGS) $(srcdir)/fs.xg

cb.cs.c cb.cs.h cb.ss.c cb.ss.h cb.ydr.c cb.h: cb.xg
		$(YDR) $(YDRFLAGS) $(srcdir)/cb.xg

pts.cs.c pts.cs.h pts.ss.c pts.ss.h pts.ydr.c pts.h: pts.xg
		$(YDR) $(YDRFLAGS) $(srcdir)/pts.xg

bos.cs.c bos.cs.h bos.ss.c bos.ss.h bos.ydr.c bos.h: bos.xg
		$(YDR) $(YDRFLAGS) $(srcdir)/bos.xg

ka.cs.c ka.cs.h ka.ss.c ka.ss.h ka.ydr.c ka.h: ka.xg
		$(YDR) $(YDRFLAGS) $(srcdir)/ka.xg

volumeserver.cs.c volumeserver.cs.h volumeserver.ss.c volumeserver.ss.h volumeserver.ydr.c volumeserver.h: volumeserver.xg
		$(YDR) $(YDRFLAGS) $(srcdir)/volumeserver.xg

ubik.cs.c ubik.cs.h ubik.ss.c ubik.ss.h ubik.ydr.c ubik.h: ubik.xg
		$(YDR) $(YDRFLAGS) $(srcdir)/ubik.xg


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

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

tags:		TAGS

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

clean		:
		rm -f $(OBJS) $(LIBS) ydr_tmp*.c *.cs.c *.cs.h *.ss.c *.ss.h *.ydr.c *.td.c *~ *.o core *.core vldb.h cb.h fs.h pts.h bos.h ka.h volumeserver.h ubik.h

mostlyclean:	clean

distclean:	clean
		rm -f Makefile config.status

realclean:	distclean
		rm -f TAGS
