# API version. When something changes, increment as appropriate. 
# Ignore at your own risk.
LIBAFSAUTHENTMAJOR=1
LIBAFSAUTHENTMINOR=1

# 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

# This is a pthread safe library containing ubikclient, auth, kauth.

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} ${SHLIB_CFLAGS} -I../auth -I../kauth -I../ptserver -I../sys
CCRULE = ${CC} ${CFLAGS} -c $?

AUDIT= ../audit
AUTH = ../auth
CMD  = ../cmd
KAUTH = ../kauth
UBIK = ../ubik
UTIL = ../util
RXKAD = ../rxkad
PTSERVER = ../ptserver
VOLSER = ../volser
VLSERVER = ../vlserver
SYS = ../sys

AUDITOBJS = audit.o audit-file.o audit-sysvmq.o

AUTHOBJS = \
	cellconfig.o \
	ktc.o \
	userok.o \
	writeconfig.o \
	authcon.o \
	ktc_errors.o \
	acfg_errors.o

CMDOBJS = \
	cmd.o \
	cmd_errors.o

KAUTHOBJS = \
	kauth.xdr.o \
	kauth.cs.o \
	kaaux.o \
	client.o \
	authclient.o \
	token.o \
	kautils.o \
	kalocalcell.o \
	kaerrors.o \
	user.o \
	read_passwd.o

UBIKOBJS = \
	uinit.o \
	ubikclient.o \
	uerrors.o \
	ubik_int.cs.o \
	ubik_int.xdr.o

UTILOBJS = \
	pthread_glock.o \
	get_krbrlm.o \
	dirpath.o \
	hostparse.o \
	serverLog.o \
	snprintf.o \
	strlcat.o \
	strlcpy.o \
	fileutil.o \
	uuid.o \
	ktime.o \
	volparse.o

RXKADOBJS = \
	rxkad_errs.o

SYSOBJS = \
	rmtsysc.o \
	rmtsys.xdr.o \
	rmtsys.cs.o \
	afssyscalls.o \
	rmtsysnet.o \
	glue.o \
	setpag.o \
	pioctl.o

PTSERVEROBJS = \
	ptclient.o \
	ptint.cs.o \
	ptint.xdr.o \
	ptuser.o \
	display.o \
	pterror.o

VOLSEROBJS = \
	vsutils.o \
	vsprocs.o \
	lockprocs.o \
	volint.xdr.o \
	volint.cs.o \
	volerr.o

VLDBOBJS = \
	vldbint.xdr.o \
	vldbint.cs.o \
	vl_errors.o

BOSOBJS = \
	bosint.xdr.o \
	bosint.cs.o \
	boserr.o

USDOBJS = \
	usd_file.o

LIBOBJS = \
	${AUDITOBJS} \
	${AUTHOBJS} \
	${CMDOBJS} \
	${KAUTHOBJS} \
	${UBIKOBJS} \
	${UTILOBJS} \
	${RXKADOBJS} \
	${PTSERVEROBJS} \
	${SYSOBJS} \
	${VOLSEROBJS} \
	${VLDBOBJS} \
	$(BOSOBJS) \
	$(USDOBJS) \
	AFS_component_version_number.o

LIBAFSAUTHENT = libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}.${LIBAFSAUTHENTMINOR}

