# 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

AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) /D"_AFXDLL" /DSMB_UNICODE -I..\kfw\inc\loadfuncs \
        -I..\kfw\inc\krb5 -I..\kfw\inc\leash -I$(DESTDIR)\include\afs \
        -I$(DESTDIR)\include\rx -I..\afsrdr\common -I..\afsrdr\user
AFSDEV_NETGUI = 1
RELDIR=WINNT\afsd
!INCLUDE ..\..\config\NTMakefile.$(SYS_NAME)
!INCLUDE ..\..\config\NTMakefile.version

EXEDIR = $(DESTDIR)\root.client\usr\vice\etc

############################################################################
# Definitions for installing header files

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

# afsdicon and below added for WINNT\extra support

INCFILES =\
	$(INCFILEDIR)\afsd.h \
	$(INCFILEDIR)\cm.h \
	$(INCFILEDIR)\cm_buf.h \
	$(INCFILEDIR)\cm_cell.h \
	$(INCFILEDIR)\cm_config.h \
	$(INCFILEDIR)\cm_conn.h \
	$(INCFILEDIR)\cm_error.h \
	$(INCFILEDIR)\cm_ioctl.h \
	$(INCFILEDIR)\cm_scache.h \
	$(INCFILEDIR)\cm_server.h \
	$(INCFILEDIR)\cm_user.h \
	$(INCFILEDIR)\cm_dns.h \
	$(INCFILEDIR)\cm_utils.h \
        $(INCFILEDIR)\fs_acl.h \
	$(INCFILEDIR)\fs_utils.h \
	$(INCFILEDIR)\krb.h \
	$(INCFILEDIR)\krb_prot.h \
	$(INCFILEDIR)\cm_dir.h \
	$(INCFILEDIR)\smb.h \
	$(INCFILEDIR)\smb3.h \
	$(INCFILEDIR)\smb_iocons.h \
	$(INCFILEDIR)\smb_ioctl.h \
	$(INCFILEDIR)\smb_rpc.h \
	$(INCFILEDIR)\afsrpc.h \
!IFDEF OSICRASH
	$(INCFILEDIR)\afsdcrash.h \
!ENDIF
	$(INCFILEDIR)\cm_dns_private.h \
	$(INCFILEDIR)\lanahelper.h \
	$(INCFILEDIR)\afsdicon.h \
	$(INCFILEDIR)\cm_callback.h \
	$(INCFILEDIR)\cm_aclent.h \
	$(INCFILEDIR)\cm_volume.h \
        $(INCFILEDIR)\cm_volstat.h \
	$(INCFILEDIR)\cm_dcache.h \
	$(INCFILEDIR)\cm_access.h \
	$(INCFILEDIR)\cm_vnodeops.h \
	$(INCFILEDIR)\cm_dir.h \
	$(INCFILEDIR)\cm_utils.h \
	$(INCFILEDIR)\cm_daemon.h \
	$(INCFILEDIR)\cm_ioctl.h \
	$(INCFILEDIR)\cm_dnlc.h \
	$(INCFILEDIR)\cm_buf.h \
	$(INCFILEDIR)\cm_freelance.h \
        $(INCFILEDIR)\cm_memmap.h \
	$(INCFILEDIR)\cm_performance.h \
        $(INCFILEDIR)\cm_nls.h \
        $(INCFILEDIR)\afsd_eventlog.h \
        $(INCFILEDIR)\afsd_eventmessages.h \
        $(INCFILEDIR)\afskfw.h \
        $(INCFILEDIR)\afsicf.h

IDLFILES =\
	afsrpc.h $(OUT)\afsrpc_c.obj

CONFOBJS=$(OUT)\cm_config.obj \
         $(OUT)\cm_dns.obj \
         $(OUT)\cm_nls.obj

$(CONFOBJS):

RXOBJS = $(OUT)\xdr_int32.obj $(OUT)\xdr_int64.obj

$(RXOBJS):

RX= ..\..\rx

$(RXOBJS): $(RX)\$$(@B).c
	$(C2OBJ) -I$(RX) $**

$(IDLFILES):afsrpc.idl
	midl $(MIDL_FLAGS) $(AFSDEV_AUXMIDLFLAGS) /app_config $?

ms-srvsvc.h ms-srvsvc_s.c: ms-srvsvc.idl
	midl $(MIDL_FLAGS) $(AFSDEV_AUXMIDLFLAGS) /Os ms-srvsvc.idl

