# 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

RELDIR=auth
AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -I$(DESTDIR)\include\afs
!INCLUDE ..\config\NTMakefile.$(SYS_NAME)
!INCLUDE ..\config\NTMakefile.version

INCFILEDIR = $(DESTDIR)\include\afs  # header file install directory

INCFILES =\
	$(INCFILEDIR)\auth.h \
	$(INCFILEDIR)\authcon.h \
	$(INCFILEDIR)\cellconfig.h \
	$(INCFILEDIR)\keys.h \
        $(INCFILEDIR)\token.h

############################################################################
# rxgen on token.xg

token.xdr.c: token.xg token.h
	$(RXGEN) -x -c -o $@ token.xg

token.h: token.xg
	$(RXGEN) -x -h -u -o $@ token.xg


############################################################################
# afsauth.lib

AFSAUTH_LIBFILE = $(DESTDIR)\lib\afs\afsauth.lib

AFSD = ..\WINNT\afsd

AFSAUTH_LIBOBJS =\
	$(OUT)\cellconfig.obj \
	$(OUT)\keys.obj \
	$(OUT)\userok.obj \
	$(OUT)\writeconfig.obj \
	$(OUT)\authcon.obj \
	$(OUT)\realms.obj \
	$(OUT)\acfg_errors.obj \
	$(OUT)\ktc_errors.obj \
	$(OUT)\ktc_nt.obj \
        $(OUT)\token.obj \
        $(OUT)\token.xdr.obj \
	$(OUT)\netrestrict.obj \
	$(OUT)\AFS_component_version_number.obj

AFSDOBJS =\
	$(OUT)\$(AFSD)\afsrpc_$(CPU)_c.obj

$(AFSDOBJS): $(AFSD)\$$(@B).c
	$(C2OBJ) -I$*(*D) $**

$(AFSAUTH_LIBFILE): $(AFSAUTH_LIBOBJS) $(AFSDOBJS)
	$(LIBARCH) rpcrt4.lib

############################################################################
# afsauth.krb.lib

AFSAUTH_KRB_LIBFILE = $(DESTDIR)\lib\afs\afsauth.krb.lib

AFSAUTH_KRB_LIBOBJS =\
	$(OUT)\cellconfig.obj \
	$(OUT)\userok.obj \
	$(OUT)\writeconfig.obj \
	$(OUT)\authcon.obj \
	$(OUT)\realms.obj \
	$(OUT)\acfg_errors.obj \
	$(OUT)\ktc_errors.obj \
	$(OUT)\ktc_nt.obj \
	$(OUT)\AFS_component_version_number.obj

$(AFSAUTH_KRB_LIBFILE): $(AFSAUTH_KRB_LIBOBJS)
	$(LIBARCH) rpcrt4.lib

############################################################################
# build setkey

SETKEY_EXEFILE = $(OUT)\setkey.exe

SETKEY_EXEOBJS =\
	$(OUT)\setkey.obj

EXELIBDIR = $(DESTDIR)\lib

EXELIBS =\
	$(EXELIBDIR)\afs\afsauth.lib \
	$(EXELIBDIR)\afsrxkad.lib \
	$(EXELIBDIR)\afsrx.lib \
	$(EXELIBDIR)\afslwp.lib \
	$(EXELIBDIR)\afs\afsutil.lib \
	$(EXELIBDIR)\afs\afseventlog.lib \
	$(EXELIBDIR)\afs\afsreg.lib \
	$(EXELIBDIR)\libafsconf.lib \
	$(EXELIBDIR)\opr.lib \
	$(EXELIBDIR)\afshcrypto.lib \
	$(EXELIBDIR)\afsroken.lib \
	$(EXELIBDIR)\afsrfc3961.lib

$(SETKEY_EXEFILE): $(SETKEY_EXEOBJS) $(EXELIBS)
	$(EXECONLINK) dnsapi.lib shell32.lib
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# build copyauth
COPYAUTH_EXEFILE = $(DESTDIR)\etc\copyauth.exe

COPYAUTH_EXEOBJS =\
	$(OUT)\copyauth.obj

$(COPYAUTH_EXEFILE): $(COPYAUTH_EXEOBJS) $(EXELIBS)
	$(EXECONLINK)
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

$(INCFILES):$$(@F)
	 $(COPY)  $** $(INCFILEDIR)\.

acfg_errors.c cellconfig.h : acfg_errors.et cellconfig.p.h
	$(DEL) cellconfig.h  acfg_errors.c
	$(COMPILE_ET) acfg_errors.et -h cellconfig

ktc_errors.c auth.h: ktc_errors.et auth.p.h
	$(DEL) auth.h ktc_errors.c
	$(COMPILE_ET) ktc_errors.et -h auth

install_headers: $(INCFILES)

install: $(AFSAUTH_LIBFILE) $(AFSAUTH_KRB_LIBFILE) $(OUT)\setkey.exe # $(COPYAUTH_EXEFILE)

clean::
	$(DEL) acfg_errors.c ktc_errors.c
	$(DEL) $(INCFILES) $(AFSAUTH_LIBFILE)
	$(DEL) auth.h  cellconfig.h
        $(DEL) token.h token.xdr.c

setkey: $(SETKEY_EXEFILE)

mkdir:

