# rcsid : $Id: NTMakefile,v 1.5.4.4 2008/07/10 18:28:26 jaltman Exp $

RELDIR=WINNT\install\loopback
!INCLUDE ..\..\..\config\NTMakefile.$(SYS_NAME)
!INCLUDE ..\..\..\config\NTMakefile.version

MEDIABINDIR = $(DESTDIR)\WinInstall\Config

EXEFILE = $(MEDIABINDIR)\instloop.exe

EXERES = $(OUT)\instloop.res

DLLFILE = $(MEDIABINDIR)\afsloopback.dll

DLLRES = $(OUT)\afsloopback.res

DLLEXPORTS=\
	-EXPORT:UnInstallLoopBack \
	-EXPORT:IsLoopbackInstalled \
	-EXPORT:InstallLoopBack \
	-EXPORT:doLoopBackEntryW \
	-EXPORT:uninstallLoopBackEntryW \
	-EXPORT:installLoopbackMSI \
	-EXPORT:uninstallLoopbackMSI

DLLLIBFILES=\
	setupapi.lib msi.lib uuid.lib Shell32.lib ole32.lib advapi32.lib wbemuuid.lib

LINK=link

# Figure out which DDK include path we require
!IF EXIST ($(NTDDKDIR)\netcfgx.h)
DDK_INCL = $(NTDDKDIR)
!ELSEIF EXIST ($(NTDDKDIR)\INC\WNET\netcfgx.h)
DDK_INCL = $(NTDDKDIR)\INC\WNET
!ELSEIF EXIST ($(NTDDKDIR)\INC\API\netcfgx.h)
DDK_INCL = $(NTDDKDIR)\INC\API
!ELSE
!ERROR netcfgx.h header file cannot be found.  DDK improperly configured.
!ENDIF

# afsloopback.dll

DLLSOURCEFILES = loopbackutils.cpp renameconnection.cpp wmi.cpp
DLLOBJFILES =  $(OUT)\loopbackutils.obj $(OUT)\renameconnection.obj $(OUT)\wmi.obj

$(EXERES) : instloop.rc AFS_component_version_number.h

$(DLLRES) : afsloopback.rc AFS_component_version_number.h

STATICC2OBJ=$(CC) $(cflags) $(afscflags) $(afscdefs) -ML

$(OUT)\loopbackutils.obj: loopbackutils.cpp
	$(STATICC2OBJ) -c -DUNICODE -D_UNICODE /Fo$@ $**

$(OUT)\renameconnection.obj: renameconnection.cpp
	$(STATICC2OBJ) -c -DUNICODE -D_UNICODE /Fo$@ $**

$(OUT)\wmi.obj: wmi.cpp
	$(STATICC2OBJ)  -I$(DDK_INCL) -c -DUNICODE -D_UNICODE /Fo$@ $**

$(DLLFILE): $(DLLOBJFILES) $(DLLRES)
	$(LINK) -DLL $(DLLEXPORTS) -OUT:$@ $** $(DLLLIBFILES)
        $(_VC_MANIFEST_EMBED_DLL)
        $(CODESIGN_USERLAND)

# instloop.exe

EXEOBJFILES = $(OUT)\instloop.obj $(DLLOBJFILES)
#EXELIBFILES = $(MEDIABINDIR)\afsloopback.lib

$(OUT)\instloop.obj: instloop.c
      $(STATICC2OBJ) -c -DUNICODE -D_UNICODE /Fo$@ $**

$(EXEFILE): $(EXEOBJFILES) $(EXERES)
        $(LINK) /OUT:$@ $** $(DLLLIBFILES)
        $(_VC_MANIFEST_EMBED_EXE)
        $(CODESIGN_USERLAND)

install:  $(DLLFILE) $(EXEFILE)

clean	::
	$(DEL) *.pdb
	$(DEL) $(EXERES)
	$(DEL) $(DLLRES)
	$(DEL) AFS_component_version_number.h