ms-wkssvc.h ms-wkssvc_s.c: ms-wkssvc.idl
	midl $(MIDL_FLAGS) $(AFSDEV_AUXMIDLFLAGS) /Os ms-wkssvc.idl

$(OUT)\ms-srvsvc_s.obj: ms-srvsvc_s.c
	$(C2OBJ) /FImsrpc.h /Fo$@ $**

$(OUT)\ms-wkssvc_s.obj: ms-wkssvc_s.c
	$(C2OBJ) /FImsrpc.h /Fo$@ $**

AFSDOBJS=\
        $(OUT)\rawops.obj \
	$(OUT)\afsd_init.obj \
        $(OUT)\cm_btree.obj \
	$(OUT)\cm_cell.obj \
	$(OUT)\cm_server.obj \
	$(OUT)\cm_volume.obj \
        $(OUT)\cm_volstat.obj \
	$(OUT)\cm_config.obj \
	$(OUT)\cm_conn.obj \
	$(OUT)\cm_user.obj \
	$(OUT)\cm_buf.obj \
	$(OUT)\cm_scache.obj \
	$(OUT)\cm_dcache.obj \
	$(OUT)\cm_access.obj \
	$(OUT)\cm_callback.obj \
	$(OUT)\cm_vnodeops.obj \
	$(OUT)\cm_dir.obj \
	$(OUT)\cm_utils.obj \
	$(OUT)\largeintdotnet.obj \
	$(OUT)\smb.obj \
	$(OUT)\smb3.obj \
	$(OUT)\smb_ioctl.obj \
	$(OUT)\smb_rpc.obj \
	$(OUT)\msrpc.obj \
	$(OUT)\cm_ioctl.obj \
	$(OUT)\cm_daemon.obj \
	$(OUT)\cm_aclent.obj \
	$(OUT)\cm_dnlc.obj \
	$(OUT)\cm_rpc.obj \
        $(OUT)\cm_memmap.obj \
        $(OUT)\cm_performance.obj \
        $(OUT)\cm_nls.obj \
	$(OUT)\afsrpc_s.obj \
!IFDEF OSICRASH
	$(OUT)\afsdcrash.obj \
!ENDIF
        $(OUT)\cm_freelance.obj \
        $(OUT)\afsd_eventlog.obj \
        $(OUT)\afsd_flushvol.obj \
        $(OUT)\afsicf.obj \
	$(OUT)\ms-srvsvc_s.obj \
	$(OUT)\ms-wkssvc_s.obj \
	$(OUT)\rpc_wkssvc.obj \
	$(OUT)\rpc_srvsvc.obj \
        $(OUT)\AFS_component_version_number.obj \
	$(OUT)\RDRInit.obj \
	$(OUT)\RDRFunction.obj \
        $(OUT)\RDRIoctl.obj \
        $(OUT)\RDRPipe.obj

$(AFSDOBJS):

$(OUT)\RDRInit.obj: ..\afsrdr\user\RDRInit.cpp ..\afsrdr\user\RDRPrototypes.h ..\afsrdr\user\RDRIoctl.h
	$(CPP2OBJ) ..\afsrdr\user\RDRInit.cpp

$(OUT)\RDRFunction.obj: ..\afsrdr\user\RDRFunction.c ..\afsrdr\user\RDRPrototypes.h ..\afsrdr\user\RDRIoctl.h
	$(C2OBJ)  ..\afsrdr\user\RDRFunction.c

$(OUT)\RDRIoctl.obj: ..\afsrdr\user\RDRIoctl.c ..\afsrdr\user\RDRIoctl.h
	$(C2OBJ)  ..\afsrdr\user\RDRIoctl.c

$(OUT)\RDRPipe.obj: ..\afsrdr\user\RDRPipe.c ..\afsrdr\user\RDRPipe.h
	$(C2OBJ)  ..\afsrdr\user\RDRPipe.c

