# 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

srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config

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.xg
	${RXGEN} -c -o $@ ${srcdir}/butc.xg

butc.ss.c: butc.xg
	${RXGEN} -S -o $@ ${srcdir}/butc.xg

butc.cs.c: butc.xg
	${RXGEN} -C -o $@ ${srcdir}/butc.xg

butc.h: butc.xg
	${RXGEN} -h -o $@ ${srcdir}/butc.xg

butc.xdr.c: butc.h
butc.cs.c: butc.h
butc.ss.c: butc.h

bumon.xdr.c: bumon.xg
	${RXGEN} -c -o $@ ${srcdir}/bumon.xg

bumon.ss.c: bumon.xg
	${RXGEN} -S -o $@ ${srcdir}/bumon.xg

bumon.cs.c: bumon.xg
	${RXGEN} -C -o $@ ${srcdir}/bumon.xg

bumon.h: bumon.xg
	${RXGEN} -h -o $@ ${srcdir}/bumon.xg

bumon.xdr.c: bumon.h
bumon.ss.c: bumon.h
bumon.cs.c: bumon.h

butm_errs.c butm.h: butm_errs.et butm.p.h
	$(RM) -f butm.h butm_errs.c
	${COMPILE_ET} -p ${srcdir} 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} -p ${srcdir} butc_errs -h tcdata

butx_errs.c butx.h: butx_errs.et
	$(RM) -f butx.h butx_errs.c
	${COMPILE_ET} -p ${srcdir} 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

