# 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

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

HELPER_SPLINT=@HELPER_SPLINT@

MODULE_CFLAGS=-DRXDEBUG -DFSSYNC_BUILD_CLIENT -DAFS_DEMAND_ATTACH_FS

DIR=$(srcdir)/../dir
VOL=$(srcdir)/../vol
VOLSER=$(srcdir)/../volser

VOLSEROBJS=volmain.o volprocs.o physio.o voltrans.o volerr.o volint.cs.o dumpstuff.o  volint.ss.o volint.xdr.o vscommon.o vol_split.o

DIROBJS=buffer.o dir.o salvage.o

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

objects= ${VOLSEROBJS} ${DIROBJS} ${VOLOBJS}

LIBS=	$(top_builddir)/src/cmd/liboafs_cmd.la		\
	$(top_builddir)/src/libacl/liboafs_acl.la \
        $(top_builddir)/src/rx/liboafs_rx.la \
        $(top_builddir)/src/rxstat/liboafs_rxstat.la \
        $(top_builddir)/src/rxkad/liboafs_rxkad.la \
        $(top_builddir)/src/lwp/liboafs_lwpcompat.la \
	$(top_builddir)/src/util/liboafs_util.la	\
	$(top_builddir)/src/opr/liboafs_opr.la		\
	$(top_builddir)/src/usd/liboafs_usd.la

all: davolserver

volmain.o: ${VOLSER}/volmain.c
	$(AFS_CCRULE) -I../volser $(VOLSER)/volmain.c

vol_split.o: ${VOLSER}/vol_split.c
	$(AFS_CCRULE) -I../volser $(VOLSER)/vol_split.c

volprocs.o: ${VOLSER}/volprocs.c
	$(AFS_CCRULE) -I../volser $(VOLSER)/volprocs.c

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

voltrans.o: ${VOLSER}/voltrans.c
	$(AFS_CCRULE) -I../volser $(VOLSER)/voltrans.c

volerr.o: ../volser/volerr.c
	$(AFS_CCRULE) ../volser/volerr.c

volint.cs.o: ../volser/volint.cs.c
	$(AFS_CCRULE) ../volser/volint.cs.c

dumpstuff.o: ${VOLSER}/dumpstuff.c
	$(AFS_CCRULE) -I../volser $(VOLSER)/dumpstuff.c

volint.ss.o: ../volser/volint.ss.c
	$(AFS_CCRULE) ../volser/volint.ss.c

volint.xdr.o: ../volser/volint.xdr.c
	$(AFS_CCRULE) ../volser/volint.xdr.c

vsprocs.o: ${VOLSER}/vsprocs.c
	$(AFS_CCRULE) $(VOLSER)/vsprocs.c

vsutils.o: ${VOLSER}/vsutils.c
	$(AFS_CCRULE) $(VOLSER)/vsutils.c

lockprocs.o: ${VOLSER}/lockprocs.c
	$(AFS_CCRULE) $(VOLSER)/lockprocs.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

nuke.o: ${VOL}/nuke.c
	$(AFS_CCRULE) $(VOL)/nuke.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

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

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

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

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

vscommon.o: ${VOLSER}/common.c
	$(AFS_CCRULE) $(VOLSER)/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

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

install: davolserver
	${INSTALL} -d ${DESTDIR}${afssrvlibexecdir}
	${LT_INSTALL_PROGRAM} davolserver \
		${DESTDIR}${afssrvlibexecdir}/davolserver

dest: davolserver
	${INSTALL} -d ${DEST}/root.server/usr/afs/bin
	${INSTALL} davolserver ${DEST}/root.server/usr/afs/bin/davolserver

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

include ../config/Makefile.version