$(OUT)\cm_conn.obj: cm_conn.c
	$(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $**

FSOBJS=$(OUT)\fs.obj \
       $(OUT)\fs_acl.obj \
       $(OUT)\fs_utils.obj \
       $(OUT)\cm_nls.obj \
       $(OUT)\parsemode.obj

CMDBGOBJS=$(OUT)\cmdebug.obj

$(CMDBGOBJS): $(AFSROOT)\src\venus\cmdebug.c
	$(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $**

AFSIOOBJS=$(OUT)\afsio.obj

$(AFSIOOBJS): $(AFSROOT)\src\venus\afsio.c
	$(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $**

SLOBJS= $(OUT)\symlink.obj \
        $(OUT)\fs_utils.obj \
        $(OUT)\cm_nls.obj

ILIBDIR = $(DESTDIR)\lib

#
# Rules for message compiler info for logging events
#
$(INCFILEDIR)\afsd_eventmessages.h:  afsd_eventmessages.mc
	mc afsd_eventmessages.mc

############################################################################
#
# Flags for linking LOGON DLL'S
#

LOGONLINKFLAGS = -entry:DllEntryPoint


############################################################################
#
# IDL COMPILATION
#

MIDL_FLAGS=/app_config \
	   /Zp4 \
	   /cpp_cmd $(cc) \
	   /cpp_opt "-E" \
           /nologo

.SUFFIXES: .h .idl

.idl.h:
	midl $(MIDL_FLAGS) $(AFSDEV_AUXMIDLFLAGS) $<


AFSD_SDKLIBS =\
        netapi32.lib \
        dnsapi.lib \
        mpr.lib \
        rpcrt4.lib \
        user32.lib \
        Dbghelp.lib \
        strsafe.lib \
        mpr.lib \
        secur32.lib \
        ole32.lib \
        oleaut32.lib \
        iphlpapi.lib \
        shell32.lib \
        shlwapi.lib

############################################################################
# libafsconf.dll

CONF_DLLFILE = $(DESTDIR)\lib\libafsconf.dll

CONF_DLLLIBS = \
    $(DESTDIR)\lib\afs\afsutil.lib \
    $(DESTDIR)\lib\afs\afsreg.lib \
    $(DESTDIR)\lib\afsroken.lib

$(CONF_DLLFILE): $(CONFOBJS) $(OUT)\libafsconf.res $(CONF_DLLLIBS)
	$(DLLGUILINK) -def:libafsconf.def  $(AFSD_SDKLIBS)
        $(_VC_MANIFEST_EMBED_DLL)
	$(DLLPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)
	$(MAKECYGLIB) --input-def libafsconf.def
	$(DEL) $*.exp

############################################################################
# lanahelper.lib

LANAHELPERLIB = $(DESTDIR)\lib\lanahelper.lib

LANAHELPERLIB_OBJS =\
      $(OUT)\lanahelper.obj

$(LANAHELPERLIB_OBJS):

$(LANAHELPERLIB): $(LANAHELPERLIB_OBJS)
      $(LIBARCH) netapi32.lib

############################################################################
# afskfw.lib

AFSKFWLIB = $(DESTDIR)\lib\afskfw.lib

PTERROBJS=$(OUT)\pterror.obj

$(PTERROBJS): $(AFSROOT)\src\ptserver\pterror.c
	$(C2OBJ) /Fo$@ $**

KTCERROBJS=$(OUT)\ktc_errors.obj

$(KTCERROBJS): $(AFSROOT)\src\auth\ktc_errors.c
	$(C2OBJ) /Fo$@ $**

AFSKFWLIB_OBJS = $(OUT)\afskfw.obj

$(AFSKFWLIB_OBJS):

$(AFSKFWLIB): $(AFSKFWLIB_OBJS) $(PTERROBJS) $(KTCERROBJS)
      $(LIBARCH)

############################################################################
# afslogon.dll

LOGON_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\afslogon.dll

LOGON_DLLOBJS =\
    $(OUT)\afslogon.obj \
    $(OUT)\logon_ad.obj \
    $(OUT)\afslogon.res \
    $(OUT)\cm_nls.obj

LOGON_DLLLIBS =\
    $(DESTDIR)\lib\afsauthent.lib \
    $(DESTDIR)\lib\libafsconf.lib \
    $(DESTDIR)\lib\afs\afscom_err.lib \
    $(DESTDIR)\lib\afs\afsutil.lib \
    $(DESTDIR)\lib\opr.lib \
    $(DESTDIR)\lib\afsroken.lib \
    $(LANAHELPERLIB) \
    $(AFSKFWLIB)

LOGON_DLLSDKLIBS =\
        dnsapi.lib \
        netapi32.lib \
        mpr.lib \
	advapi32.lib \
	secur32.lib \
	strsafe.lib \
	oleaut32.lib \
	ole32.lib \
	adsiid.lib \
	activeds.lib \
	user32.lib \
        userenv.lib \
        shell32.lib \
        rpcrt4.lib

$(LOGON_DLLFILE): $(LOGON_DLLOBJS) $(LOGON_DLLLIBS)
	$(DLLGUILINK) $(LOGONLINKFLAGS) -def:afslogon.def $(LOGON_DLLSDKLIBS)
        $(_VC_MANIFEST_EMBED_DLL)
	$(DLLPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)
	$(COPY) $*.lib $(DESTDIR)\lib
	$(DEL) $*.lib $*.exp

############################################################################
# Install target; primary makefile target

install_objs: $(CONF_DLLFILE) $(LANAHELPERLIB) $(OUT)\afsicf.obj
     $(COPY) $(OUT)\afsicf.obj $(DESTDIR)\lib

install_headers: $(IDLFILES) $(INCFILES) ms-wkssvc.h ms-srvsvc.h

install: install_headers install_objs $(CONF_DLLFILE) \
	$(EXEDIR)\klog.exe \
	$(EXEDIR)\tokens.exe \
	$(EXEDIR)\unlog.exe \
	$(EXEDIR)\afsd_service.exe \
	$(EXEDIR)\fs.exe \
        $(EXEDIR)\symlink.exe \
        $(EXEDIR)\afsdacl.exe \
	$(LOGON_DLLFILE) \
	$(EXEDIR)\afsshare.exe \
	$(DESTDIR)\bin\kpasswd.exe \
        $(EXEDIR)\cmdebug.exe \
        $(EXEDIR)\afscpcc.exe \
        $(EXEDIR)\afsio.exe

install_libutils: install_headers $(CONF_DLLFILE) \
	$(EXEDIR)\klog.exe \
	$(EXEDIR)\tokens.exe \
	$(EXEDIR)\unlog.exe \
	$(EXEDIR)\fs.exe $(EXEDIR)\symlink.exe \
	$(EXEDIR)\afsshare.exe \
	$(DESTDIR)\bin\kpasswd.exe $(EXEDIR)\cmdebug.exe

############################################################################
# Local clean target; augments predefined clean target

############################################################################
# assorted exe's

EXELIBS = \
	$(DESTDIR)\lib\afs\afsauth.lib \
	$(DESTDIR)\lib\afs\afskauth.lib \
	$(DESTDIR)\lib\afs\afsprot.lib \
	$(DESTDIR)\lib\afs\afspioctl.lib \
	$(DESTDIR)\lib\afs\afsaudit.lib \
	$(DESTDIR)\lib\afs\afsutil.lib \
	$(DESTDIR)\lib\afs\afscom_err.lib \
	$(DESTDIR)\lib\afs\afsreg.lib \
	$(DESTDIR)\lib\afs\afscmd.lib \
	$(DESTDIR)\lib\afs\afsvldb.lib \
	$(DESTDIR)\lib\afsubik.lib \
	$(DESTDIR)\lib\afsrxkad.lib \
	$(DESTDIR)\lib\afsrx.lib \
	$(DESTDIR)\lib\afslwp.lib \
	$(DESTDIR)\lib\libosi.lib \
	$(DESTDIR)\lib\libafsconf.lib \
	$(DESTDIR)\lib\opr.lib \
	$(DESTDIR)\lib\afshcrypto.lib \
	$(DESTDIR)\lib\afsroken.lib

EXELIBS2 = \
        $(DESTDIR)\lib\afsrpc.lib \
	$(DESTDIR)\lib\afs\afsprot.lib \
	$(DESTDIR)\lib\afs\afspioctl.lib \
	$(DESTDIR)\lib\afs\afscom_err.lib \
	$(DESTDIR)\lib\afs\afscmd.lib \
	$(DESTDIR)\lib\afs\afsutil.lib \
	$(DESTDIR)\lib\afsubik.lib \
	$(DESTDIR)\lib\afsrxkad.lib \
	$(DESTDIR)\lib\afslwp.lib \
	$(DESTDIR)\lib\libosi.lib \
	$(DESTDIR)\lib\libafsconf.lib \
	$(DESTDIR)\lib\opr.lib \
	$(DESTDIR)\lib\afshcrypto.lib \
	$(DESTDIR)\lib\afsroken.lib

EXELIBS3 = \
	$(DESTDIR)\lib\afs\afscmd.lib \
	$(DESTDIR)\lib\afsrxkad.lib \
	$(DESTDIR)\lib\opr.lib \
	$(DESTDIR)\lib\afshcrypto.lib \
	$(DESTDIR)\lib\afsroken.lib

# klog.exe
$(EXEDIR)\klog.exe: $(OUT)\cklog.obj $(OUT)\klog.res $(EXELIBS)
	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# tokens.exe
$(EXEDIR)\tokens.exe: $(OUT)\ctokens.obj $(OUT)\tokens.res $(EXELIBS)
	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# unlog.exe
$(EXEDIR)\unlog.exe: $(OUT)\cunlog.obj $(OUT)\unlog.res $(EXELIBS)
	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# afscpcc.exe
$(EXEDIR)\afscpcc.exe: $(OUT)\afscpcc.obj $(OUT)\afscpcc.res $(LOGON_DLLLIBS)
	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib userenv.lib
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)


# afsd.exe
AFSD_EXEFILE = $(EXEDIR)\afsd.exe

AFSD_EXELIBS =\
	$(DESTDIR)\lib\libosi.lib \
	$(DESTDIR)\lib\afs\mtafsvldb.lib \
	$(DESTDIR)\lib\afs\mtafsint.lib \
	$(DESTDIR)\lib\afsrpc.lib \
        $(DESTDIR)\lib\afsrxkad.lib \
	$(DESTDIR)\lib\afs\mtafsutil.lib \
	$(DESTDIR)\lib\afsauthent.lib \
	$(DESTDIR)\lib\libafsconf.lib \
	$(DESTDIR)\lib\afs\afsreg.lib \
	$(DESTDIR)\lib\afspthread.lib \
	$(DESTDIR)\lib\afsroken.lib \
        $(DESTDIR)\lib\afshcrypto.lib \
        $(LANAHELPERLIB)

$(AFSD_EXEFILE): $(OUT)\afsd.obj $(AFSDOBJS) $(OUT)\afsd.res  $(RXOBJS) $(AFSD_EXELIBS)
	$(EXEGUILINK) $(AFSD_SDKLIBS)
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# afsd_service.exe
$(EXEDIR)\afsd_service.exe: $(OUT)\afsd_service.obj $(AFSDOBJS) $(OUT)\afsd_service.res  $(RXOBJS) $(AFSD_EXELIBS)
	$(EXECONLINK) $(AFSD_SDKLIBS) /MAP /LARGEADDRESSAWARE
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# fs.exe
$(EXEDIR)\fs.exe: $(FSOBJS) $(OUT)\fs.res $(EXELIBS)
	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# cmdebug.exe
$(EXEDIR)\cmdebug.exe: $(CMDBGOBJS) $(OUT)\cmdebug.res
	$(EXECONLINK) $(EXELIBS2) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib rpcrt4.lib
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# afsio.exe
AFSCPLIB = \
        $(DESTDIR)\lib\afs\afscp.lib

!IF "$(CPU)" == "IA64" || "$(CPU)" == "AMD64" || "$(CPU)" == "ALPHA64"
KFWLIBS = \
    ..\kfw\lib\$(CPU)\krb5_64.lib \
    ..\kfw\lib\$(CPU)\comerr64.lib \
    dnsapi.lib mpr.lib delayimp.lib
LINKOPTS = /DELAYLOAD:krb5_64.dll /DELAYLOAD:comerr64.dll
!else
KFWLIBS = \
    ..\kfw\lib\$(CPU)\krb5_32.lib \
    ..\kfw\lib\$(CPU)\comerr32.lib \
    dnsapi.lib mpr.lib delayimp.lib
LINKOPTS = /DELAYLOAD:krbv4w32.dll /DELAYLOAD:krb5_32.dll /DELAYLOAD:comerr32.dll
!endif

$(EXEDIR)\afsio.exe: $(AFSIOOBJS) $(OUT)\afsio.res $(RXOBJS) $(AFSD_EXELIBS) $(EXELIBS3) $(AFSCPLIB)
	$(EXECONLINK) $(KFWLIBS) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib rpcrt4.lib
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# symlink.exe
$(EXEDIR)\symlink.exe: $(SLOBJS) $(OUT)\symlink.res  $(EXELIBS)
	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# afsshare.exe
$(EXEDIR)\afsshare.exe: $(OUT)\afsshare.obj $(OUT)\afsshare.res $(EXELIBS)
	$(EXECONLINK)
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# afsdacl.exe
$(EXEDIR)\afsdacl.exe: $(OUT)\afsdacl.obj $(OUT)\afsdacl.res
	$(EXECONLINK)
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

# kpasswd.exe - built in kauth, but rebuild here to make pthread-based,
#    which is required for Windows 95.  At some point it would be nice
#    for all commands to be pthread based, in which case they should
#    be built in a separate directory (perhaps tbin ala tviced) or
#    libafsauthent should be built earlier so that each command can
#    be built in its native directory.

KAUTH = ..\..\kauth

KPASSWD_OBJS =\
	$(OUT)\kpasswd.obj \
	$(OUT)\kkids.obj \
	$(OUT)\kautils.obj \
	$(OUT)\$(KAUTH)\kpasswd.res

KPASSWD_LIBS =\
	$(DESTDIR)\lib\afsauthent.lib \
	$(DESTDIR)\lib\afsrpc.lib \
	$(DESTDIR)\lib\afs\afscmd.lib \
	$(DESTDIR)\lib\afs\mtafsutil.lib \
	$(DESTDIR)\lib\opr.lib \
	$(DESTDIR)\lib\afshcrypto.lib \
	$(DESTDIR)\lib\afsroken.lib

$(OUT)\kpasswd.obj: $(KAUTH)/kpasswd.c
	$(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $**

$(OUT)\kkids.obj: $(KAUTH)/kkids.c
	$(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $**

$(OUT)\kautils.obj: $(KAUTH)/kautils.c
	$(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $**

$(OUT)\kpasswd.res: $(KAUTH)\kpasswd.rc
    $(RC) /Fo$@ $**

$(DESTDIR)\bin\kpasswd.exe: $(KPASSWD_OBJS) $(KPASSWD_LIBS)
	$(DEL) $(DESTDIR)\bin\kpasswd.exe
	$(EXECONLINK)
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)


############################################################################
# generate versioninfo resources

$(OUT)\afsshare.res: afsshare.rc AFS_component_version_number.h

$(OUT)\fs.res: fs.rc AFS_component_version_number.h

$(OUT)\symlink.res: symlink.rc AFS_component_version_number.h

$(OUT)\klog.res: klog.rc AFS_component_version_number.h

$(OUT)\tokens.res: tokens.rc AFS_component_version_number.h

$(OUT)\unlog.res: unlog.rc AFS_component_version_number.h

$(OUT)\afscpcc.res: afscpcc.rc AFS_component_version_number.h

afsd_eventmessages.rc: $(INCFILEDIR)\afsd_eventmessages.h

$(OUT)\afsd_service.res: afsd_service.rc afsd_eventmessages.rc AFS_component_version_number.h

$(OUT)\afslogon.res: afslogon.rc AFS_component_version_number.h

$(OUT)\libafsconf.res: libafsconf.rc AFS_component_version_number.h

############################################################################
clean::
	$(DEL) $(OUT)\*.res
	$(DEL) afsrpc.h
	$(DEL) afsrpc_?.*
	$(DEL) ms-srvsvc.h
	$(DEL) ms-srvsvc_?.*
	$(DEL) ms-wkssvc.h
	$(DEL) ms-wkssvc_?.*
        $(DEL) afsd_eventmessages.h
        $(DEL) afsd_eventmessages.rc
        $(DEL) MSG?????.bin
	$(DEL) $(CONF_DLLFILE)
	$(DEL) $(LOGON_DLLFILE)

mkdir:

############################################################################
# Tests

{test}.c{$(OUT)\}.obj:
	$(C2OBJ) $<

test::

test:: btreetest

btreetest: "$(OUT)\btreetest.exe"
	"$(OUT)\btreetest.exe"

$(OUT)\btreetest.exe: \
		$(OUT)\btreetest.obj \
		$(OUT)\cm_btree.obj \
		$(OUT)\cm_nls.obj \
		$(OUT)\cm_utils.obj \
		$(DESTDIR)\lib\libosi.lib
	$(EXECONLINK)
	$(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
