
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@
TOP_SRCDIR=@TOP_SRCDIR@
SYS_NAME=@AFS_SYSNAME@

SHELL=/bin/sh

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

INCLUDES = -I${TOP_SRCDIR}/config -I${TOP_INCDIR}
DEFINES = ${INCLUDES}
AFSLIBS =  ${TOP_LIBDIR}/libkauth.a ${TOP_LIBDIR}/libubik.a\
		   ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/libsys.a \
		   ${TOP_LIBDIR}/librx.a \
		   ${TOP_LIBDIR}/libsys.a \
		   ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/librxkad.a\
		   ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/libcmd.a \
		   ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a 
LIBRES = 
LIBS = ${AFSLIBS} ${LIBRES} ${XLIBS}
OBJS = inetd.o setenv.o getenv.o
CFLAGS = ${DEFINES} ${DBUG} ${XCFLAGS}

include ../config/Makefile.version

noversion: install

# ta-rauth.o is used by rlogin, rsh, rcp, rlogind
all : inetd ta-rauth.o

inetd: ${OBJS}
	set -x; \
	case "${SYS_NAME}" in \
	alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_dux?? ) \
		${CC} -o $@ ${DEFINES} ${OBJS} ${LIBS} -lutil ;; \
	sgi_6* ) \
		${CC} -o $@ ${CFLAGS} ${OBJS} ${LIBS} ;; \
	*) \
		${CC} -o $@ ${DEFINES} ${OBJS} ${LIBS} ;; \
	esac

inetd.o: inetd.c AFS_component_version_number.c
ta-rauth.o: ta-rauth.c

clean:
	$(RM) -f inetd *.o *.BAK *~ core AFS_component_version_number.c

install: ${DESTDIR}${sbindir}/inetd

dest: ${DEST}/etc/inetd
	set -x; \
	case "${SYS_NAME}" in \
	sun4* ) \
		${INSTALL} -m 644 -f inetd.conf.solaris ${DEST}/etc/inetd.conf ;; \
	sgi_* ) \
		${INSTALL} -m 644 -f inetd.conf.sgi ${DEST}/etc/inetd.conf ;; \
	alpha_dux?? ) \
		${INSTALL} -m 644 -f inetd.conf.dux40 ${DEST}/etc/inetd.conf ;; \
	* ) \
		${INSTALL} -m 644 inetd.conf ${DEST}/etc/inetd.conf ;; \
	esac

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

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