# 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
#
# OpenBSD version by Jim Rees

srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

# System specific build commands and flags
KSRC = @BSD_KERNEL_PATH@
KFLAGS= -Wall -march=i486 -fno-builtin-printf -fno-builtin-log -fno-builtin-malloc -nostdinc
<i386_obsd33>
KFLAGS+= -fno-stack-protector
<all>
KDEFS= \
    ${KFLAGS} \
    -I/usr/include -I${KSRC}/sys \
    -DLKM -DDIAGNOSTIC -DFIFO -DNFSCLIENT -DMFS -DFFS -D_KERNEL -DI586_CPU \
    -DI686_CPU
DBUG= -O2
DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT
OPTF= ${OPT}
OPTF2= ${OPT2}
CFLAGS= ${FSINCLUDES} ${DEFINES} ${KDEFS} ${KOPTS} ${DBUG}

# Name of directory to hold object files and libraries.
KOBJ = MODLOAD

# OS specific object files:
AFS_OS_OBJS = \
	osi_gcpags.o \
	osi_groups.o \
	osi_file.o \
	osi_misc.o \
	osi_sleep.o \
	osi_vcache.o \
	osi_vm.o \
	osi_vnodeops.o

#AFS_OS_NFSOBJS = osi_vfsops_nfs.o

AFS_OS_NONFSOBJS = osi_vfsops.o

# This tells Makefile.common to use its single directory build target.
COMPDIRS = single_compdir
INSTDIRS = single_instdir
DESTDIRS = single_destdir

TOP_SRCDIR = ../..

include Makefile.common

setup:
	-mkdir $(KOBJ)
	-$(RM) -f  $(KOBJ)/Makefile $(KOBJ)/Makefile.common $(KOBJ)/config
	ln -fs ../Makefile $(KOBJ)/Makefile
	ln -fs ../Makefile.common $(KOBJ)/Makefile.common
	-$(RM) -f  h lib
	-ln -fs ${KSRC}/sys h
	-ln -fs ${KSRC}/lib .
	-touch $(KOBJ)/sec_net.h


# Below this line are targets when in the COMMON directory:
LIBAFS = libafs.nfs.o
LIBAFSNONFS = libafs.o

INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}

DEST_LIBAFS = ${DEST}/root.client/bin/${LIBAFS}
DEST_LIBAFSNONFS = ${DEST}/root.client/bin/${LIBAFSNONFS}


libafs:	$(LIBAFSNONFS)
	ls -l libafs.o

install_libafs:	$(LIBAFSNONFS)
	${INSTALL} -d ${DESTDIR}${afskerneldir}
	${INSTALL} -m 644 $(LIBAFSNONFS) $(INST_LIBAFSNONFS)

dest_libafs: $(LIBAFSNONFS)
	${INSTALL} -d ${DEST}/root.client/bin
	$(INSTALL) -m 644 $(LIBAFSNONFS) $(DEST_LIBAFSNONFS)

${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
	$(LD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS}

${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
	$(LD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS}
