#
# Copyright (c) 1988 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# distribution and use acknowledge that the software was developed
# by the University of California, Berkeley.  The name of the
# University may not be used to endorse or promote products derived
# from this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
#	@(#)Makefile	5.8 (Berkeley) 9/22/88

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.version
include ../config/Makefile.${SYS_NAME}

AFSLIBS=${TOP_LIBDIR}/libkauth.a ${TOP_LIBDIR}/libprot.a ${TOP_LIBDIR}/libubik.a \
	  ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \
	  ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a \
          ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a \
          ${TOP_LIBDIR}/libaudit.a

LIBS = ${AFSLIBS} 
CFLAGS=${OPTMZ} -I${TOP_INCDIR} ${XCFLAGS}
LIBC=	/lib/libc.a 
SRCS=	ftpd.c ftpcmd.c getusershell.c glob.c logwtmp.c popen.c vers.c
OBJS=	ftpd.o ftpcmd.o getusershell.o glob.o logwtmp.o popen.o vers.o
MAN=	ftpd.8


noversion: install

all: ${MAN}

ftpd: ${OBJS} ${LIBS}
	case ${SYS_NAME} in \
	sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5? | sunx86_54) \
		${CC} -o $@ ${OBJS} ${LIBS} ${XLIBS} -lsocket -lnsl -lauth -ldl ;; \
	rs_aix*) \
		${CC} -o $@ ${OBJS} ${LIBS} ${XLIBS} -ls  ;; \
	  * ) 	${CC} -o $@ ${OBJS} ${LIBS} ${XLIBS} ;; \
	esac

ftpd.o: ftpd.c AFS_component_version_number.c

vers.o: ftpd.c ftpcmd.y
	${CC} ${CFLAGS} -c vers.c
#	sh newvers.sh

clean:
	$(RM) -f ${OBJS} ftpd core ftpcmd.c AFS_component_version_number.c

cleandir: clean
	$(RM) -f ${MAN} .depend

depend: ${SRCS}
	mkdep ${CFLAGS} ${SRCS}

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

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

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


dest:   ${DEST}/etc/ftpd

