#	$OpenBSD: Makefile,v 1.16 1999/12/08 12:57:06 itojun Exp $
#
# Copyright (c) 2000 Peter 'Luna' Runestig <peter@runestig.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modifi-
# cation, are permitted provided that the following conditions are met:
#
#    o Redistributions of source code must retain the above copyright notice,
#      this list of conditions and the following disclaimer.
#
#    o Redistributions in binary form must reproduce the above copyright no-
#      tice, this list of conditions and the following disclaimer in the do-
#      cumentation and/or other materials provided with the distribution.
#
#    o The names of the contributors may not be used to endorse or promote
#      products derived from this software without specific prior written
#      permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LI-
# ABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUEN-
# TIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEV-
# ER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABI-
# LITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PROG=	ftp
SHELL=	/bin/sh
DESTDIR=

prefix = 
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/libexec
sysconfdir = ${prefix}/etc
localstatedir = ${prefix}/var
sharedstatedir = ${prefix}/com
mandir = ${prefix}/man
man1dir = ${mandir}/man1
man5dir = ${mandir}/man5
man8dir = ${mandir}/man8

INSTALL = /usr/bin/install -c -o root -g wheel
INSTALL_DATA = install  -o root -g wheel -m 444
INSTALL_PROGRAM = install  -s -o root -g wheel -m 555
AR = ar
RANLIB = ranlib
CC = cc
CWARNINGFLAGS = 
DEFS = -DHAVE_CONFIG_H
LIBS = -lssl -lcrypto -ledit -lcurses 
LDFLAGS =  -rpath=/usr/lib:/usr/local/lib
RM = rm

# Uncomment the following to provide defaults for gate-ftp operation
#CPPFLAGS+=-DGATE_SERVER=\"ftp-gw.host\" # -DGATE_PORT=21

#CPPFLAGS+= -Wall -Wconversion -Wstrict-prototypes -Wmissing-prototypes

MAN=	ftp.1
MANSRC=	ftp.1.TLS
MANEDITRC= 
BSDDIR=	bsd

SRCS=	cmds.c cmdtab.c complete.c domacro.c fetch.c ftp.c main.c ruserpass.c \
	stringlist.c util.c tlsutil.c 
OBJS=	$(SRCS:.c=.o)
CFLAGS= -fno-common ${CWARNINGFLAGS}
CPPFLAGS=  ${DEFS} -I. 

BINGRP=		bin
BINOWN=		root
BINMODE=	555
NONBINMODE=	444
DIRMODE=	755
INSTALL_STRIP?=	-s

all:	 ${PROG}

.c.o:
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(CFADD) -o $@ $<

${PROG}: ${OBJS}
	${CC} ${LDFLAGS} ${LDSTATIC} -o ${PROG} ${OBJS} ${LIBS}

clean:	libedit-clean
	$(RM) -f a.out [Ee]rrs mklog core *.core \
	    ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}

distclean: clean libedit-distclean
	$(RM) -f Makefile config.cache config.h config.log config.status

install:
	mkdir -p ${DESTDIR}${bindir}
	mkdir -p ${DESTDIR}${man1dir}
	${INSTALL} -o ${BINOWN} -g ${BINGRP} \
	    -m ${BINMODE} ${PROG} ${DESTDIR}${bindir}
	${INSTALL} -o ${BINOWN} -g ${BINGRP} \
	    -m ${NONBINMODE} ${MANSRC} ${DESTDIR}${man1dir}/${MAN}
	if [ -n "${MANEDITRC}" ]; then \
	    mkdir -p ${DESTDIR}${man5dir} ; \
	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} \
		-m ${NONBINMODE} libedit/${MANEDITRC} ${DESTDIR}${man5dir} ; \
	fi

install-stip:
	mkdir -p ${DESTDIR}${bindir}
	mkdir -p ${DESTDIR}${man1dir}
	${INSTALL} ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} \
	    -m ${BINMODE} ${PROG} ${DESTDIR}${bindir}
	${INSTALL} -o ${BINOWN} -g ${BINGRP} \
	    -m ${NONBINMODE} ${MANSRC} ${DESTDIR}${man1dir}/${MAN}
	if [ -n "${MANEDITRC}" ]; then \
	    mkdir -p ${DESTDIR}${man5dir} ; \
	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} \
		-m ${NONBINMODE} libedit/${MANEDITRC} ${DESTDIR}${man5dir} ; \
	fi

libedit-all:
	cd libedit && $(MAKE) all

libedit-clean:
	cd libedit && $(MAKE) clean

libedit-distclean:
	cd libedit && $(MAKE) distclean


syntax highlighted by Code2HTML, v. 0.9.1