#
# $Id: Makefile.in,v 1.12.2.1 2003/05/07 11:12:29 mt Exp $
#
# Makefile (Template) for SuSE Proxy Suite -- FTP-Proxy
#
# Please do NOT edit this file if its name is just Makefile.
# Instead, edit Makefile.in and run "../configure [options]".
#
# Author(s): Jens-Gero Boehm <jens-gero.boehm@suse.de>
#            Pieter Hollants <pieter.hollants@suse.de>
#            Marius Tomaschewski <mt@suse.de>
#            Volker Wiegand <volker.wiegand@suse.de>
#
# This file is part of the SuSE Proxy Suite
#            See also  http://proxy-suite.suse.de/
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# A history log can be found at the end of this file.
#

prefix=		@prefix@
exec_prefix=	@exec_prefix@
sysconfdir=	@sysconfdir@
sbindir=	@sbindir@
mandir=		@mandir@
datadir=	@datadir@
docdir?=	$(datadir)/doc/proxy-suite

INSTALL=	@INSTALL@
INSTALL_DATA=	@INSTALL_DATA@

SHELL=		/bin/sh

ETC_DIR=	$(sysconfdir)/proxy-suite
CONF_SRC=	ftp-proxy.conf.sample
CONF_DST?=	ftp-proxy.conf

FTP_MAN5=	ftp-proxy.conf.5
FTP_MAN8=	ftp-proxy.8

DOCS=		FAQ NEWS TODO SYSLOG \
		rc.script.txt TransProxy-Mini-Howto.txt

TAGS=		@TAGS@
CTAGS=		@CTAGS@
CTAGS_OPTS=	@CTAGS_OPTS@

CC=		@CC@
CFLAGS=		@CFLAGS@
CPPFLAGS=	@CPPFLAGS@ -DETC_DIR=\"$(ETC_DIR)\"
LDFLAGS=	@LDFLAGS@

LIBS=		@LIB_WRAP@ @LIB_LDAP@ @LIB_CRYPT@ @LIB_REGEX@ @LIBS@

COM_LIB=	../common/libcommon.a
FTP_LIBS=	-L../common -lcommon $(LIBS)

PROC_FTP=	@PROC_FTP@

FTP_SRCS=	ftp-client.c	\
		ftp-cmds.c	\
		ftp-daemon.c	\
		ftp-ldap.c	\
		ftp-main.c

FTP_HDRS=	ftp-client.h	\
		ftp-cmds.h	\
		ftp-daemon.h	\
		ftp-ldap.h

FTP_OBJS=	ftp-client.o	\
		ftp-cmds.o	\
		ftp-daemon.o	\
		ftp-ldap.o	\
		ftp-main.o

COM_HDRS=	../common/com-config.h	\
		../common/com-debug.h	\
		../common/com-misc.h	\
		../common/com-socket.h	\
		../common/com-syslog.h


############################################################

all: $(TAGS) progs

