# Makefile for ftp that doesn't depend on 4.3BSD-Reno conventions...
#
# John W. Eaton
# jwe@che.utexas.edu
# Department of Chemical Engineering
# The University of Texas at Austin

TOP=	/usr/local
BINDIR=	${TOP}/bin
MANDIR=	${TOP}/man/man1

# Optional stuff.
#
# -DSYSV				# System V (works for Unicos :-)
# -DNO_SIG_T				# if your signal.h doesn't define sig_t
# -DSIGNAL_TYPE				# void or int? (defaults to void)
# -DDIRENT				# if you have dirent.h
# -DCRAY				# if you're compiling on a Cray
# -DSTBLOCKS_MISSING			# if your stat.h doens't have st_blocks
# -DWAIT_MISSING			# if you don't have sys/wait.h
# -DGNU_READLINE			# if you're using readline
# RLINCDIR=/usr/local/gnu/include	# GNU readline include files
# RLLIBDIR=/usr/local/gnu/lib		# GNU readline library dir
# RLLIBS=-lreadline -ltermcap

RLINCDIR=/usr/local/gnu/include
RLLIBDIR=/usr/local/gnu/lib

# Cray needs extra stuff.
#RLLIBS=-lreadline -lcurses ${RLLIBDIR}/alloca.o -lbsd -lnet
RLLIBS=-lreadline -ltermcap

# Define these if you are using readline.
HISTC=history.c
HISTO=history.o

# Define these if you are using the getpass() routine supplied here.
GETPC=getpass.c
GETPO=getpass.o

# Define these if your system library lacks herror()
HERRORC=herror.c
HERRORO=herror.o

# Define theseV if your system library lacks writev().  This is only
# needed if you are also missing herror().
WRITEVC=writev.c
WRITEVO=writev.o

# Define these if your system library lacks strerror()
STRERRORC=strerror.c
STRERRORO=strerror.o

# Define FILEBLKS if your stat structure lacks blksize.  Also add
# -DSTBLOCKS_MISSING to CFLAGS.  Cray needs these.
#FILEBLKSC=fileblocks.c
#FILEBLKSO=fileblocks.o

CFLAGS=	-I. -O -DNO_SIG_T -DGNU_READLINE -I${RLINCDIR} -L${RLLIBDIR}

SRCS=	cmds.c cmdtab.c ftp.c glob.c main.c ruserpass.c domacro.c \
	${HISTC} ${GETPC} ${HERRORC} ${STRERRORC} ${WRITEVC} ${FILEBLKSC}

OBJS=	cmds.o cmdtab.o ftp.o glob.o main.o ruserpass.o domacro.o \
	${HISTO} ${GETPO} ${HERRORO} ${STRERRORO} ${WRITEVO} ${FILEBLKSO}
MAN=	ftp.1

all: ftp

ftp: ${OBJS}
	${CC} -o $@ ${CFLAGS} \
	${OBJS} ${RLLIBS}

clean:
	rm -f ${OBJS} core ftp

cleandir: clean
	rm -f ${MAN} tags .depend

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

install: ${MAN}
	install -s -m 755 ftp ${BINDIR}/ftp
#	install -c -m 644 ftp.1 ${MANDIR}/ftp.1

lint: ${SRCS}
	lint ${CFLAGS} ${SRCS}

tags: ${SRCS}
	ctags ${SRCS}
