# 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

# $Locker:  $
#
# Makefile for EXPORT kernel extension, and friends
#
DEST=@DEST@
TOP_INCDIR=@TOP_INCDIR@
TOP_LIBDIR=@TOP_LIBDIR@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
libexecdir=@libexecdir@
libdir=@libdir@
includedir=@includedir@
mandir=@mandir@
afssrvbindir=@afssrvbindir@
afssrvsbindir=@afssrvsbindir@
afssrvlibexecdir=@afssrvlibexecdir@
COMPILE_ET=${TOP_SRCDIR}/comerr/compile_et
RXGEN=${TOP_SRCDIR}/rxgen/rxgen
TOP_SRCDIR=@TOP_SRCDIR@
SYS_NAME=@AFS_SYSNAME@


include ../config/Makefile.${SYS_NAME}

KERNELDIR = ../libafs/
UKERNELDIR = ../libuafs/
     DEFS =
     INCS = -I${TOP_SRCDIR}/config -I${TOP_INCDIR}
   CFLAGS = ${OPTMZ} ${DEFS} ${INCS}
  EXPORTS = -bexport:export.exp
  IMPORTS = /lib/kernex.exp /lib/syscalls.exp extras.exp
     KOBJ = export.o symtab.o

include ../config/Makefile.version

all: kinstall ukinstall ${TOP_LIBDIR}/export.exp ${TOP_LIBDIR}/extras.exp cfgexport cfgafs

noversion system: install

install: ${DESTDIR}${libdir}/afs/export.exp ${DESTDIR}${libdir}/afs/extras.exp  

kinstall:
	${INSTALL} export.h ${KERNELDIR}
	${INSTALL} export.exp ${KERNELDIR}

ukinstall webinstall:
	${INSTALL} export.h ${UKERNELDIR}
	${INSTALL} export.exp ${UKERNELDIR}

export.ext: ${KOBJ}
	${LD} -o export.ext -eexport ${IMPORTS} ${KOBJ} ${EXPORTS} -lcsys

export.ext.nonfs: export.nonfs.o symtab.o
	${LD} -o export.ext.nonfs -eexport ${IMPORTS} export.nonfs.o symtab.o ${EXPORTS} -lcsys

export.nonfs.o:
	${CC} ${INCS} -DAFS_NONFSTRANS -c export.c
	-mv export.o export.nonfs.o

cfgexport: cfgexport.o
	${CC} ${INCS} -O -o cfgexport cfgexport.o

cfgafs: cfgafs.o
	${CC} ${INCS} -O -o cfgafs cfgafs.o

cfgexport.o: cfgexport.c AFS_component_version_number.c
cfgafs.o: cfgafs.c AFS_component_version_number.c

clean:
	$(RM) -f *.o *.Zlst *.map *.out cfgexport cfgafs *.ext AFS_component_version_number.c
${DEST}/root.client/usr/vice/etc/dkload/export.ext: export.ext
	${INSTALL} $? $@

${DEST}/root.client/usr/vice/etc/dkload/export.ext.nonfs: export.ext.nonfs
	${INSTALL} $? $@

${DEST}/lib/afs/export.exp: export.exp
	${INSTALL} $? $@

${DESTDIR}${libdir}/afs/export.exp: export.exp
	${INSTALL} $? $@


${TOP_LIBDIR}/export.exp: export.exp
	${INSTALL} $? $@


${DEST}/lib/afs/extras.exp: extras.exp
	${INSTALL} $? $@

${DESTDIR}${libdir}/afs/extras.exp: extras.exp
	${INSTALL} $? $@


${TOP_LIBDIR}/extras.exp: extras.exp
	${INSTALL} $? $@


${DEST}/root.client/usr/vice/etc/dkload/cfgexport: cfgexport
	${INSTALL} $? $@

${DEST}/root.client/usr/vice/etc/dkload/cfgafs: cfgafs
	${INSTALL} $? $@

dest:    ${DEST}/root.client/usr/vice/etc/dkload/export.ext ${DEST}/root.client/usr/vice/etc/dkload/export.ext.nonfs ${DEST}/lib/afs/export.exp ${DEST}/lib/afs/extras.exp ${DEST}/root.client/usr/vice/etc/dkload/cfgexport ${DEST}/root.client/usr/vice/etc/dkload/cfgafs
