1# Makefile for amavis-stats 2# 3# Author: Mark Lawrence 4# 5# Copyright (C) 2003,2004 Mark Lawrence (nomad@null.net) 6# 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 2 of the License, or 10# (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License with 18# the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; 19# if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20# Suite 330, Boston, MA 02111-1307 USA 21# 22# On Debian systems, the complete text of the GNU General Public 23# License, version 2, can be found in /usr/share/common-licenses/GPL-2. 24 25SHELL = /bin/sh 26PKG = amavis-stats 27VERS = @vers@ 28DESC = @desc@ 29SOURCE = http://rekudos.net/download/$(PKG)-$(VERS).tar.gz 30 31VPATH = @srcdir@ 32 33subdirs = @subdirs@ 34top_srcdir = @top_srcdir@ 35srcdir = @srcdir@ 36prefix = @prefix@ 37exec_prefix = @exec_prefix@ 38var_prefix = @var_prefix@ 39localstatedir = @localstatedir@ 40install_prefix = @install_prefix@ 41sbindir = $(exec_prefix)/sbin 42sysconfdir = /etc/$(PKG) 43datadir = @datadir@/$(PKG) 44localstatedir = $(var_prefix)/var/lib/$(PKG) 45infodir = $(prefix)/info 46mandir = $(prefix)/man/man1 47imgdir = $(var_prefix)/var/cache/$(PKG) 48debdir = /var/www/debian 49downloaddir = /var/www/download 50amavis_user = @amavis_user@ 51amavis_group = @amavis_group@ 52web_user = @web_user@ 53web_group = @web_group@ 54web_url = @web_url@ 55perl = @perl@ 56 57INSTALL = @INSTALL@ 58 59DISTFILES = CHANGELOG Makefile.in README* amavis-stats amavis-stats.1 \ 60 amavis-stats.lsm amavis-stats.php apache.conf debian redhat \ 61 configure configure.ac install-sh mkinstalldirs 62 63rhspec = $(PKG)-$(VERS)-1.spec 64 65 66all: version 67 68# @for dir in ${subdirs}; do \ 69# (cd $$dir && $(MAKE) all) \ 70# || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ 71# done && test -z "$$fail" 72 73install: all 74 $(top_srcdir)/mkinstalldirs $(install_prefix)$(sbindir) 75 $(top_srcdir)/mkinstalldirs $(install_prefix)$(datadir) 76 $(top_srcdir)/mkinstalldirs $(install_prefix)$(sysconfdir) 77 $(top_srcdir)/mkinstalldirs $(install_prefix)$(mandir) 78 $(top_srcdir)/mkinstalldirs $(install_prefix)$(localstatedir) 79 $(top_srcdir)/mkinstalldirs $(install_prefix)$(imgdir) 80 chown $(amavis_user):$(amavis_group) $(install_prefix)$(localstatedir) 81 chown $(web_user):$(web_group) $(install_prefix)$(imgdir) 82 $(INSTALL) -m 755 $(PKG) $(install_prefix)$(sbindir) 83 $(INSTALL) -m 644 $(PKG).php $(install_prefix)$(datadir) 84 $(INSTALL) -m 644 $(PKG).1 $(install_prefix)$(mandir) 85 $(INSTALL) -m 644 apache.conf $(install_prefix)$(sysconfdir) 86 cd $(install_prefix)$(datadir) && ln -s $(imgdir) img 87 cd $(install_prefix)$(datadir) && ln -s amavis-stats.php index.php 88# @for dir in ${subdirs}; do \ 89# (cd $$dir && $(MAKE) install) \ 90# || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ 91# done && test -z "$$fail" 92 93clean: 94 /bin/rm -f *~ *.tar.gz *.rpm 95# @for dir in ${subdirs}; do \ 96# (cd $$dir && $(MAKE) clean) \ 97# || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ 98# done && test -z "$$fail" 99 100distclean: clean 101 /bin/rm -f Makefile config.status config.cache config.log \ 102 ../$(PKG)_*.changes ../$(PKG)_*.deb 103# @for dir in ${subdirs}; do \ 104# (cd $$dir && $(MAKE) distclean) \ 105# || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ 106# done && test -z "$$fail" 107 108snapshot: $(DISTFILES) 109 @echo 110 @echo "->copying all release files to the directory " $(PKG)-$(VERS) 111 @echo 112 tar cf - $(DISTFILES) | gzip > $(PKG)-$(VERS).tar.gz 113 -mkdir $(PKG)-$(VERS) 114 zcat $(PKG)-$(VERS).tar.gz | (cd $(PKG)-$(VERS); tar xf -) 115 /bin/rm -f $(PKG)-$(VERS).tar.gz 116 @echo 117 @echo "->making the compressed tar file " $(PKG)-$(VERS).tar.gz 118 @echo 119 tar cf - $(PKG)-$(VERS) | gzip > $(PKG)-$(VERS).tar.gz 120 @echo 121 @echo "->placing the snapshot on rekudos download " 122 @echo 123 cp $(PKG)-$(VERS).tar.gz /var/www/download/ 124 @echo 125 @echo "->removing the temporary directory " $(PKG)-$(VERS) 126 @echo 127 /bin/rm -rf $(PKG)-$(VERS) # remove the old directory 128 129#uninstall: 130# -/bin/rm -f $(sbindir)/$(PKG) 131# -/bin/rm -f $(bindir)/xyps 132# -/bin/rm -f $(bindir)/xyug 133# -/bin/rm -f $(libdir)/xypost 134 135installapache: 136 echo "Include /etc/$(PKG)/apache.conf" >> /etc/apache/httpd.conf 137 138deb: 139 dpkg-buildpackage -b -rfakeroot -tc -us -uc 140 141rpm: snapshot 142 cd redhat && $(MAKE) \ 143 VERS="$(VERS)" \ 144 PKG="$(PKG)" \ 145 DESC="$(DESC)" \ 146 SOURCE="$(SOURCE)" spec 147 cp $(dist) /usr/src/rpm/SOURCES 148 rpm -ba redhat/$(PKG)-$(VERS)-1.spec 149 cp /usr/src/rpm/RPMS/i386/amavis-stats-$(VERS)-1.i386.rpm . 150 151archive: snapshot 152 mkdir -p $(debdir)/contrib/binary-i386 153 cp ../$(PKG)_$(VERS)_*.deb $(debdir)/contrib/binary-i386 154 cp ../php4-rrdtool*.deb $(debdir)/contrib/binary-i386 155 cd $(debdir) && dpkg-scanpackages contrib/binary-i386 /dev/null | \ 156 gzip -c > Packages.gz 157# cd $(debdir) && apt-ftparchive packages $(debdir) | gzip > Packages.gz 158 cd $(downloaddir) && rm -f amavis-stats.tar.gz 159 cd $(downloaddir) && ln -s $(PKG)-$(VERS).tar.gz amavis-stats.tar.gz 160 161upload: 162 rsync -avz . mlawren@nomad.rekudos.net:amavis-stats 163 164# automatic re-running of configure if the configure.ac file has changed 165version: 166 sed -e 's/^\(\$$asVersion \+= \+\"\).*\"/\1$(VERS)\"/' \ 167 amavis-stats.php > VERS.php 168 mv VERS.php amavis-stats.php 169 sed -e "1s+.*+\#! $(perl)+" \ 170 amavis-stats > VERS.pl 171 mv VERS.pl amavis-stats 172 sed -e 's/^\(\$$version \+= \+\"\).*\"/\1$(VERS)\"/' \ 173 amavis-stats > VERS.pl 174 mv VERS.pl amavis-stats 175 chmod 755 amavis-stats 176 sed -e 's!^Alias \+/.*!Alias $(web_url) $(datadir)/!' \ 177 apache.conf > DATADIR.conf 178 mv DATADIR.conf apache.conf 179 sed -e 's!^<Directory \+\(.*\)>!<Directory $(datadir)/>!' \ 180 apache.conf > DATADIR.conf 181 mv DATADIR.conf apache.conf 182 183configure-version: 184 tmpf=$(tempfile) 185 sed -e "s/^AC_INIT.*/AC_INIT\($(PKG),$version,nomad@null.net\)/" \ 186 configure.ac > $tmpf 187 mv $tmpf configure.ac 188 189${srcdir}/configure: configure.ac 190 cd ${srcdir} && autoconf 191 192Makefile: Makefile.in config.status 193 ./config.status 194 195config.status: configure 196 ./config.status --recheck 197 198 199# Tell versions [3.59,3.63) of GNU make to not export all variables. 200# Otherwise a system limit (for SysV at least) may be exceeded. 201.NOEXPORT: 202