]> git.proxmox.com Git - proxmox-spamassassin.git/blame_incremental - Makefile
buildsys: expand clean target
[proxmox-spamassassin.git] / Makefile
... / ...
CommitLineData
1include /usr/share/dpkg/default.mk
2
3# howto add rule updates:
4
5# running `make update-sa` updates the core SA rules (in the sa-updates directory)
6# running `make update-kam` updates the KAM ruleset (in the kam-updates directory)
7
8PACKAGE = proxmox-spamassassin
9
10OPKGNAME = Mail-SpamAssassin-$(DEB_VERSION_UPSTREAM)
11
12BUILDDIR = $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
13ORIG_SRC_TAR=$(PACKAGE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz
14DSC = $(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
15
16DEB = $(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_amd64.deb
17DBG_DEB = $(PACKAGE)-dbgsym_$(DEB_VERSION_UPSTREAM_REVISION)_amd64.deb
18DEBS = $(DEB) $(DBG_DEB)
19
20KAM_CHANNEL_FILE = debian/tree/etc/mail/spamassassin/channel.d/KAM_channel.conf
21KAM_KEYID = $(shell awk -F '=' '/^KEYID/ { print $$2 }' $(KAM_CHANNEL_FILE))
22
23
24SA_UPDATE_GPG_DIR = .sa-update-gpghome
25
26deb: $(DEB)
27
28$(DEB) $(DBG_DEB): $(BUILDDIR)
29 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
30 lintian $(DEB)
31
32dsc:
33 $(MAKE) $(DSC)
34 lintian $(DSC)
35
36$(DSC): $(ORIG_SRC_TAR) $(BUILDDIR)
37 cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
38
39.PHONY: sbuild
40sbuild: $(DSC)
41 sbuild $(DSC)
42
43.PHONY: update-upstream
44update-upstream: $(OPKGNAME).tar.gz
45 rm -rf upstream
46 tar -xzf $<
47 mv $(OPKGNAME) upstream
48
49$(ORIG_SRC_TAR): $(BUILDDIR)
50 tar czf $(ORIG_SRC_TAR) --exclude="$(BUILDDIR)/debian" $(BUILDDIR)
51
52$(BUILDDIR): sa-updates kam-updates
53 rm -rf $@ $@.tmp
54 cp -a upstream $@.tmp
55 cp -a debian $@.tmp
56 mkdir -p $@.tmp/rule-updates/spamassassin
57 rsync -av sa-updates/ $@.tmp/rule-updates/spamassassin
58 mkdir -p $@.tmp/debian/rule-updates/spamassassin-extra
59 rsync -av kam-updates/ $@.tmp/rule-updates/spamassassin-extra
60 mv $@.tmp $@
61
62$(OPKGNAME).tar.gz:
63 rm -f $@*
64 curl -L -o '$@#1.tmp' 'https://www-eu.apache.org/dist/spamassassin/source/$@{,.asc}'
65 mv $@.tmp $@
66 mv $@.asc.tmp $@.asc
67 gpgv --keyring ./sa-releasekey.gpg $@.asc $@
68
69$(SA_UPDATE_GPG_DIR)/.prepared: $(OPKGNAME).tar.gz
70 rm -rf $(SA_UPDATE_GPG_DIR)
71 mkdir --mode=0700 -p $(SA_UPDATE_GPG_DIR)
72 tar --strip-components 2 -xzf $(OPKGNAME).tar.gz $(OPKGNAME)/rules/sa-update-pubkey.txt
73 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --import sa-update-pubkey.txt
74 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --import $(KAM_CHANNEL_FILE)
75 rm sa-update-pubkey.txt
76 touch $@
77
78.PHONY: update-sa
79update-sa: $(SA_UPDATE_GPG_DIR)/.prepared
80 rm -rf updates.tmp
81 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --updatedir updates.tmp --channel updates.spamassassin.org
82 rsync -av --delete --exclude=local.cf --exclude=regression_tests.cf --exclude=*.txt --exclude=MIRRORED.BY updates.tmp/updates_spamassassin_org/ sa-updates
83
84.PHONY: update-kam
85update-kam: $(SA_UPDATE_GPG_DIR)/.prepared
86 rm -rf kam-updates.tmp kam-updates
87 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --gpgkey $(KAM_KEYID) --updatedir kam-updates.tmp --channel kam.sa-channels.mcgrail.com
88 rm -rf kam-updates.tmp/kam_sa-channels_mcgrail_com/MIRRORED.BY
89 mv kam-updates.tmp kam-updates
90
91.PHONY: upload
92upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
93upload: $(DEBS)
94 tar cf - $(DEBS) | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist $(UPLOAD_DIST)
95
96.PHONY: clean distclean
97clean:
98 rm -rf *.deb $(PACKAGE)-[0-9]*/ *.tmp $(SA_UPDATE_GPG_DIR)
99 rm -f *.deb *.dsc *.changes *.build *.buildinfo $(OPKGNAME).tar.gz.*
100
101
102distclean: clean
103 rm -rf $(OPKGNAME).*
104
105.PHONY: dinstall
106dinstall: $(DEB)
107 dpkg -i $(DEB)