# 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
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

CC = ${MT_CC}
CFLAGS=${COMMON_CFLAGS} ${MT_CFLAGS}
CCRULE = ${CC} ${CFLAGS} -c
RXKAD = ../../rxkad
AUTH = ../../auth
BOZO = ../../bozo
CMD = ../../cmd
KAUTH = ../../kauth
PTSERVER = ../../ptserver
UBIK = ../../ubik
VLSERVER = ../../vlserver
VOLSER = ../../volser

INCLS=afs_AdminBosErrors.h \
	afs_AdminCfgErrors.h \
	afs_AdminClientErrors.h \
	afs_AdminMiscErrors.h \
	afs_AdminCommonErrors.h \
	afs_AdminKasErrors.h \
	afs_AdminPtsErrors.h \
	afs_AdminUtilErrors.h \
	afs_AdminVosErrors.h

all: ${TOP_LIBDIR}/libafsadminutil.a ${TOP_INCDIR}/afs/afs_utilAdmin.h \
	${TOP_INCDIR}/afs/afs_AdminErrors.h

${TOP_LIBDIR}/libafsadminutil.a: libafsadminutil.a
	${INSTALL_DATA} $? $@

${TOP_INCDIR}/afs/afs_utilAdmin.h: afs_utilAdmin.h
	${INSTALL_DATA} $? $@

${TOP_INCDIR}/afs/afs_AdminErrors.h: afs_AdminErrors.h
	${INSTALL_DATA} $? $@

afs_AdminBosErrors.h: afs_AdminBosErrors.et
	${COMPILE_ET_H} -p ${srcdir} afs_AdminBosErrors.et

afs_AdminBosErrors.c: afs_AdminBosErrors.et
	${COMPILE_ET_C} -p ${srcdir} afs_AdminBosErrors.et

${TOP_INCDIR}/afs/afs_AdminBosErrors.h: afs_AdminBosErrors.h
	${INSTALL_DATA} $? $@

afs_AdminCfgErrors.h: afs_AdminCfgErrors.et
	${COMPILE_ET_H} -p ${srcdir} afs_AdminCfgErrors.et

afs_AdminCfgErrors.c: afs_AdminCfgErrors.et
	${COMPILE_ET_C} -p ${srcdir} afs_AdminCfgErrors.et

${TOP_INCDIR}/afs/afs_AdminCfgErrors.h: afs_AdminCfgErrors.h
	${INSTALL_DATA} $? $@

afs_AdminClientErrors.h: afs_AdminClientErrors.et
	${COMPILE_ET_H} -p ${srcdir} afs_AdminClientErrors.et

afs_AdminClientErrors.c: afs_AdminClientErrors.et
	${COMPILE_ET_C} -p ${srcdir} afs_AdminClientErrors.et

${TOP_INCDIR}/afs/afs_AdminClientErrors.h: afs_AdminClientErrors.h
	${INSTALL_DATA} $? $@

afs_AdminMiscErrors.h: afs_AdminMiscErrors.et
	${COMPILE_ET_H} -p ${srcdir} afs_AdminMiscErrors.et

afs_AdminMiscErrors.c: afs_AdminMiscErrors.et
	${COMPILE_ET_C} -p ${srcdir} afs_AdminMiscErrors.et

${TOP_INCDIR}/afs/afs_AdminMiscErrors.h: afs_AdminMiscErrors.h
	${INSTALL_DATA} $? $@

afs_AdminCommonErrors.h: afs_AdminCommonErrors.et
	${COMPILE_ET_H} -p ${srcdir} afs_AdminCommonErrors.et

afs_AdminCommonErrors.c: afs_AdminCommonErrors.et
	${COMPILE_ET_C} -p ${srcdir} afs_AdminCommonErrors.et

${TOP_INCDIR}/afs/afs_AdminCommonErrors.h: afs_AdminCommonErrors.h
	${INSTALL_DATA} $? $@

afs_AdminKasErrors.h: afs_AdminKasErrors.et
	${COMPILE_ET_H} -p ${srcdir} afs_AdminKasErrors.et

afs_AdminKasErrors.c: afs_AdminKasErrors.et
	${COMPILE_ET_C} -p ${srcdir} afs_AdminKasErrors.et

${TOP_INCDIR}/afs/afs_AdminKasErrors.h: afs_AdminKasErrors.h
	${INSTALL_DATA} $? $@

afs_AdminPtsErrors.h: afs_AdminPtsErrors.et
	${COMPILE_ET_H} -p ${srcdir} afs_AdminPtsErrors.et

afs_AdminPtsErrors.c: afs_AdminPtsErrors.et
	${COMPILE_ET_C} -p ${srcdir} afs_AdminPtsErrors.et

${TOP_INCDIR}/afs/afs_AdminPtsErrors.h: afs_AdminPtsErrors.h
	${INSTALL_DATA} $? $@

afs_AdminUtilErrors.h: afs_AdminUtilErrors.et
	${COMPILE_ET_H} -p ${srcdir} afs_AdminUtilErrors.et

afs_AdminUtilErrors.c: afs_AdminUtilErrors.et
	${COMPILE_ET_C} -p ${srcdir} afs_AdminUtilErrors.et

${TOP_INCDIR}/afs/afs_AdminUtilErrors.h: afs_AdminUtilErrors.h
	${INSTALL_DATA} $? $@

