# 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
# $Header: /cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.21 2004/08/08 23:12:57 shadow Exp $
# 
# MakefileProto for Digital Unix systems
#
srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config


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


#AFS_OS_NFSOBJS = osi_vfsops_nfs.o

AFS_OS_NONFSOBJS = osi_vfsops.o


# System specific build commands and flags
KDEFS=
DBUG = 
DEFINES= -D_KERNEL -DKERNEL -DKERNEL_PRIVATE -DDIAGNOSTIC -DUSE_SELECT -DMACH_USER_API -DMACH_KERNEL
<ppc_darwin_70>
KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
<ppc_darwin_60>
KOPTS=-no-cpp-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
<ppc_darwin_14 ppc_darwin_13 ppc_darwin_12>
KOPTS=-no-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
<all>
CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${KINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG} ${OPTMZ}
KINCLUDES=-I${KROOT}/System/Library/Frameworks/Kernel.Framework/Headers


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

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

include Makefile.common

setup:
	-mkdir $(KOBJ)
	-$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common $(KOBJ)/config
	ln -fs ../Makefile $(KOBJ)/Makefile
	ln -fs ../Makefile.common $(KOBJ)/Makefile.common
	ln -fs ../config $(KOBJ)/config
	-$(RM) -f  h net netinet rpc ufs nfs  machine sys vm mach kern
	-ln -fs $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/net net
	-ln -fs $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/machine machine
	-ln -fs $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/netinet netinet
	-ln -fs $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/nfs nfs
	-ln -fs /usr/include/rpc rpc
	-ln -fs $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/sys sys
	-ln -fs $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/ufs ufs
	-ln -fs $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/sys h


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

INST_LIBAFS = ${DESTDIR}${afskerneldir}/afs-nfs.kext
INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/afs.kext
DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/afs-nfs.kext
DEST_LIBAFSNONFS = ${DEST}/root.client/usr/vice/etc/afs.kext


libafs: $(LIBAFSNONFS) ;
install_libafs: $(LIBAFSNONFS) ;
	-mkdir -p ${INST_LIBAFSNONFS}
	-mkdir -p ${INST_LIBAFSNONFS}/Contents
	$(INSTALL) -f ../${DARWIN_INFOFILE} ${INST_LIBAFSNONFS}/Contents/Info.plist
	-mkdir -p ${INST_LIBAFSNONFS}/Contents/MacOS
	$(INSTALL) -f ${LIBAFSNONFS} ${INST_LIBAFSNONFS}/Contents/MacOS/afs

dest_libafs: $(LIBAFSNONFS) ;
	-mkdir -p ${DEST_LIBAFSNONFS}
	-mkdir -p ${DEST_LIBAFSNONFS}/Contents
	$(INSTALL) -f ../${DARWIN_INFOFILE} ${DEST_LIBAFSNONFS}/Contents/Info.plist
	-mkdir -p ${DEST_LIBAFSNONFS}/Contents/MacOS
	$(INSTALL) -f ${LIBAFSNONFS} ${DEST_LIBAFSNONFS}/Contents/MacOS/afs


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

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