# 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

# make compiler warnings fatal

AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -WX

# include the primary makefile

!INCLUDE ..\..\config\NTMakefile.$(SYS_NAME)
!INCLUDE ..\..\config\NTMakefile.version


############################################################################

ILIBDIR = $(DESTDIR)\lib\afs


############################################################################
# Build targets - one for each dll we need to make

INSTALL_UTILS_DLLFILE       = $(DESTDIR)\root.server\usr\afs\bin\InstallUtils.dll
SERVER_UNINST_DLLFILE       = $(DESTDIR)\root.server\usr\afs\bin\ServerUninst.dll
CLIENT_UNINST_DLLFILE       = $(DESTDIR)\root.server\usr\afs\bin\ClientUninst.dll
CC_UNINST_DLLFILE           = $(DESTDIR)\root.server\usr\afs\bin\CCUninst.dll
LIGHT_CLIENT_UNINST_DLLFILE = $(DESTDIR)\root.server\usr\afs\bin\LightClientUninst.dll
DOCS_UNINST_DLLFILE         = $(DESTDIR)\root.server\usr\afs\bin\DocsUninst.dll


############################################################################
# Source files and libraries that are shared by all of the targets.

AFSAPPLIBOBJS = \
    subclass.obj

DLLOBJS = \
    $(AFSAPPLIBOBJS)    \
    progress_dlg.obj    \
    animate_icon.obj    \
    sutil.obj           \
    forceremove.obj     \
    afs_setup_utils_stub.res

VCLIBS = \
	comctl32.lib \
	shell32.lib

DLLLIBS = \
	$(DESTDIR)\lib\afs\TaLocale.lib \
    $(DESTDIR)\lib\afs\afsreg.lib \
    $(DESTDIR)\lib\afs\afsutil.lib


############################################################################
# Definitions for building afsapplib objects

AFSAPPLIBDIR = ..\..\WINNT\afsapplib

subclass.obj: $(AFSAPPLIBDIR)\subclass.cpp
    $(C2OBJ) -I$(AFSAPPLIBDIR) $(AFSAPPLIBDIR)\subclass.cpp


############################################################################
# Definitions for building afsrm.exe

AFSRM_EXEFILE = $(DESTDIR)\bin\afsrm.exe

AFSRM_EXEOBJS =\
    afsrm.obj \
    forceremove.obj \
    sutil.obj \
    AFS_component_version_number.obj

AFSRM_EXELIBS =\
    $(DESTDIR)\lib\afs\afsreg.lib \
    $(DESTDIR)\lib\afs\afscmd.lib \
    $(DESTDIR)\lib\afs\afscom_err.lib \
    $(DESTDIR)\lib\afs\afsutil.lib

$(AFSRM_EXEFILE): $(AFSRM_EXEOBJS) $(AFSRM_EXELIBS)
    $(EXECONLINK)

############################################################################

install : $(INSTALL_UTILS_DLLFILE) $(SERVER_UNINST_DLLFILE) $(CLIENT_UNINST_DLLFILE) \
          $(CC_UNINST_DLLFILE) $(LIGHT_CLIENT_UNINST_DLLFILE) $(DOCS_UNINST_DLLFILE) \
          $(AFSRM_EXEFILE) lang

lang ::
	$(CD) lang
	for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /f NTMakefile install
	$(CD) ..

############################################################################
# How to build the shared source file for each uninstall dll

s_afs_setup_utils.obj: afs_setup_utils.cpp
        $(C2OBJ) afs_setup_utils.cpp -DSERVER_UNINST /Fos_afs_setup_utils.obj

c_afs_setup_utils.obj: afs_setup_utils.cpp
        $(C2OBJ) afs_setup_utils.cpp -DCLIENT_UNINST /Foc_afs_setup_utils.obj

cc_afs_setup_utils.obj: afs_setup_utils.cpp
        $(C2OBJ) afs_setup_utils.cpp -DCC_UNINST /Focc_afs_setup_utils.obj

lc_afs_setup_utils.obj: afs_setup_utils.cpp
        $(C2OBJ) afs_setup_utils.cpp -DLIGHT_CLIENT_UNINST /Folc_afs_setup_utils.obj

d_afs_setup_utils.obj: afs_setup_utils.cpp
        $(C2OBJ) afs_setup_utils.cpp -DDOCS_UNINST /Fod_afs_setup_utils.obj


############################################################################

$(INSTALL_UTILS_DLLFILE) : afs_setup_utils.obj $(DLLOBJS) $(DLLLIBS)
    $(DLLGUILINK) -entry:DllEntryPoint /DEF:install_utils.def $(VCLIBS)
    $(DLLPREP)
    $(COPY) $*.lib $(ILIBDIR)
    $(DEL) $*.lib $*.exp

$(SERVER_UNINST_DLLFILE) : s_afs_setup_utils.obj $(DLLOBJS) $(DLLLIBS)
    $(DLLGUILINK) -entry:DllEntryPoint /DEF:server_uninst.def $(VCLIBS)
    $(DLLPREP)
    $(COPY) $*.lib $(ILIBDIR)
    $(DEL) $*.lib $*.exp

$(CLIENT_UNINST_DLLFILE) : c_afs_setup_utils.obj $(DLLOBJS) $(DLLLIBS)
    $(DLLGUILINK) -entry:DllEntryPoint /DEF:client_uninst.def $(VCLIBS)
    $(DLLPREP)
    $(COPY) $*.lib $(ILIBDIR)
    $(DEL) $*.lib $*.exp

$(CC_UNINST_DLLFILE) : cc_afs_setup_utils.obj $(DLLOBJS) $(DLLLIBS)
    $(DLLGUILINK) -entry:DllEntryPoint /DEF:cc_uninst.def $(VCLIBS)
    $(DLLPREP)
    $(COPY) $*.lib $(ILIBDIR)
    $(DEL) $*.lib $*.exp

$(LIGHT_CLIENT_UNINST_DLLFILE) : lc_afs_setup_utils.obj $(DLLOBJS) $(DLLLIBS)
    $(DLLGUILINK) -entry:DllEntryPoint /DEF:light_client_uninst.def $(VCLIBS)
    $(DLLPREP)
    $(COPY) $*.lib $(ILIBDIR)
    $(DEL) $*.lib $*.exp

$(DOCS_UNINST_DLLFILE) : d_afs_setup_utils.obj $(DLLOBJS) $(DLLLIBS)
    $(DLLGUILINK) -entry:DllEntryPoint /DEF:docs_uninst.def $(VCLIBS)
    $(DLLPREP)
    $(COPY) $*.lib $(ILIBDIR)
    $(DEL) $*.lib $*.exp


############################################################################

clean::


############################################################################
#
# Dependencies
#

afs_setup_utils_stub.res : afs_setup_utils_stub.rc AFS_component_version_number.h

