##XLATE_MANUAL##
# 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

# afsd makefile
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@

SHELL = /bin/sh

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

CFLAGS=-g -I${TOP_SRCDIR}/config -I${TOP_INCDIR} ${XCFLAGS}
LDFLAGS = -g ${XLDFLAGS}

INSTALLex = ${INSTALL} -m 755

#
# What to make
#
all: afsd vsys

#
# Programs
#

AFSLIBS=${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/util.a ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/util.a

afsd: afsd.o $(AFSLIBS)
	case ${SYS_NAME} in \
	sgi_61 | sgi_62 | sgi_63) \
		${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} /usr/lib/libdwarf.a /usr/lib/libelf.a ;; \
	sgi_64 | sgi_65 ) \
		${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} /usr/lib32/libdwarf.a /usr/lib32/libelf.a ;; \
	* ) \
		${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} ;; \
	esac

vsys: vsys.o
	$(CC) -g -o vsys vsys.o ${TOP_LIBDIR}/libsys.a $(LDFLAGS) ${XLIBS}

#
# Objects
#
afsd.o: afsd.c AFS_component_version_number.c

vsys.o: vsys.c AFS_component_version_number.c

clean:
	$(RM) -f *.o vsys afsd core AFS_component_version_number.c

system: install

# XXX-INST: where to put the rc scripts?
install: ${DESTDIR}${sbindir}/afsd ${DESTDIR}${sbindir}/vsys

${DESTDIR}${sbindir}/afsd: afsd
	${INSTALL} $? $@

${DESTDIR}${sbindir}/vsys: vsys
	${INSTALL} $? $@


dest: ${DEST}/root.client/usr/vice/etc/afsd ${DEST}/etc/vsys
	case ${SYS_NAME} in \
		rs_aix*)  \
			${INSTALL} -f rc.afs.rs_aix ${DEST}/root.client/usr/vice/etc/dkload/rc.afs ; \
			${INSTALL} -f rc.dkload.client.rs_aix ${DEST}/root.client/usr/vice/etc/dkload/rc.dkload.client ; \
			${INSTALL} -f rc.dkload.server.rs_aix ${DEST}/root.client/usr/vice/etc/dkload/rc.dkload.server ;; \
		sgi_65 ) \
			${INSTALL} -f afs.rc.sgi_ipnos ${DEST}/root.client/usr/vice/etc/sgiload/afs.rc ;\
			${INSTALL} -f afs.rc.sgi_ipnos ${DEST}/root.server/etc/init.d/afs.rc ;;\
		sgi_* ) \
			${INSTALL} -f afs.rc.sgi ${DEST}/root.client/usr/vice/etc/sgiload/afs.rc ;\
			${INSTALL} -f afs.rc.sgi ${DEST}/root.server/etc/init.d/afs.rc ;\
			case ${SYS_NAME} in \
				sgi_53 | sgi_61 ) \
				${INSTALL} -f afs_rtsymtab.pl.${SYS_NAME} ${DEST}/root.client/usr/vice/etc/sgiload/afs_rtsymtab.pl ;;\
			esac;; \
		sun4_52 | sun4_53 | sun4c_52 | sun4c_53 | sun4m_52 | sun4m_53 | sun4m_54 | sun4_54 | sun4c_54 | sunx86_54) \
			${INSTALL} -f afs.rc.solaris ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
		sun4x_57 ) \
			${INSTALL} -f afs.rc.solaris.2.7 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
		sun4x_58 ) \
			${INSTALL} -f afs.rc.solaris.2.8 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
		sun4x_59 ) \
			${INSTALL} -f afs.rc.solaris.2.9 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
                sun4x_5? ) \
                        ${INSTALL} -f afs.rc.solaris.2_5 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
		alpha_osf* ) \
			${INSTALL} -f afs.rc.alpha ${DEST}/root.client/usr/vice/etc/dkload/afs.rc ;;\
		hp_ux10? | hp_ux11? ) \
			${INSTALL} -f afs.rc.hpux10 ${DEST}/root.client/usr/vice/etc/dkload/afs.rc ;\
			${INSTALL} -f afs.hpux102.driver ${DEST}/root.client/usr/vice/etc/afs.driver ;;\
		alpha_dux* ) \
			${INSTALL} -f afs.rc.alpha_dux40 ${DEST}/root.client/usr/vice/etc/dkload/afs.rc ;;\
                hp?00_ux10? ) \
			${INSTALL} -f afs.rc.hpux10 ${DEST}/root.client/usr/vice/etc/dkload/afs.rc ;;\
		*linux* ) \
			${INSTALLex} -f afs.rc.linux ${DEST}/root.client/usr/vice/etc/afs.rc; \
			${INSTALL} -f afs.conf.linux ${DEST}/root.client/usr/vice/etc/afs.conf ;; \
		ppc_darwin*) \
			${INSTALLex} -f afs.rc.darwin ${DEST}/root.client/usr/vice/etc/afs.rc ; \
			${INSTALL} -f afs.rc.darwin.plist ${DEST}/root.client/usr/vice/etc/StartupParameters.plist ;; \
		*fbsd*) \
			${INSTALL} -f afs.rc.fbsd ${DEST}/root.client/usr/vice/etc/afs.rc.fbsd ;; \
		* )  \
			echo No rc scripts installed for ${SYS_NAME} ;; \
	esac

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

${DEST}/etc/vsys: vsys
	${INSTALL} $? $@

include ../config/Makefile.version
