# 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

# # Auditing is currently only supported for AIX32 machines.  It is
# # integrated with the AIX auditing facility.  The objects, events, 
# # and config files are AIX specific.  The Audit file is not but is
# # included in the rs_aix32 case since other platforms are not
# # supported (if not supported, don't show it).
# ######################################################################

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

CFLAGS=-I. -I${srcdir} ${OPTMZ} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS}

all: ${TOP_LIBDIR}/libaudit.a ${TOP_INCDIR}/afs/audit.h

# XXX-INST: where to install the AIX audit files?
install: \
	${DESTDIR}${libdir}/afs/libaudit.a \
	${DESTDIR}${includedir}/afs/audit.h

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

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

libaudit.a: audit.o AFS_component_version_number.o
	$(RM) -f libaudit.a
	ar r libaudit.a audit.o AFS_component_version_number.o
	$(RANLIB) libaudit.a

audit.o: audit.c audit.h 
	${CC} ${CFLAGS} -c ${srcdir}/audit.c

clean:
	$(RM) -f *.a *.o core AFS_component_version_number.c

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

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

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

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

dest:  ${DEST}/lib/afs/libaudit.a ${DEST}/include/afs/audit.h
	case ${SYS_NAME} in \
	rs_aix*) \
	   ${INSTALL} ${srcdir}/Audit              ${DEST}/root.server/usr/afs/local ;  \
	   ${INSTALL} ${srcdir}/objects.aix.sample ${DEST}/root.server/usr/afs/local/audit/objects.sample ;  \
	   ${INSTALL} ${srcdir}/events.aix.sample  ${DEST}/root.server/usr/afs/local/audit/events.sample  ;  \
	   ${INSTALL} ${srcdir}/config.aix.sample  ${DEST}/root.server/usr/afs/local/audit/config.sample  ;; \
        *) ;; \
        esac ;