all: ${TOP_LIBDIR}/${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent_pic.a

${TOP_LIBDIR}/${LIBAFSAUTHENT}: ${LIBAFSAUTHENT}
	../config/shlib-install -d ${TOP_LIBDIR} \
		-l libafsauthent \
		-M ${LIBAFSAUTHENTMAJOR} -m ${LIBAFSAUTHENTMINOR}

${TOP_LIBDIR}/libafsauthent_pic.a: libafsauthent_pic.a
	${INSTALL_DATA} libafsauthent_pic.a $@

install: ${LIBAFSAUTHENT} libafsauthent_pic.a
	../config/shlib-install -d ${DESTDIR}${libdir} \
		-l libafsauthent \
		-M ${LIBAFSAUTHENTMAJOR} -m ${LIBAFSAUTHENTMINOR}
	${INSTALL_DATA} libafsauthent_pic.a \
		${DESTDIR}${libdir}/libafsauthent_pic.a

dest: ${LIBAFSAUTHENT} libafsauthent_pic.a
	../config/shlib-install -d ${DEST}/lib \
		-l libafsauthent \
		-M ${LIBAFSAUTHENTMAJOR} -m ${LIBAFSAUTHENTMINOR}
	${INSTALL_DATA} libafsauthent_pic.a \
		${DEST}/lib/libafsauthent_pic.a

${LIBAFSAUTHENT}: ${LIBOBJS} libafsauthent.map
	../config/shlib-build -d $(srcdir) -l libafsauthent \
		-M ${LIBAFSAUTHENTMAJOR} -m ${LIBAFSAUTHENTMINOR} -- \
		-L${TOP_LIBDIR} -lafsrpc ${LIB_crypt} ${LIBOBJS} ${LIB_AFSDB} ${MT_LIBS}

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

audit.o: ${AUDIT}/audit.c
	${CCRULE}

audit-file.o: ${AUDIT}/audit-file.c
	${CCRULE}

audit-sysvmq.o: ${AUDIT}/audit-sysvmq.c
	${CCRULE}

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

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

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

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

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

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

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

cmd.o: ${CMD}/cmd.c
	${CCRULE} -I../cmd

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

kauth.xdr.o: ${KAUTH}/kauth.xdr.c
	${CCRULE}

kauth.cs.o: ${KAUTH}/kauth.cs.c
	${CCRULE}

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

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

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

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

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

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

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

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

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

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

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

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

ubik_int.cs.o: ${UBIK}/ubik_int.cs.c
	${CCRULE}

ubik_int.xdr.o: ${UBIK}/ubik_int.xdr.c
	${CCRULE}

get_krbrlm.o: ${UTIL}/get_krbrlm.c
	${CCRULE}

dirpath.o: ${UTIL}/dirpath.c
	${CCRULE}

serverLog.o: ${UTIL}/serverLog.c
	${CCRULE}

snprintf.o: ${UTIL}/snprintf.c
	${CCRULE}

strlcat.o: ${UTIL}/strlcat.c
	${CCRULE}

strlcpy.o: ${UTIL}/strlcpy.c
	${CCRULE}

fileutil.o: ${UTIL}/fileutil.c
	${CCRULE}

hostparse.o: ${UTIL}/hostparse.c
	${CCRULE}

volparse.o: ${UTIL}/volparse.c
	${CCRULE}

uuid.o: ${UTIL}/uuid.c
	${CCRULE}

ktime.o: ${UTIL}/ktime.c
	${CCRULE}

pthread_glock.o: ${UTIL}/pthread_glock.c
	${CCRULE}

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

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

# The special treatment of this file for hp_ux110 is because of a bug
# in version A.11.01.00 of the HP C compiler.  This bug appears to be
# fixed in version A.11.01.02 of the HP C compiler, however this version
# of the compiler is not installed on all of our build machines.
# The symptom of the problem is an error when linking the pthread fileserver:
# /usr/ccs/bin/ld: TP override with DATA_ONE_SYM fixup for non thread local
# storage symbol pr_Initialize in file DEST/lib/libafsauthent.a(ptuser.o)
ptuser.o: ${PTSERVER}/ptuser.c
	set -x; \
	case ${SYS_NAME} in \
	hp_ux11*) \
		set X `echo ${CCRULE} | sed s/-g//`; shift; \
		"$$@" \
		;; \
	*) \
		${CCRULE} \
		;; \
	esac

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

ptint.cs.o: ${PTSERVER}/ptint.cs.c
	${CCRULE}

ptint.xdr.o: ${PTSERVER}/ptint.xdr.c
	${CCRULE}

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

rmtsysc.o: ${SYS}/rmtsysc.c
	${CCRULE}

rmtsys.xdr.o: ${SYS}/rmtsys.xdr.c
	${CCRULE}

rmtsys.cs.o: ${SYS}/rmtsys.cs.c
	${CCRULE}

afssyscalls.o: ${SYS}/afssyscalls.c
	${CCRULE}

rmtsysnet.o: ${SYS}/rmtsysnet.c
	${CCRULE}

glue.o: ${SYS}/glue.c
	${CCRULE}

setpag.o: ${SYS}/setpag.c
	${CCRULE}

pioctl.o: ${SYS}/pioctl.c
	${CCRULE}

vsprocs.o: $(VOLSER)/vsprocs.c
	$(CCRULE) -I../volser

vsutils.o: $(VOLSER)/vsutils.c
	$(CCRULE) -I../volser

lockprocs.o: $(VOLSER)/lockprocs.c
	$(CCRULE) -I../volser

volint.xdr.o: ../volser/volint.xdr.c
	$(CCRULE)

volint.cs.o: ../volser/volint.cs.c
	$(CCRULE)

volerr.o: ../volser/volerr.c
	$(CCRULE)

vldbint.xdr.o: ../vlserver/vldbint.xdr.c
	$(CCRULE)

vldbint.cs.o: ../vlserver/vldbint.cs.c
	$(CCRULE)

vl_errors.o: ../vlserver/vl_errors.c
	$(CCRULE)

et_name.o: ../comerr/et_name.c
	$(CCRULE)

bosint.xdr.o: ../bozo/bosint.xdr.c
	$(CCRULE)

bosint.cs.o: ../bozo/bosint.cs.c
	$(CCRULE)

boserr.o: ../bozo/boserr.c
	$(CCRULE)

usd_file.o: ../usd/usd_file.c
	$(CCRULE)

AFS_component_version_number.o: AFS_component_version_number.c
	$(CCRULE)

include ../config/Makefile.version

clean:
	$(RM) -f *.o *.a libafsauthent.a* libafsauthent.sl* libafsauthent.so* \
		libafsauthent_pic.a libafsauthent.dylib.* \
		libafsauthent.exp AFS_component_version_number.c
