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

srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config

include ../config/Makefile.version

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} 
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_*) \
		${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