afs_AdminVosErrors.h: afs_AdminVosErrors.et
	${COMPILE_ET_H} -p ${srcdir} afs_AdminVosErrors.et

afs_AdminVosErrors.c: afs_AdminVosErrors.et
	${COMPILE_ET_C} -p ${srcdir} afs_AdminVosErrors.et

${TOP_INCDIR}/afs/afs_AdminVosErrors.h: afs_AdminVosErrors.h
	${INSTALL_DATA} $? $@

ERROROBJS = \
	rxkad_errs.o \
	boserr.o \
	kaerrors.o \
	ktc_errors.o \
	cmd_errors.o \
	pterror.o \
	uerrors.o \
	vl_errors.o \
	acfg_errors.o \
	volerr.o

ADMINOBJS = \
	afs_AdminBosErrors.o \
	afs_AdminCfgErrors.o \
	afs_AdminClientErrors.o \
	afs_AdminCommonErrors.o \
	afs_AdminKasErrors.o \
	afs_AdminMiscErrors.o \
	afs_AdminPtsErrors.o \
	afs_AdminUtilErrors.o \
	afs_AdminVosErrors.o \
	afs_utilAdmin.o

LIBOBJS = ${ADMINOBJS} ${ERROROBJS}

install: libafsadminutil.a afs_utilAdmin.h
	${INSTALL} -d ${DESTDIR}${libdir}
	${INSTALL} -d ${DESTDIR}${includedir}/afs
	${INSTALL_DATA} libafsadminutil.a ${DESTDIR}${libdir}/afs/libafsadminutil.a
	${INSTALL_DATA} ${srcdir}/afs_utilAdmin.h ${DESTDIR}${includedir}/afs/afs_utilAdmin.h

dest: libafsadminutil.a afs_utilAdmin.h
	${INSTALL} -d ${DEST}/lib/afs
	${INSTALL} -d ${DEST}/include/afs
	${INSTALL_DATA} libafsadminutil.a ${DEST}/lib/afs/libafsadminutil.a
	${INSTALL_DATA} ${srcdir}/afs_utilAdmin.h ${DEST}/include/afs/afs_utilAdmin.h

libafsadminutil.a: ${LIBOBJS}
	-$(RM) -f $@
	$(AR) crv $@ ${LIBOBJS}
	${RANLIB} $@

afs_utilAdmin.o: afs_utilAdmin.h ${TOP_INCDIR}/afs/afs_AdminBosErrors.h ${TOP_INCDIR}/afs/afs_AdminUtilErrors.h \
				${TOP_INCDIR}/afs/afs_AdminVosErrors.h ${TOP_INCDIR}/afs/afs_AdminClientErrors.h \
				${TOP_INCDIR}/afs/afs_AdminCommonErrors.h ${TOP_INCDIR}/afs/afs_AdminKasErrors.h \
				${TOP_INCDIR}/afs/afs_AdminMiscErrors.h ${TOP_INCDIR}/afs/afs_AdminPtsErrors.h \
				${TOP_INCDIR}/afs/afs_AdminCfgErrors.h ${TOP_INCDIR}/afs/afs_AdminErrors.h

ktc_errors.o: ${AUTH}/ktc_errors.c
	${CCRULE} ${AUTH}/ktc_errors.c

acfg_errors.o: ${AUTH}/acfg_errors.c
	${CCRULE} ${AUTH}/acfg_errors.c

boserr.o: ${BOZO}/boserr.c
	${CCRULE} ${BOZO}/boserr.c

cmd_errors.o: ${CMD}/cmd_errors.c
	${CCRULE} ${CMD}/cmd_errors.c

kaerrors.o: ${KAUTH}/kaerrors.c
	${CCRULE} ${KAUTH}/kaerrors.c

pterror.o: ${PTSERVER}/pterror.c
	${CCRULE} ${PTSERVER}/pterror.c

rxkad_errs.o: ${RXKAD}/rxkad_errs.c
	${CCRULE} ${RXKAD}/rxkad_errs.c

uerrors.o: ${UBIK}/uerrors.c
	${CCRULE} ${UBIK}/uerrors.c

vl_errors.o: ${VLSERVER}/vl_errors.c
	${CCRULE} ${VLSERVER}/vl_errors.c

volerr.o: ${VOLSER}/volerr.c
	${CCRULE} ${VOLSER}/volerr.c

${LIBOBJS}: ${INCLS}

clean:
	$(RM) -f *.o libafsadminutil*
	$(RM) -f afs_AdminBosErrors.c afs_AdminBosErrors.h
	$(RM) -f afs_AdminCfgErrors.c afs_AdminCfgErrors.h
	$(RM) -f afs_AdminClientErrors.c afs_AdminClientErrors.h
	$(RM) -f afs_AdminCommonErrors.c afs_AdminCommonErrors.h
	$(RM) -f afs_AdminKasErrors.c afs_AdminKasErrors.h
	$(RM) -f afs_AdminMiscErrors.c afs_AdminMiscErrors.h
	$(RM) -f afs_AdminPtsErrors.c afs_AdminPtsErrors.h
	$(RM) -f afs_AdminUtilErrors.c afs_AdminUtilErrors.h
	$(RM) -f afs_AdminVosErrors.c afs_AdminVosErrors.h
