# 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

# MakefileProto for Digital Unix systems
#

DESTDIR=DEST/
include $(DESTDIR)../obj/config/Makefile.${SYS_NAME}


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

AFS_OS_NFSOBJS = \
	osi_vfsops_nfs.o

AFS_OS_NONFSOBJS = \
	osi_vfsops.o


# System specific build commands and flags
KDEFS=-DLANGUAGE_C -G 4 -I/usr/sys/include -I../include \
	 -I/usr/sys/${HEADER_RT} -I/usr/sys/BINARY -I/usr/sys/AFS \
	-DDEC3000_500 -DSWAPTYPE=1 -DUERF -DOSF -DCOMPAT_43 -DMACH -DUFS \
	-DRT -DKERNEL -D_KERNEL  -signed  -no_excpt -Wb,-static -Wco,-nofloat \
	-Olimit 1000 -D__alpha -Umips -UMIPS 
DBUG = -O2 -g3
DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT
OPTF=${OPT} 
OPTF2=${OPT2} 
CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}


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

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

include Makefile.common

setup:
	-mkdir $(KOBJ)
	-rm $(KOBJ)/Makefile $(KOBJ)/Makefile.common
	ln -s ../Makefile $(KOBJ)/Makefile
	ln -s ../Makefile.common $(KOBJ)/Makefile.common
	-rm -f  h net netinet rpc ufs nfs  machine sys vm
	-ln -s /usr/sys/include/net net
	-ln -s /usr/sys/include/machine machine
	-ln -s /usr/sys/include/netinet netinet
	-ln -s /usr/sys/include/nfs nfs
	-ln -s /usr/sys/include/rpc rpc
	-ln -s /usr/sys/include/sys sys
	-ln -s /usr/sys/include/ufs ufs
	-ln -s /usr/sys/include/sys h
	-ln -s /usr/sys/include/vm vm
	-touch $(KOBJ)/sec_net.h


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

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


# libafs:	$(DEST_LIBAFS) $(DEST_LIBAFSNONFS)
libafs:	$(DEST_LIBAFSNONFS)


$(DEST_LIBAFS): $(LIBAFS)
	$(INSTALL) -f $? $@

$(DEST_LIBAFSNONFS): $(LIBAFSNONFS)
	$(INSTALL) -f $? $@

${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)
