#/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */
# $Header: /afs/sipb/project/openafs/debian/cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.1.1.5 2002/06/10 11:46:33 hartmans Exp $
# 
# MakefileProto for Digital Unix systems
#
DEST=@DEST@
TOP_INCDIR=@TOP_INCDIR@
TOP_LIBDIR=@TOP_LIBDIR@
TOP_SRCDIR=@TOP_SRCDIR@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
libexecdir=@libexecdir@
libdir=@libdir@
includedir=@includedir@
mandir=@mandir@
afssrvbindir=@afssrvbindir@
afssrvsbindir=@afssrvsbindir@
afssrvlibexecdir=@afssrvlibexecdir@
afskerneldir=@afskerneldir@
SYS_NAME=@AFS_SYSNAME@
DARWIN_INFOFILE=../@DARWIN_INFOFILE@

include config/Makefile.${SYS_NAME}


# 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
KOPTS=-no-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
#CFLAGS=-Werror-implicit-function-declaration -I. -I.. ${KINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
#CFLAGS=-framework Kernel -I. -I.. ${KINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${KINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG} ${OPTMZ}


# 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 -s ../Makefile $(KOBJ)/Makefile
	ln -s ../Makefile.common $(KOBJ)/Makefile.common
	ln -s ../config $(KOBJ)/config
	-$(RM) -f  h net netinet rpc ufs nfs  machine sys vm mach kern
	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/net net
	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/machine machine
	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/netinet netinet
	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/nfs nfs
	-ln -s /usr/include/rpc rpc
	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/sys sys
	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/ufs ufs
	-ln -s $(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}

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


# Object build rules:
osi_groups.o: $(AFS)/osi_groups.c
	$(CRULE1)
osi_file.o: $(AFS)/osi_file.c
	$(CRULE1)
osi_inode.o: $(AFS)/osi_inode.c
	$(CRULE1)
osi_misc.o: $(AFS)/osi_misc.c
	$(CRULE1)
osi_sleep.o: $(AFS)/osi_sleep.c
	$(CRULE1)
osi_vfsops_nfs.o: $(AFS)/osi_vfsops.c
	$(CRULE1) -o osi_vfsops_nfs.o
osi_vfsops.o: $(AFS)/osi_vfsops.c
	$(CRULE1) -DAFS_NONFSTRANS
osi_vm.o: $(AFS)/osi_vm.c
	$(CRULE1)
osi_vnodeops.o: $(AFS)/osi_vnodeops.c
	$(CRULE1)
osi_module.o: $(AFS)/osi_module.c
	$(CRULE1)
