# 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 = -DAFS_PTHREAD_ENV -DRXDEBUG -DFSSYNC_BUILD_SERVER -DAFS_DEMAND_ATTACH_FS

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

############################################################################
# Build the dafs salvager server

SS_EXEFILE = $(DESTDIR)\root.server\usr\afs\bin\salvageserver.exe

DAS_EXEFILE = $(DESTDIR)\root.server\usr\afs\bin\dasalvager.exe

FSD_EXEFILE = $(DESTDIR)\root.server\usr\afs\bin\fssync-debug.exe

SSD_EXEFILE = $(DESTDIR)\root.server\usr\afs\bin\salvsync-debug.exe

SS_RES = $(OUT)\salvageserver.res

DAS_RES = $(OUT)\dasalvager.res

FSD_RES = $(OUT)\fssync-debug.res

SSD_RES = $(OUT)\salvsync-debug.res

LWP = ..\lwp
LIBACL = ..\libacl
UTIL = ..\util
VLIB = ..\vol

noversion: install

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

UTILOBJS =\
        $(OUT)\assert.obj \
        $(OUT)\uuid.obj \
        $(OUT)\serverLog.obj \
        $(OUT)\fileutil.obj \
        $(OUT)\netutils.obj \
        $(OUT)\dirpath.obj \
        $(OUT)\volparse.obj \
        $(OUT)\flipbase64.obj \
        $(OUT)\softsig.obj \
        $(OUT)\fstab.obj

VLIBOBJS =\
        $(OUT)\volume.obj \
        $(OUT)\vnode.obj \
        $(OUT)\vutil.obj \
        $(OUT)\partition.obj \
        $(OUT)\fssync-client.obj \
        $(OUT)\clone.obj \
        $(OUT)\nuke.obj \
        $(OUT)\listinodes.obj \
        $(OUT)\ihandle.obj \
        $(OUT)\ntops.obj \
        $(OUT)\salvsync-server.obj \
        $(OUT)\salvsync-client.obj \
        $(OUT)\daemon_com.obj \
        $(OUT)\physio.obj

SALVAGEDOBJS =\
        $(OUT)\salvaged.obj \
        $(OUT)\vol-salvage.obj \
        $(OUT)\physio.obj

SALVAGEROBJS =\
        $(OUT)\salvager.obj \
        $(OUT)\svol-salvage.obj \
        $(OUT)\sphysio.obj

OBJECTS= $(SALVAGEDOBJS) $(VLIBOBJS) $(LWPOBJS)
SOBJECTS= $(SALVAGEROBJS)

FSSDEBUG_OBJS =\
        $(OUT)\fssync-debug.obj \
        $(OUT)\physio.obj \
        $(OUT)\common.obj \
        $(UTILOBJS) \
        $(VLIBOBJS) \
        $(DIROBJS) \
        $(LWPOBJS)

SSSDEBUG_OBJS =\
        $(OUT)\salvsync-debug.obj \
        $(OUT)\physio.obj \
        $(OUT)\common.obj \
        $(UTILOBJS) \
        $(VLIBOBJS) \
        $(DIROBJS) \
        $(LWPOBJS)

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

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

$(VLIBOBJS): $(VLIB)\$$(@B).c
	$(C2OBJ) -I$(VLIB) $**

$(SS_RES): salvageserver.rc AFS_component_version_number.h
	$(RC) /fo $(SS_RES) salvageserver.rc

$(DAS_RES): dasalvager.rc AFS_component_version_number.h
	$(RC) /fo $(DAS_RES) dasalvager.rc

$(FSD_RES): fssync-debug.rc AFS_component_version_number.h
	$(RC) /fo $(FSD_RES) fssync-debug.rc

$(SSD_RES): salvsync-debug.rc AFS_component_version_number.h
	$(RC) /fo $(SSD_RES) salvsync-debug.rc

EXELIBS = \
	$(DESTDIR)\lib\afsauthent.lib \
	$(DESTDIR)\lib\afsrpc.lib \
	$(DESTDIR)\lib\afs\afscmd.lib \
	$(DESTDIR)\lib\afs\afsaudit.lib \
	$(DESTDIR)\lib/afs/afscom_err.lib \
	$(DESTDIR)\lib\afs\afsreg.lib \
	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
	$(DESTDIR)\lib\afs\afseventlog.lib \
	$(DESTDIR)\lib\afs\mtafsutil.lib \
        $(DESTDIR)\lib\afs\daafsvol.lib \
        $(DESTDIR)\lib\afs\mtafsvldb.lib \
        $(DESTDIR_\lib\afs\mtafsdir.lib \
	$(DESTDIR)\lib\afspthread.lib

$(SS_EXEFILE): $(OBJECTS) $(SS_RES) $(EXELIBS)
	$(EXECONLINK)
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

$(DAS_EXEFILE): $(SOBJECTS) $(DAS_RES) $(EXELIBS)
	$(EXECONLINK)
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

$(FSD_EXEFILE): $(FSSDEBUG_OBJS) $(FSD_RES) $(EXELIBS)
	$(EXECONLINK)
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

$(SSD_EXEFILE): $(SSSDEBUG_OBJS) $(SSD_RES) $(EXELIBS)
	$(EXECONLINK)
        $(_VC_MANIFEST_EMBED_EXE)
	$(EXEPREP)
        $(CODESIGN_USERLAND)
        $(SYMSTORE_IMPORT)

install: $(SS_EXEFILE) $(DAS_EXEFILE) $(FSD_EXEFILE) $(SSD_EXEFILE)

all: install

mkdir:

clean::
	-$(DEL) $(SS_EXEFILE) $(DAS_EXEFILE) $(FSD_EXEFILE) $(SSD_EXEFILE)
        -$(DEL) $(SS_RES) $(DAS_RES) $(FSD_RES) $(SSD_RES)

