# 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.2.4 2005/10/21 04:48:50 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
<x86_darwin_80>
KOPTS=-static -g -nostdinc -nostdlib -no-cpp-precomp -fno-builtin -finline -fno-keep-inline-functions -msoft-float -mlong-branch -fsigned-bitfields -arch i386 -Di386 -DI386 -D__I386__ -DPAGE_SIZE_FIXED -march=i686 -mpreferred-stack-boundary=2 -falign-functions=4
MODLD=$(CC) $(KOPTS)
<ppc_darwin_80>
KOPTS=-static -g -nostdinc -nostdlib -no-cpp-precomp -fno-builtin -finline -fno-keep-inline-functions -msoft-float -mlong-branch -fsigned-bitfields -arch ppc -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED -O2 -mcpu=750 -mmultiple -fschedule-insns
MODLD=$(CC) $(KOPTS)
<all -ppc_darwin_80 -x86_darwin_80>
MODLD=$(LD)
<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=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(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 rpc
	-ln -fs $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/sys h
	-ln -fs /usr/include/rpc rpc


# 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)
	$(MODLD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS} -lcc_kext

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