# $Id: Makefile.in,v 1.24 2004/03/27 18:01:15 doug Exp $
#
# This file is part of EXACT.
#
# EXACT 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.
# 
# EXACT 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 EXACT; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

SHELL = /bin/sh
top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

.SUFFIXES:
.SUFFIXES: .c .o

OPT = -g -O
AR = ar
AR_FLAGS = rc
RANLIB = @RANLIB@

DESTDIR =

CC= @CC@
CFLAGS = -Wall -I. -DCONFDIR=\"@sysconfdir@\" @CFLAGS@
LDFLAGS = @LDFLAGS@
INSTALL = @INSTALL@
prefix = @prefix@
exec_prefix = @exec_prefix@
localstatedir = @localstatedir@
bindir = @bindir@
mandir = @mandir@
sbindir = @sbindir@
sysconfdir = @sysconfdir@
username = @ac_cv_user@
groupname = @ac_cv_group@
watchfile = @ac_cv_watch@
server = @ac_cv_server@
db = @ac_cv_db@

ifeq ($(db),yes)
	LIBS=@LIBS@ -ldb
	authtype=db
else
	LIBS = @LIBS@
	authtype=text
endif

SOURCES = tail.c daemon.c exact.c logger.c match.c auth.c conffile.c getopt.c getopt1.c apconf.c
MISC = configure mkinstalldirs install-sh aclocal.m4
OBJS = tail.o daemon.o exact.o logger.o match.o auth.o conffile.o getopt.o getopt1.o apconf.o

all: exact exact.conf exact.8 exact.conf.5 README.html

install: all
	$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/$(localstatedir)/run/exact \
		$(DESTDIR)/$(localstatedir)/state/exact $(DESTDIR)/$(mandir)/man8 $(DESTDIR)/$(mandir)/man5
	chown $(username) $(DESTDIR)/$(localstatedir)/run/exact $(DESTDIR)/$(localstatedir)/state/exact
	chgrp $(groupname) $(DESTDIR)/$(localstatedir)/run/exact $(DESTDIR)/$(localstatedir)/state/exact
	$(INSTALL) -m755 exact $(DESTDIR)/$(sbindir)/exact
	$(INSTALL) -m644 exact.conf $(DESTDIR)/$(sysconfdir)/exact.conf
	$(INSTALL) -m644 exact-servers.conf $(DEST)/$(sysconfdir)/exact-servers.conf
	$(INSTALL) -m644 exact.8 $(DESTDIR)/$(mandir)/man8
	$(INSTALL) -m644 exact.conf.5 $(DESTDIR)/$(mandir)/man5

uninstall:
	/bin/rm -f $(DESTDIR)/$(bindir)/exact

exact: $(OBJS) Makefile
	$(CC) $(CFLAGS) -o exact $(OBJS) $(LIBS)

clean:
	/bin/rm -f core *.o $(OBJS) $(LIB_OBJS) exact exact.conf exact.8 exact.conf.5

distclean: clean
	/bin/rm -f Makefile config.h config.status config.cache config.log
	/bin/rm -f autoscan.log configure.scan
	/bin/rm -rf autom4te.cache config.h.in~

mostlyclean: clean

maintainer-clean: clean

# you may be wondering why some of these constants are in here
# it is because a similar process is used to generate the
# regression test configuration file, which for reasons of
# brevity has much smaller values
edit = sed \
        -e 's,@datadir\@,$(pkgdatadir),g' \
        -e 's,@prefix\@,$(prefix),g' \
		-e 's,@localstatedir\@,$(localstatedir),g' \
		-e 's,@sysconfdir\@,$(sysconfdir),g' \
		-e 's,@ac_cv_user\@,$(username),g' \
		-e 's,@ac_cv_group\@,$(groupname),g' \
		-e 's,@ac_cv_watch\@,$(watchfile),g' \
		-e 's,@ac_cv_server\@,${server},g' \
		-e 's,@ac_cv_authtype\@,${authtype},g' \
		-e 's,@logging\@,syslog,g' \
		-e 's,@timeout\@,1800,g' \
		-e 's,@flush\@,300,g' \
		-e 's,@suspicious\@,120,g'

exact.conf: exact.conf.in Makefile
	rm -f exact.conf exact.conf.tmp
	$(edit) exact.conf.in > exact.conf.tmp
	 mv exact.conf.tmp exact.conf

exact.conf.5: exact.conf.5.in
	rm -f exact.conf.5 exact.conf.5.tmp
	$(edit) exact.conf.5.in > exact.conf.5.tmp
	mv exact.conf.5.tmp exact.conf.5

exact.8: exact.8.in
	rm -f exact.8 exact.8.tmp
	$(edit) exact.8.in > exact.8.tmp
	mv exact.8.tmp exact.8

README.html: README
	python2.2 html.py README > README.html

test: all
	  ./regress


syntax highlighted by Code2HTML, v. 0.9.1