#
# $Id: Makefile.in,v 1.8 1999/09/27 04:20:34 wiegand 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@

SHELL=		/bin/sh

SBIN_DIR=	@sbindir@
MAN_DIR=	@mandir@
ETC_DIR=	@sysconfdir@

INSTALL=	@INSTALL@

CC=		@CC@
CFLAGS=		@CFLAGS@

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

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

PROC_FTP=	@PROC_FTP@

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

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

TAGS=		@TAGS@

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

tags: $(FTP_SRCS) $(FTP_HDRS)
	ctags -w $(FTP_SRCS) $(FTP_HDRS) ../common/*.[ch]
	@echo ""

progs: ftp-proxy $(PROC_FTP)

ftp-proxy: $(COM_LIB) $(FTP_OBJS)
	rm -f $@
	$(CC) -o $@ $(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)
	mkdir -p $(SBIN_DIR)
	$(INSTALL) -o root -m 755 ftp-proxy $(SBIN_DIR)
	mkdir -p $(ETC_DIR)
	@if test -r $(CONF_DST); then \
		echo "$(CONF_DST) exists; file not touched"; \
	else \
		echo "Installing $(CONF_DST); *please edit*"; \
		$(INSTALL) -m 644 $(CONF_SRC) $(CONF_DST); \
	fi
	mkdir -p $(MAN_DIR)/man5
	@for file in $(FTP_MAN5); do \
		echo "Installing manpage $$file"; \
		$(INSTALL) -m 644 $$file $(MAN_DIR)/man5; \
	done
	mkdir -p $(MAN_DIR)/man8
	@for file in $(FTP_MAN8); do \
		echo "Installing manpage $$file"; \
		$(INSTALL) -m 644 $$file $(MAN_DIR)/man8; \
	done


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

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

distclean: clean
	rm -f Makefile

realclean: distclean


############################################################
# $Log: Makefile.in,v $
# 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
#
############################################################

