# 
# $Id: Makefile.in,v 1.31 1997/05/02 17:49:27 assar Exp $
#

srcdir		= @srcdir@
top_srcdir	= @top_srcdir@
VPATH		= @srcdir@

topdir		= ../../..

SHELL		= /bin/sh

CC 	= @CC@
YACC	= @YACC@
RANLIB 	= @RANLIB@
DEFS 	= @DEFS@
CFLAGS 	= @CFLAGS@
LD_FLAGS = @LD_FLAGS@
LIBS	= @LIBS@
LIB_DBM = @LIB_DBM@
MKINSTALLDIRS = $(top_srcdir)/mkinstalldirs

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@

prefix 	= @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
libexecdir = @libexecdir@
transform=@program_transform_name@
EXECSUFFIX=@EXECSUFFIX@

ATHENA = ../../..

INCTOP = $(ATHENA)/include

LIBTOP = $(ATHENA)/lib

LIBKAFS = @KRB_KAFS_LIB@
LIBKRB	= -L$(LIBTOP)/krb -lkrb
LIBDES	= -L$(LIBTOP)/des -ldes
LIBOTP  = -L$(LIBTOP)/otp -lotp
LIBROKEN= -L$(LIBTOP)/roken -lroken

PROGS = ftpd$(EXECSUFFIX)

ftpd_SOURCES = ftpd.c ftpcmd.c logwtmp.c popen.c auth.c krb4.c kauth.c
ftpd_OBJS = ftpd.o ftpcmd.o logwtmp.o popen.o auth.o krb4.o kauth.o

SOURCES = $(ftpd_SOURCES)
OBJECTS = $(ftpd_OBJS)

all: $(PROGS)

.c.o:
	$(CC) -c $(CFLAGS) -I$(srcdir) -I$(srcdir)/../common -I$(INCTOP) $(DEFS) $<

install: all
	$(MKINSTALLDIRS) $(libexecdir)
	for x in $(PROGS); do \
	  $(INSTALL_PROGRAM) $$x $(libexecdir)/`echo $$x | sed '$(transform)'`; \
	done

uninstall:
	for x in $(PROGS); do \
	  rm -f $(libexecdir)/`echo $$x | sed '$(transform)'`; \
	done

ftpd$(EXECSUFFIX): $(ftpd_OBJS)
	$(CC) $(LD_FLAGS) $(LDFLAGS) -o $@ $(ftpd_OBJS) -L../common -lcommon $(LIBKAFS) $(LIBKRB) $(LIBOTP) $(LIBDES) $(LIBROKEN) $(LIB_DBM) $(LIBS) $(LIBROKEN)

ftpcmd.c: ftpcmd.y
	$(YACC) $(YFLAGS) $<
	chmod a-w y.tab.c
	mv -f y.tab.c ftpcmd.c

TAGS: $(SOURCES)
	etags $(SOURCES)

clean cleandir:
	rm -f *~ *.o core ftpd ftpcmd.c \#*

distclean: 
	rm -f Makefile