ifneq (,$(CTAGS))
$(TAGS): $(wildcard $(FTP_SRCS) $(FTP_HDRS) ../common/*.[ch])
	$(CTAGS) $(CTAGS_OPTS) $^
	@echo ""
else
$(TAGS):
endif

progs: ftp-proxy $(PROC_FTP)

ftp-proxy: $(COM_LIB) $(FTP_OBJS)
	rm -f $@
	$(CC) -o $@ $(LDFLAGS) $(FTP_OBJS) $(FTP_LIBS)

$(COM_LIB):
	cd ../common && $(MAKE)


############################################################

ftp-client.o: ftp-client.c $(COM_HDRS) $(FTP_HDRS)
ftp-cmds.o:   ftp-cmds.c   $(COM_HDRS) $(FTP_HDRS)
ftp-daemon.o: ftp-daemon.c $(COM_HDRS) $(FTP_HDRS)
ftp-ldap.o:   ftp-ldap.c   $(COM_HDRS) $(FTP_HDRS)
ftp-main.o:   ftp-main.c   $(COM_HDRS) $(FTP_HDRS) ftp-vers.c

ftp-vers.c:   ../changelog
	@cd .. && $(SHELL) changelog

proc_ftp.o:   proc_ftp.c
	$(CC) -g -O2 -c -I. -I.. $<

.c.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) -c -I. -I.. -I../common $<


############################################################

install: progs $(CONF_SRC) $(FTP_MAN5) $(FTP_MAN8)
	$(INSTALL) -d           $(INST_ROOT)$(sbindir)
	$(INSTALL) -s ftp-proxy $(INST_ROOT)$(sbindir)
	$(INSTALL) -d           $(INST_ROOT)$(ETC_DIR)
	@if test -f $(INST_ROOT)$(ETC_DIR)/$(CONF_DST) ; then \
	  echo "$(INST_ROOT)$(ETC_DIR)/$(CONF_DST) exists; file not touched"; \
	else \
	  echo "installing $(CONF_SRC)"; \
	  echo "        to $(INST_ROOT)$(ETC_DIR)/$(CONF_DST); *please edit*"; \
	  $(INSTALL_DATA) $(CONF_SRC) $(INST_ROOT)$(ETC_DIR)/$(CONF_DST); \
	fi
	$(INSTALL) -d           $(INST_ROOT)$(mandir)/man5
	@for file in $(FTP_MAN5) ; do \
		echo "installing manual page $$file"; \
		$(INSTALL_DATA) $$file $(INST_ROOT)$(mandir)/man5; \
	done
	$(INSTALL) -d           $(INST_ROOT)$(mandir)/man8
	@for file in $(FTP_MAN8) ; do \
		echo "installing manual page $$file"; \
		$(INSTALL_DATA) $$file $(INST_ROOT)$(mandir)/man8; \
	done

install.doc:
	$(INSTALL) -d   $(INST_ROOT)$(docdir)
	$(INSTALL_DATA) $(DOCS) $(INST_ROOT)$(docdir)


############################################################

clean:
	rm -f *.o *.a *~ tags core ftp-proxy ftp-vers.c

distclean: clean
	rm -f Makefile rc.script

realclean: distclean


############################################################
# $Log: Makefile.in,v $
# Revision 1.12.2.1  2003/05/07 11:12:29  mt
# added CPPFLAGS variable
#
# Revision 1.12  2002/05/02 13:06:37  mt
# merged with v1.8.2.2, added crypt-lib
#
# Revision 1.11.2.1  2002/01/27 21:20:38  mt
# fixed Makefiles to use INST_ROOT, added install.doc targets
#
# Revision 1.11  2002/01/14 18:57:25  mt
# fixed ctags handling - it needs to be enabled by configure;
# changed ftp-proxy.conf handling ('CONF_DST="" make install')
# to support BSD $ETC_DIR/ftp-proxy.conf.sample installation
#
# Revision 1.10  2001/11/06 23:04:43  mt
# applied / merged with transparent proxy patches v8
# see ftp-proxy/NEWS for more detailed release news
#
# Revision 1.9  1999/10/19 11:19:03  wiegand
# added -static as option for GCC
#
# Revision 1.8  1999/09/27 04:20:34  wiegand
# include . and .. directories in proc_ftp.c -I
#
# Revision 1.7  1999/09/26 13:36:36  wiegand
# removed warnings for proc_ftp compilation
#
# Revision 1.6  1999/09/24 19:32:55  wiegand
# moved the changelog to the top level directory
#
# Revision 1.5  1999/09/24 06:40:48  wiegand
# rearranged to improve consistency with other makefiles
#
# Revision 1.4  1999/09/20 05:20:30  wiegand
# added the installation section
#
# Revision 1.3  1999/09/17 16:32:29  wiegand
# changes from source code review
# added POSIX regular expressions
#
# Revision 1.2  1999/09/16 16:29:57  wiegand
# minor updates improving code quality
#
# Revision 1.1  1999/09/15 14:06:22  wiegand
# initial checkin
#
############################################################

