# 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=libafsrpc
AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DNOGDI -DWIN32_LEAN_AND_MEAN -DAFS_PTHREAD_ENV -DMAKEDEBUGCALL
!include ..\config\NTMakefile.$(SYS_NAME)
!include ..\config\NTMakefile.version

RX = ..\rx
RXSTAT = ..\rxstat
RXKAD = ..\rxkad
UTIL = ..\util
FSINT = ..\fsint
COMERR = ..\comerr
LWP = ..\lwp

# Additional debugging flag for RX.
!IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DRXDEBUG -DRXDEBUG_PACKET -DRX_TRACK_PACKETS -DRX_REFCOUNT_CHECK
!ENDIF

LIBFILE = $(DESTDIR)\lib\afsrpc.dll

# Object files by category.
MULTIOBJS = $(OUT)\rx_multi.obj

XDROBJS = $(OUT)\xdr.obj $(OUT)\xdr_array.obj $(OUT)\xdr_arrayn.obj $(OUT)\xdr_float.obj $(OUT)\xdr_mem.obj \
	$(OUT)\xdr_rec.obj  $(OUT)\xdr_refernce.obj $(OUT)\xdr_rx.obj $(OUT)\xdr_update.obj \
	$(OUT)\xdr_afsuuid.obj $(OUT)\xdr_int64.obj $(OUT)\xdr_int32.obj $(OUT)\xdr_len.obj

RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_user.obj $(OUT)\rx_pthread.obj \
	 $(OUT)\rx.obj $(OUT)\rx_clock_nt.obj $(OUT)\rx_null.obj \
	 $(OUT)\rx_globals.obj $(OUT)\rx_getaddr.obj $(OUT)\rx_misc.obj \
	 $(OUT)\rx_packet.obj $(OUT)\rx_rdwr.obj $(OUT)\rx_trace.obj \
	 $(OUT)\rx_xmit_nt.obj $(OUT)\rx_conncache.obj $(OUT)\rx_opaque.obj \
	 $(OUT)\rx_identity.obj $(OUT)\rx_stats.obj \
         $(OUT)\rx_call.obj $(OUT)\rx_conn.obj $(OUT)\rx_peer.obj

RXSTATBJS = $(OUT)\rxstat.obj $(OUT)\rxstat.ss.obj $(OUT)\rxstat.xdr.obj $(OUT)\rxstat.cs.obj

LIBRXKAD_OBJS = $(OUT)\rxkad_client.obj $(OUT)\rxkad_server.obj $(OUT)\rxkad_common.obj $(OUT)\rxkad_errs.obj \
	$(OUT)\ticket.obj $(OUT)\ticket5.obj $(OUT)\crc.obj $(OUT)\AFS_component_version_number.obj

LIBRXKAD_REGOBJS = $(OUT)\bg-fcrypt.obj

UTILOBJS = $(OUT)\winsock_nt.obj \
           $(OUT)\pthread_glock.obj

COMERRBJS = $(OUT)\error_msg.obj $(OUT)\et_name.obj $(OUT)\com_err.obj

LWPOBJS = $(OUT)\lock.obj $(OUT)\fasttime.obj $(OUT)\threadname.obj

FSINTBJS = $(OUT)\afsint.cs.obj \
           $(OUT)\afsint.xdr.obj \
           $(OUT)\afscbint.cs.obj \
           $(OUT)\afscbint.xdr.obj \
	   $(OUT)\afsaux.obj

DLLOBJS = $(MULTIOBJS) $(RXOBJS) $(XDROBJS) $(RXSTATBJS) $(LIBRXKAD_OBJS) \
	$(LIBRXKAD_REGOBJS) $(UTILOBJS) $(COMERRBJS) \
        $(LWPOBJS) $(OUT)\afsrpc.res

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

$(RXSTATBJS):$(RXSTAT)\$$(@B).c
	$(C2OBJ) $** -I$(RXSTAT)

$(LIBRXKAD_REGOBJS) $(LIBRXKAD_OBJS):$(RXKAD)\$$(@B).c
	$(C2OBJ) $** -I$(RXKAD)

$(COMERRBJS):$(COMERR)\$$(@B).c
	$(C2OBJ) $** -I$(COMERR)

$(FSINTBJS):$(FSINT)\$$(@B).c
	$(C2OBJ) $** -I$(FSINT)

$(UTILOBJS):$(UTIL)\$$(@B).c
	$(C2OBJ) $** -I$(UTIL)

$(LWPOBJS): $(LWP)\$$(@B).C
	$(C2OBJ) $** -I$(LWP)

NTMAKE = nmake /nologo /f ntmakefile


DLLLIBS =\
	$(DESTDIR)\lib\afspthread.lib \
	$(DESTDIR)\lib\afs\mtafsutil.lib \
	$(DESTDIR)\lib\afs\afsreg.lib \
	$(DESTDIR)\lib\opr.lib \
	$(DESTDIR)\lib\afshcrypto.lib \
	$(DESTDIR)\lib\afsrfc3961.lib \
	$(DESTDIR)\lib\afsroken.lib

$(LIBFILE): $(DLLOBJS) $(DLLLIBS)
	$(DLLCONLINK) /DEF:afsrpc.def iphlpapi.lib
        $(_VC_MANIFEST_EMBED_DLL)
	$(DLLPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)
	$(MAKECYGLIB) --input-def afsrpc.def

# Definitions for generating versioninfo resources
$(OUT)\afsrpc.res: AFS_component_version_number.h

install: $(LIBFILE)

clean::
	$(DEL) $(DESTDIR)\lib\afsrpc.dll $(DESTDIR)\lib\afsrpc.lib $(DESTDIR)\lib\afsrpc.exp
