## 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.53.2.6 2001/08/24 13:48:15 algernon Exp $

PACKAGE = @PACKAGE@
VERSION = @VERSION@

AUTOMAKE_OPTIONS	= 1.4c gnu

CLEANFILES		= *~ gmon.out pop3lite.spec pop3lite.lsm
MAINTAINERCLEANFILES	= Makefile.in aclocal.m4 \
			config.guess config.h.in config.sub configure \
			install-sh missing mkinstalldirs stamp-h.in \
			ltconfig ltmain.sh
DISTCLEANFILES		= MANIFEST

SUBDIRS			= dist doc gnu includes layouts macros man \
			modules src test-modules testsuite

doc_DATA		= AUTHORS BUGS COPYING COPYING.DOC ChangeLog \
			MACHINES NEWS README TODO THANKS

debian_FILES		= debian/changelog debian/control debian/copyright \
			debian/libpop3lite-misc.dirs debian/libpop3lite-sqlconf.dirs \
			debian/pop3lite-admin debian/pop3lite-dev.dirs \
			debian/pop3lite-start.conf debian/pop3lite.README.Debian \
			debian/pop3lite.conf debian/pop3lite.config \
			debian/pop3lite.dirs debian/pop3lite.info \
			debian/pop3lite.init debian/pop3lite.pam \
			debian/pop3lite.postinst debian/pop3lite.postrm \
			debian/pop3lite.prerm debian/pop3lite.templates \
			debian/pop3lite.templates.sv debian/rules \
			debian/rules.hurd-i386 debian/rules.other \
			debian/watch debian/pop3lite.templates.de \
			debian/pop3lite.conffiles

EXTRA_DIST		= $(doc_DATA) $(debian_FILES) bootstrap.mk \
			pop3lite.spec.in pop3lite.lsm.in MANIFEST.in \
			INSTALL-cross rebuild.mk depcomp

VAR_SUBST		= prefix exec_prefix bindir sbindir datadir sysconfdir \
			libdir mandir docdir PACKAGE VERSION \
			host_triplet pkglibdir P3L_MODULES P3L_BUILTIN_LIST \
			infodir

dist-hook: pop3lite.spec pop3lite.lsm
	chmod -R go-w $(distdir)
	-cp pop3lite.spec $(distdir)/
	-cp pop3lite.lsm $(distdir)/
	rm -f $(distdir)/doc/info-{admin,hacker}.texi \
	      $(distdir)/src/builtin-modules.c

install: install-recursive fix-lib-perms

fix-lib-perms:
	@for i in $(DESTDIR)$(pkglibdir)/*; do \
		if test "x$$i" != "x" && test -e "$$i"; then \
			echo "chmod a-x $$i"; \
			chmod a-x $$i; \
		fi \
	done

bin-dist strip-bin-dist: all MANIFEST
	-rm -rf $(PACKAGE)-$(VERSION).bin.$(host_triplet)
	$(MAKE) install \
		prefix=`pwd`/$(PACKAGE)-$(VERSION).bin.$(host_triplet)/$(prefix)
	@if test "$@" = "strip-bin-dist"; then \
		echo "find $(PACKAGE)-$(VERSION).bin.$(host_triplet) -name '*.so' | xargs \
		      strip --remove-section=.comment --remove-section=.note --strip-unneeded"; \
		find $(PACKAGE)-$(VERSION).bin.$(host_triplet) -name '*.so' | xargs \
		     strip --remove-section=.comment --remove-section=.note \
			   --strip-unneeded 2>/dev/null || true; \
		echo "find $(PACKAGE)-$(VERSION).bin.$(host_triplet) -name '*.a' | xargs \
		      strip --strip-debug"; \
		find $(PACKAGE)-$(VERSION).bin.$(host_triplet) -name '*.a' | xargs \
		     strip --strip-debug 2>/dev/null || true; \
	fi
	$(AMTAR) chof - $(PACKAGE)-$(VERSION).bin.$(host_triplet) \
		 MANIFEST | GZIP=$(GZIP_ENV) gzip -c > $(PACKAGE)-$(VERSION).bin.$(host_triplet).tar.gz
	-rm -rf $(PACKAGE)-$(VERSION).bin.$(host_triplet)

cvs-dist: dist
	rm -rf $(PACKAGE)-$(VERSION)-cvs
	rm -rf $(PACKAGE)-$(VERSION)
	gzip -dc $(PACKAGE)-$(VERSION).tar.gz | $(AMTAR) xhof -
	(cd $(PACKAGE)-$(VERSION); \
	 ./configure --enable-maintainer-mode ; make maintainer-clean; cd ..)
	mv $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION)-cvs
	@if test "x$(GZIP_ENV)" = "x"; then \
		if test "x$(GZIP)" = "x"; then \
			GZIP_ENV="--best"; \
		else \
			GZIP_ENV="$(GZIP)"; \
		fi \
	fi
	$(AMTAR) chof - $(PACKAGE)-$(VERSION)-cvs | GZIP=$(GZIP_ENV) \
		gzip -c > $(PACKAGE)-$(VERSION)-cvs.tar.gz
	rm -rf $(PACKAGE)-$(VERSION)-cvs

full-dist: cvs-dist bin-dist

MANIFEST pop3lite.spec pop3lite.lsm: %: Makefile $(srcdir)/%.in
	sed $(foreach field,$(VAR_SUBST),-e "s%\@$(field)\@%$(strip $($(field)))%g" ) \
	    -e "s%\@DATE\@%$(shell date)%g" \
	    -e "s%\@SHORT_DATE\@%$(shell date +\%Y-\%m-\%d)%g" \
	    <$(srcdir)/$@.in >$@.tmp && mv -f $@.tmp $@

daemon server:
	$(MAKE) -C src pop3lite

modules:
	@list="$(patsubst %,modules/%,$(P3L_MODULES))"; for m in $$list; do \
		test -d "$$m" && $(MAKE) -C $$m || :; \
	done

sense:
	@echo 42

.PHONY: full-dist cvs-dist bin-dist strip-bin-dist modules server dist-hook \
	fix-lib-perms sense daemon


syntax highlighted by Code2HTML, v. 0.9.1