1#-----------------------------------------------------------------------------
2#
3#  POPular -- A POP3 server and proxy for large mail systems
4#
5#  $Id: Makefile.am,v 1.15 2001/08/10 14:01:22 sqrt Exp $
6#
7#  http://www.remote.org/jochen/mail/popular/
8#
9#-----------------------------------------------------------------------------
10#
11#  Copyright 1999-2001 by Jochen Topf <jochen@remote.org>
12#
13#  This program is free software; you can redistribute it and/or modify
14#  it under the terms of the GNU General Public License as published by
15#  the Free Software Foundation; either version 2 of the License, or
16#  (at your option) any later version.
17#
18#  This program is distributed in the hope that it will be useful,
19#  but WITHOUT ANY WARRANTY; without even the implied warranty of
20#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21#  GNU General Public License for more details.
22#
23#  You should have received a copy of the GNU General Public License
24#  along with this program; if not, write to the Free Software
25#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
26#
27#-----------------------------------------------------------------------------
28
29EXTRA_DIST = auth conf debian scripts
30
31SUBDIRS = lib src pdm @MAKE_TEST@ doc redhat
32
33DIST_SUBDIRS = lib src pdm test doc redhat
34
35RELEASE ?= 1
36
37#
38# use 'make rpm'
39# or  'make rpm RELEASE=n'
40# to build RedHat package
41#
42.PHONY: rpm
43rpm: dist
44	rm -rf redhat/rpm
45	for i in BUILD INSTALL RPMS; do                             \
46	  mkdir -p redhat/rpm/$$i;                                  \
47	done
48	echo "macrofiles: /usr/lib/rpm/macros:`pwd`/redhat/rpm/rpmmacros" >redhat/rpm/rpmrc
49	echo "%_topdir `pwd`/redhat/rpm"    >redhat/rpm/rpmmacros
50	if test -f .cvsignore; then                                 \
51	  echo "%_sourcedir `pwd`"         >>redhat/rpm/rpmmacros;  \
52	else                                                        \
53	  echo "%_sourcedir `pwd`/.."      >>redhat/rpm/rpmmacros;  \
54	fi
55	echo "%_srcrpmdir `pwd`"           >>redhat/rpm/rpmmacros
56	sed -e "s/__VERSION__/$(VERSION)/" <redhat/popular.spec | \
57	  sed -e "s/__RELEASE__/$(RELEASE)/" >redhat/popular-$(VERSION).spec
58	rpm --rcfile=/usr/lib/rpm/rpmrc:redhat/rpm/rpmrc -ba --buildroot=`pwd`/redhat/rpm/INSTALL redhat/popular-$(VERSION).spec
59	mv redhat/rpm/RPMS/*/popular-*.rpm .
60	rm -rf redhat/rpm
61
62#
63# use 'make deb'
64# or  'make deb RELEASE=n'
65# to build Debian package
66#
67.PHONY: deb
68deb:
69	( echo "popular ($(VERSION)-$(RELEASE)) unstable; urgency=low"; \
70	echo; echo '  * see package changelog for details'; echo; \
71	echo -n ' -- Jochen Topf <jochen@remote.org>  '; \
72	date -R; echo; ) >debian/changelog
73	EXTRA_CONF_OPTIONS="--with-cdb=/home/sqrt/src/cdb/cdb-0.75" dpkg-buildpackage -rfakeroot
74
75
76.PHONY: test
77test:
78	cd test && $(MAKE) test
79
80dist-hook:
81	find $(distdir) -name CVS -print | xargs rm -fr
82	find $(distdir) -name .cvsignore -print | xargs rm -f
83	rm -fr $(distdir)/redhat/rpm
84
85
86#-- THE END ------------------------------------------------------------------
87