# 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



# System specific build commands and flags
DEFINES= -DKERNEL -DUKERNEL
CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG}
AR = /usr/bin/ar
ARFLAGS = -r
RANLIB = /bin/ranlib
CC = xlc_r
DEF_LIBPATH=/usr/lib/threads:/usr/lib:/lib
EXPFILE=../nsafslib.exp 
LD_FLAGS=-bM:SRE -bE:$(EXPFILE) -berok -bnoentry -blibpath:$(DEF_LIBPATH)

TEST_CFLAGS=-DAFS_PTHREAD_ENV -Daix -DAFS_AIX_ENV
TEST_LDFLAGS=
TEST_LIBS=-lm -lpthreads

LIBUAFS = libuafs.a
LIBJUAFS = libjuafs.a
LIBAFSWEB = nsafs.a
LIBAFSWEBKRB = nsafs.krb.a

# To get __file__ (afs_osi_pag.c) you need to specify language level 
# C99 to xlc_r like this:
OPTF=-O -qlanglvl=stdc99
WEBOPTS = -I../nsapi -qarch=com -DNETSCAPE_NSAPI -DAIX -DNET_SSL -DXP_UNIX -DMCC_HTTPD

include Makefile.common

$(LIBUAFS): $(UAFSOBJ)
	-$(RM) -f $(LIBUAFS)
	$(AR) $(ARFLAGS) $(LIBUAFS) $(UAFSOBJ) $(AFS)/afsl.exp
	$(RANLIB) libuafs.a

$(LIBJUAFS): $(JUAFSOBJ)
	-$(RM) -f $(LIBJUAFS)
	$(AR) $(ARFLAGS) $(LIBJUAFS) $(JUAFSOBJ) $(AFS)/afsl.exp
	$(RANLIB) libjuafs.a

$(LIBAFSWEB): $(AFSWEBOBJ) ${DES}/libdes.a ${DESTDIR}/lib/afs/libsys.a
	-$(RM) -f $(LIBAFSWEB)
	ld -o $(LIBAFSWEB) $(LD_FLAGS) $(AFSWEBOBJ) ${DES}/libdes.a ${DESTDIR}/lib/afs/libsys.a -lm -lc

##
## Use Kerberos authentication instead of kaservers
##
$(LIBAFSWEBKRB): $(AFSWEBOBJKRB) ${DES}/libdes.a ${DESTDIR}/lib/afs/libsys.a 
	-$(RM) -f $(LIBAFSWEBKRB)
	ld -o $(LIBAFSWEBKRB) $(LD_FLAGS) $(AFSWEBOBJKRB) ${DES}/libdes.a ${DESTDIR}/lib/afs/libsys.a -lm -lc
