## Process this file with automake to produce Makefile.in
## Copyright (C) 2000, 2001 Gergely Nagy <8@free.bsd.hu>
##
## This file is part of POP3Lite.
##
## POP3Lite 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.
##
## POP3Lite 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
##
## $Id: Makefile.am,v 1.40.2.2 2001/08/24 13:07:31 algernon Exp $

MAINTAINERCLEANFILES	= Makefile.in
CLEANFILES		= *~ TAGS gmon.out builtin-modules.c
DISTCLEANFILES		= stamp-builtin depcomp

STATIC_ADD		= @STATIC_ADD@
GLIB_LIBS		= @GLIB_LIBS@
AUTH_LIBS		= @AUTH_LIBS@

LTDL_LIB		= $(top_builddir)/gnu/libltdl/libltdlc.la

if HAVE_MD5_LIB
MD5_LIB			= -lmd
MD5_DEP			=
else
MD5_LIB			= $(top_builddir)/gnu/md5/libmd5.la
MD5_DEP			= $(MD5_LIB)
endif

sbin_PROGRAMS		= pop3lite
noinst_PROGRAMS		= apop-gen

AM_CFLAGS		= $(CONFIG_CFLAGS) $(GLIB_CFLAGS) $(GETOPT_INC) \
			$(EXTRA_CFLAGS)
INCLUDES		= -I$(top_builddir)/includes \
			-I$(top_srcdir)/gnu/libltdl \
			-I$(top_srcdir)/includes \
			-DSYSCONFDIR=\"$(sysconfdir)\" \
			-DMODULEDIR=\"$(pkglibdir)\" \
			-DLOCALSTATEDIR=\"$(localstatedir)\" \
			-I$(top_srcdir)/gnu/md5

nodist_pop3lite_SOURCES	= builtin-modules.c
pop3lite_SOURCES	= cfg.c core.c core_auth.c \
			core_sys.c core_trans.c main.c misc.c module.c \
			standalone.c
pop3lite_LDFLAGS	= -export-dynamic $(GLIB_LIBS) $(AUTH_LIBS) \
			$(EXTRA_LIBS) -dlopen self
pop3lite_LDADD		= $(DLOPEN_LDADD) $(GETOPT_LIB) \
			$(P3L_BUILTIN_LIBS) $(STATIC_ADD) $(LTDL_LIB) $(MD5_LIB)

noinst_HEADERS		= builtin-modules.h cfg.h core.h core_auth.h \
			core_sys.h core_trans.h module.h main.h standalone.h

apop_gen_SOURCES	= apop-gen.c apop-gen-misc.c
apop_gen_LDFLAGS	= $(GLIB_LIBS) $(EXTRA_LIBS)
apop_gen_LDADD		= $(MD5_LIB)

EXTRA_DIST		= builtin-modules.c.in

builtin-modules.c: $(srcdir)/builtin-modules.c.in $(top_builddir)/src/stamp-builtin
	@echo "Creating builtin-modules.c" ; \
	cp $(srcdir)/builtin-modules.c.in $@ ; \
	list='$(P3L_BUILTIN_LIST)'; for i in $$list; do \
		cat $@ | sed \
			-e "s,\(/\*\* NEXT MODULE \*\*\/\),\%	$${i}_LTX_module_init ( control );\1,g" \
			-e "s,\(/\*\* PREV MODULE \*\*\/\),\1\%	$${i}_LTX_module_done ( control );,g" \
			-e "s,\(/\*\* NEXT MODULE PROTO \*\*/\),\%int $${i}_LTX_module_init ( P3LControl *control );\1,g" \
			-e "s,\(/\*\* NEXT MODULE PROTO \*\*/\),\%int $${i}_LTX_module_done ( P3LControl *control );\1,g" \
			>$@T ; \
		rm -f $@ && mv $@T $@ ; \
	done ;\
	tr '%' '\n' <$@ | sed -e "s,/\*\* NEXT MODULE \*\*\/,,g" \
			      -e "s,/\*\* PREV MODULE \*\*\/,,g" \
			      -e "s,/\*\* NEXT MODULE PROTO \*\*/,,g" >$@T && \
	rm -f $@ && mv $@T $@

$(sort $(P3L_BUILTIN_LIBS) $(DLOPEN_MODULES) $(LTDL_LIB) $(GETOPT_LIB) $(MD5_DEP)):
	$(MAKE) -C $(dir $@) $(notdir $@)


syntax highlighted by Code2HTML, v. 0.9.1