# 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
#
# Portions Copyright (c) 2003 Apple Computer, Inc.

srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread


MODULE_CFLAGS=-DRXDEBUG -DFSSYNC_BUILD_SERVER \
	      -DSALVSYNC_BUILD_CLIENT -DAFS_DEMAND_ATTACH_FS

VICED=$(srcdir)/../viced
VLSERVER=$(srcdir)/../vlserver
DIR=$(srcdir)/../dir
VOL=$(srcdir)/../vol

VICEDOBJS=viced.o afsfileprocs.o host.o physio.o callback.o serialize_state.o \
	  fsstats.o

DIROBJS=buffer.o dir.o salvage.o

VOLOBJS= vnode.o volume.o vutil.o partition.o fssync-server.o \
	 clone.o devname.o common.o ihandle.o listinodes.o namei_ops.o \
	 salvsync-client.o daemon_com.o vg_cache.o vg_scan.o

FSINTOBJS= afsint.ss.o

objects= ${VICEDOBJS} ${DIROBJS} ${VOLOBJS} ${FSINTOBJS}

SDBGOBJS = state_analyzer.o \
	   $(top_builddir)/src/util/liboafs_util.la \
	   $(top_builddir)/src/opr/liboafs_opr.la

LIBS= \
     $(top_builddir)/src/vlserver/liboafs_vldb.la \
     $(top_builddir)/src/libacl/liboafs_acl.la \
     $(top_builddir)/src/rxkad/liboafs_rxkad.la \
     $(top_builddir)/src/rxstat/liboafs_rxstat.la \
     $(top_builddir)/src/lwp/liboafs_lwpcompat.la \
     $(top_builddir)/src/fsint/liboafs_fsint.la \
     $(top_builddir)/src/cmd/liboafs_cmd.la \
     $(top_builddir)/src/opr/liboafs_opr.la \
     $(top_builddir)/src/util/liboafs_util.la

all: dafileserver state_analyzer

viced.o: ${VICED}/viced.c
	$(AFS_CCRULE) $(VICED)/viced.c

afsfileprocs.o: ${VICED}/afsfileprocs.c
	$(AFS_CCRULE) $(VICED)/afsfileprocs.c

host.o: ${VICED}/host.c
	$(AFS_CCRULE) $(VICED)/host.c

physio.o: ${VICED}/physio.c
	$(AFS_CCRULE) $(VICED)/physio.c

callback.o: ${VICED}/callback.c
	$(AFS_CCRULE) $(VICED)/callback.c

fsstats.o: ${VICED}/fsstats.c
	$(AFS_CCRULE) $(VICED)/fsstats.c

serialize_state.o: ${VICED}/serialize_state.c
	$(AFS_CCRULE) $(VICED)/serialize_state.c

buffer.o: ${DIR}/buffer.c
	$(AFS_CCRULE) $(DIR)/buffer.c

dir.o: ${DIR}/dir.c
	$(AFS_CCRULE) $(DIR)/dir.c

salvage.o: ${DIR}/salvage.c
	$(AFS_CCRULE) $(DIR)/salvage.c

vnode.o: ${VOL}/vnode.c
	$(AFS_CCRULE) $(VOL)/vnode.c

volume.o: ${VOL}/volume.c
	$(AFS_CCRULE) $(VOL)/volume.c

vutil.o: ${VOL}/vutil.c
	$(AFS_CCRULE) $(VOL)/vutil.c

partition.o: ${VOL}/partition.c
	$(AFS_CCRULE) $(VOL)/partition.c

vg_cache.o: ${VOL}/vg_cache.c
	$(AFS_CCRULE) $(VOL)/vg_cache.c

vg_scan.o: ${VOL}/vg_scan.c
	$(AFS_CCRULE) $(VOL)/vg_scan.c

fssync-server.o: ${VOL}/fssync-server.c
	$(AFS_CCRULE) $(VOL)/fssync-server.c

fssync-client.o: ${VOL}/fssync-client.c
	$(AFS_CCRULE) $(VOL)/fssync-client.c

salvsync-client.o: ${VOL}/salvsync-client.c
	$(AFS_CCRULE) $(VOL)/salvsync-client.c

daemon_com.o: ${VOL}/daemon_com.c
	$(AFS_CCRULE) $(VOL)/daemon_com.c

clone.o: ${VOL}/clone.c
	$(AFS_CCRULE) $(VOL)/clone.c

nuke.o: ${VOL}/nuke.c
	$(AFS_CCRULE) $(VOL)/nuke.c

devname.o: ${VOL}/devname.c
	$(AFS_CCRULE) $(VOL)/devname.c

common.o: ${VOL}/common.c
	$(AFS_CCRULE) $(VOL)/common.c

listinodes.o: ${VOL}/listinodes.c
	$(AFS_CCRULE) $(VOL)/listinodes.c

ihandle.o: ${VOL}/ihandle.c
	$(AFS_CCRULE) $(VOL)/ihandle.c

namei_ops.o: ${VOL}/namei_ops.c
	$(AFS_CCRULE) $(VOL)/namei_ops.c

afsint.ss.o: ../fsint/afsint.ss.c
	$(AFS_CCRULE) ../fsint/afsint.ss.c

state_analyzer.o: ${VICED}/state_analyzer.c
	$(AFS_CCRULE) $(VICED)/state_analyzer.c

dafileserver: ${objects} ${LIBS}
	$(LT_LDRULE_static) ${objects} \
		${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS}

state_analyzer: ${SDBGOBJS}
	$(LT_LDRULE_static) ${SDBGOBJS} $(LIB_roken) ${MT_LIBS}

install: dafileserver state_analyzer
	${INSTALL} -d ${DESTDIR}${afssrvlibexecdir}
	${INSTALL} -d ${DESTDIR}${afssrvsbindir}
	$(LT_INSTALL_PROGRAM) dafileserver \
		${DESTDIR}${afssrvlibexecdir}/dafileserver
	${LT_INSTALL_PROGRAM} state_analyzer \
		${DESTDIR}${afssrvsbindir}/state_analyzer

dest: dafileserver state_analyzer
	${INSTALL} -d ${DEST}/root.server/usr/afs/bin
	${INSTALL} dafileserver \
		${DEST}/root.server/usr/afs/bin/dafileserver
	${INSTALL_PROGRAM} state_analyzer \
		${DEST}/root.server/usr/afs/bin/state_analyzer

clean:
	$(LT_CLEAN)
	$(RM) -f *.o dafileserver state_analyzer core AFS_component_version_number.c

include ../config/Makefile.version
