# Copyright 2000, International Business Machines Corporation and others.
# All Rights Reserved.
# 
# This software has been released under the terms of the IBM Public
# License.  For details, see the LICENSE file in the top-level source
# directory or online at http://www.openafs.org/dl/license10.html

DEST=@DEST@
TOP_INCDIR=@TOP_INCDIR@
TOP_LIBDIR=@TOP_LIBDIR@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
libexecdir=@libexecdir@
libdir=@libdir@
includedir=@includedir@
mandir=@mandir@
afssrvbindir=@afssrvbindir@
afssrvsbindir=@afssrvsbindir@
afssrvlibexecdir=@afssrvlibexecdir@
TOP_SRCDIR=@TOP_SRCDIR@
SYS_NAME=@AFS_SYSNAME@

SHELL = /bin/sh

include ../config/Makefile.${SYS_NAME}

RXGEN=${TOP_SRCDIR}/rxgen/rxgen
COMPILE_ET=${TOP_SRCDIR}/comerr/compile_et

CFLAGS=${DBUG} -I${TOP_SRCDIR}/config -I${TOP_INCDIR} ${XCFLAGS}

all: ${TOP_LIBDIR}/libbubasics.a ${TOP_INCDIR}/afs/bumon.h ${TOP_INCDIR}/afs/butc.h ${TOP_INCDIR}/afs/bubasics.h ${TOP_INCDIR}/afs/tcdata.h ${TOP_INCDIR}/afs/butm.h ${TOP_INCDIR}/afs/butx.h

OBJS=butc.ss.o butc.cs.o butc.xdr.o bumon.ss.o bumon.cs.o bumon.xdr.o butc_errs.o butm_errs.o butx_errs.o

libbubasics.a: $(OBJS) AFS_component_version_number.o
	-$(RM) -f libbubasics.a
	ar r libbubasics.a ${OBJS} AFS_component_version_number.o
	${RANLIB} libbubasics.a

butc.xdr.c butc.ss.c butc.cs.c butc.h: butc.xg
	${RXGEN} butc.xg

bumon.xdr.c bumon.ss.c bumon.cs.c bumon.h: bumon.xg
	${RXGEN} bumon.xg

butm_errs.c butm.h: butm_errs.et butm.p.h
	$(RM) -f butm.h butm_errs.c
	${COMPILE_ET} butm_errs -h butm

butc_errs.c tcdata.h: butc_errs.et tcdata.p.h butm.h
	$(RM) -f tcdata.h butc_errs.c
	${COMPILE_ET} butc_errs -h tcdata

butx_errs.c butx.h: butx_errs.et
	$(RM) -f butx.h butx_errs.c
	${COMPILE_ET} butx_errs -h butx

#
# Installation targets
#
install: ${DESTDIR}${libdir}/afs/libbubasics.a ${DESTDIR}${includedir}/afs/bumon.h ${DESTDIR}${includedir}/afs/butc.h ${DESTDIR}${includedir}/afs/bubasics.h ${DESTDIR}${includedir}/afs/tcdata.h ${DESTDIR}${includedir}/afs/butm.h ${DESTDIR}${includedir}/afs/butx.h

${DEST}/lib/afs/libbubasics.a: libbubasics.a
	${INSTALL} $? $@

${DEST}/include/afs/bumon.h: bumon.h
	${INSTALL} $? $@

${DEST}/include/afs/butc.h: butc.h
	${INSTALL} $? $@

${DEST}/include/afs/bubasics.h: bubasics.h
	${INSTALL} $? $@

${DEST}/include/afs/tcdata.h: tcdata.h
	${INSTALL} $? $@

${DEST}/include/afs/butm.h: butm.h
	${INSTALL} $? $@

${DEST}/include/afs/butx.h: butx.h
	${INSTALL} $? $@

#
# Common targets
#

clean:
	$(RM) -f *.o *.a *.xdr.c *.ss.c *.cs.c butc.h butx.h butm.h bumon.h tcdata.h \
		butc_errs.c butx_errs.c butm_errs.c core AFS_component_version_number.c

include ../config/Makefile.version
${DESTDIR}${libdir}/afs/libbubasics.a: libbubasics.a
	${INSTALL} $? $@

${TOP_LIBDIR}/libbubasics.a: libbubasics.a
	${INSTALL} $? $@

${DESTDIR}${includedir}/afs/bumon.h: bumon.h
	${INSTALL} $? $@

${TOP_INCDIR}/afs/bumon.h: bumon.h
	${INSTALL} $? $@

${DESTDIR}${includedir}/afs/butc.h: butc.h
	${INSTALL} $? $@

${TOP_INCDIR}/afs/butc.h: butc.h
	${INSTALL} $? $@

${DESTDIR}${includedir}/afs/bubasics.h: bubasics.h
	${INSTALL} $? $@

${TOP_INCDIR}/afs/bubasics.h: bubasics.h
	${INSTALL} $? $@

${DESTDIR}${includedir}/afs/tcdata.h: tcdata.h
	${INSTALL} $? $@

${TOP_INCDIR}/afs/tcdata.h: tcdata.h
	${INSTALL} $? $@

${DESTDIR}${includedir}/afs/butm.h: butm.h
	${INSTALL} $? $@

${TOP_INCDIR}/afs/butm.h: butm.h
	${INSTALL} $? $@

${DESTDIR}${includedir}/afs/butx.h: butx.h
	${INSTALL} $? $@

${TOP_INCDIR}/afs/butx.h: butx.h
	${INSTALL} $? $@

dest: ${DEST}/lib/afs/libbubasics.a ${DEST}/include/afs/bumon.h ${DEST}/include/afs/butc.h ${DEST}/include/afs/bubasics.h ${DEST}/include/afs/tcdata.h ${DEST}/include/afs/butm.h ${DEST}/include/afs/butx.h

