# 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

# indicate that the functions in this library should be exported

AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DEXPORT_AFSAPPLIB -DEXPORTED=_declspec(dllexport)

# include the primary makefile

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

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

INCFILEDIR = $(DESTDIR)\include\WINNT

ILIBDIR = $(DESTDIR)\lib\afs

INCFILES = \
	$(INCFILEDIR)\afsapplib.h \
	$(INCFILEDIR)\al_admsvr.h \
	$(INCFILEDIR)\al_dynlink.h \
	$(INCFILEDIR)\al_messages.h \
	$(INCFILEDIR)\al_progress.h \
	$(INCFILEDIR)\al_resource.h \
	$(INCFILEDIR)\al_wizard.h \
	$(INCFILEDIR)\checklist.h \
	$(INCFILEDIR)\ctl_date.h \
	$(INCFILEDIR)\ctl_elapsed.h \
	$(INCFILEDIR)\ctl_sockaddr.h \
	$(INCFILEDIR)\ctl_spinner.h \
	$(INCFILEDIR)\ctl_time.h \
	$(INCFILEDIR)\dialog.h \
	$(INCFILEDIR)\fastlist.h \
	$(INCFILEDIR)\hashlist.h \
	$(INCFILEDIR)\regexp.h \
	$(INCFILEDIR)\resize.h \
	$(INCFILEDIR)\settings.h \
	$(INCFILEDIR)\subclass.h

DLLOBJS = \
	$(OUT)\afsapplib_stub.res \
	$(OUT)\afsapplib.obj \
	$(OUT)\al_admsvr.obj \
	$(OUT)\al_browse.obj \
	$(OUT)\al_browseset.obj \
	$(OUT)\al_cover.obj \
	$(OUT)\al_creds.obj \
	$(OUT)\al_dynlink.obj \
	$(OUT)\al_error.obj \
	$(OUT)\al_help.obj \
	$(OUT)\al_misc.obj \
	$(OUT)\al_progress.obj \
	$(OUT)\al_pump.obj \
	$(OUT)\al_task.obj \
	$(OUT)\al_wizard.obj \
	$(OUT)\checklist.obj \
	$(OUT)\ctl_date.obj \
	$(OUT)\ctl_elapsed.obj \
	$(OUT)\ctl_sockaddr.obj \
	$(OUT)\ctl_spinner.obj \
	$(OUT)\ctl_time.obj \
	$(OUT)\dialog.obj \
	$(OUT)\fastlist.obj \
	$(OUT)\hashlist.obj \
	$(OUT)\regexp.obj \
	$(OUT)\resize.obj \
	$(OUT)\settings.obj \
	$(OUT)\subclass.obj

VCLIBS =\
	comctl32.lib \
	rpcrt4.lib \
	rpcns4.lib \

DLLLIBS = \
	$(DESTDIR)\lib\afs\TaAfsAdmSvrClient.lib \
	$(DESTDIR)\lib\afs\TaLocale.lib

DLLFILE = $(DESTDIR)\root.server\usr\afs\bin\TaAfsAppLib.dll

!IF ($(AFSVER_CL) < 1400)
DEFFILE = TaAfsAppLib.def
!ELSE
DEFFILE = TaAfsAppLib2005.def
!ENDIF

# Since AfsAppLib links with TaAfsAdmSvrClient.lib--and both need stuff
# like the HashList code--we'll get lots of unnecessary 4049 warnings from
# the linker. Disable that complaint.

LOCALLINKFLAGS = -IGNORE:4049

# AfsAppLib needs to use an explicit .DEF file to get its entry points public

LOCALLINKFLAGS = $(LOCALLINKFLAGS) /DEF:$(DEFFILE)

# Also, AfsAppLib has a specific DLL entry-point which should be used

LOCALLINKFLAGS = $(LOCALLINKFLAGS) -entry:DllEntryPoint

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

install :
	@echo TaAfsAppLib.DLL is built automatically when building AfsAdmSvr
	@echo (the two are related--AfsAppLib uses the AfsAdmSvr client library,
	@echo and the AfsAdmSvr server executable uses the AfsAppLib DLL--
	@echo and they must therefore be built in a specific order).
	@echo.
	@echo You do not need to build in the AfsAppLib directory explicitly.
	@echo.

headers : $(INCFILES)

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

primary : headers $(DLLFILE) lang

$(DLLFILE) : $(DLLOBJS) $(DLLLIBS)
	$(DLLGUILINK) $(LOCALLINKFLAGS) $(VCLIBS)
	$(DLLPREP)
	$(COPY) $*.lib $(ILIBDIR)
	$(DEL) $*.lib $*.exp

clean::
	$(CD) lang
        @if exist AFS_component_version_number.h del AFS_component_version_number.h
	for /f %l in ('dir /B ??_??') do ( if exist @$(NTLANG) do @$(NTLANG) %l $(MAKECMD) /nologo /f NTMakefile clean )
	$(CD) ..


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

$(OUT)\AfsAppLib_stub.res : AFS_component_version_number.h

mkdir:
	-mkdir $(OUT)\lang
	cd lang
	nmake /nologo /f ntmakefile SRC=$(SRC) OBJ=$(OBJ) mkdir
	cd ..

