1# 2## Copyright (C) 2001-2013 Graeme Walker <graeme_walker@users.sourceforge.net> 3## 4## This program is free software: you can redistribute it and/or modify 5## it under the terms of the GNU General Public License as published by 6## the Free Software Foundation, either version 3 of the License, or 7## (at your option) any later version. 8## 9## This program is distributed in the hope that it will be useful, 10## but WITHOUT ANY WARRANTY; without even the implied warranty of 11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12## GNU General Public License for more details. 13## 14## You should have received a copy of the GNU General Public License 15## along with this program. If not, see <http://www.gnu.org/licenses/>. 16# 17# 18# Top-level makefile 19# 20# Additional pseudo-targets for packaging: 21# * rpm - builds an rpm package using rpmbuild 22# * deb - converts the rpm to a deb package using alien. 23# 24# When running "make distcheck" consider doing this to avoid 25# a lengthy testing stage: 26# $ make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-testing 27# 28 29EXTRA_DIST = \ 30 emailrelay.spec \ 31 ChangeLog \ 32 README.windows \ 33 README.embedded \ 34 README.mac \ 35 LICENSE \ 36 VERSION \ 37 bootstrap \ 38 autogen.sh \ 39 emailrelay-gui.xcodeproj/project.pbxproj \ 40 emailrelay.xcodeproj/project.pbxproj 41 42SUBDIRS = bin src lib etc doc debian test extra 43 44e_doc_DATA = COPYING AUTHORS INSTALL NEWS README README.windows README.mac README.embedded ChangeLog 45 46uninstall-local: 47 -for try in 1 2 3 4 ; do echo "$(DESTDIR)$(e_pamdir)" "$(DESTDIR)$(e_initdir)" "$(DESTDIR)$(e_sysconfdir)" "$(DESTDIR)$(e_examplesdir)" "$(DESTDIR)$(e_libexecdir)" "$(DESTDIR)$(e_spooldir)" "$(DESTDIR)$(e_docdir)" "$(DESTDIR)$(pkgdatadir)" | tr ' ' '\n' | grep -i "mailrelay" | while read d ; do rmdir "$$d" 2>/dev/null ; done ; done 48 49RPM_ROOT ?= ${HOME}/rpmbuild 50#RPM_ARCH ?= $(shell arch) 51RPM_ARCH ?= x86_64 52RPM=$(RPM_ROOT)/RPMS/$(RPM_ARCH)/emailrelay-$(VERSION)-1.$(RPM_ARCH).rpm 53DEB=emailrelay_$(VERSION)-1_$(RPM_ARCH).deb 54TAR=emailrelay-$(VERSION).tar.gz 55 56.PHONY: rpm 57rpm: $(RPM) 58 59$(RPM): dist 60 -rm -rf $(RPM_ROOT)/BUILD/emailrelay-$(VERSION) 61 -mkdir -p $(RPM_ROOT)/BUILD $(RPM_ROOT)/SOURCES $(RPM_ROOT)/SPECS 2>/dev/null 62 cp $(TAR) $(RPM_ROOT)/SOURCES/emailrelay-$(VERSION)-src.tar.gz 63 cp $(top_srcdir)/emailrelay.spec $(RPM_ROOT)/SPECS/ 64 chown root:root $(RPM_ROOT)/SPECS/emailrelay.spec 65 rpmbuild -ba $(RPM_ROOT)/SPECS/emailrelay.spec 66 67.PHONY: deb 68deb: $(DEB) 69 70$(DEB): $(RPM) 71 -mv emailrelay-$(VERSION) emailrelay-$(VERSION).old.$$$$ 72 alien --to-deb --generate --single --keep-version $(RPM) 73 sed -i 's/^Section:.*/Section: mail/' emailrelay-$(VERSION)/debian/control 74 sed -i 's/^Maintainer:.*/Maintainer: Graeme Walker <graeme_walker@users.sourceforge.net>/' emailrelay-$(VERSION)/debian/control 75 chmod +x $(top_srcdir)/debian/pre* $(top_srcdir)/debian/post* 76 cp $(top_srcdir)/debian/* emailrelay-$(VERSION)/debian/ 77 sed -i 's:dh_installchangelogs:dh_installchangelogs ; cp etc/init.d/emailrelay debian/emailrelay.init ; dh_installinit:' emailrelay-$(VERSION)/debian/rules 78 sed -i 's:dh_installdeb:dh_installdeb ; echo /etc/emailrelay.conf > debian/emailrelay/DEBIAN/conffiles:' emailrelay-$(VERSION)/debian/rules 79 cd emailrelay-$(VERSION) && debian/rules binary 80 81