]>
Commit | Line | Data |
---|---|---|
a1fd65e3 | 1 | PACKAGE=pmg-api |
dc03b479 | 2 | PKGVER=5.0 |
4c62109f | 3 | PKGREL=18 |
b68dfb61 | 4 | |
c288dcd7 DM |
5 | # this requires package pmg-doc-generator |
6 | export NOVIEW=1 | |
7 | include /usr/share/pmg-doc-generator/pmg-doc-generator.mk | |
8 | ||
9 | ||
b68dfb61 DM |
10 | DEB=${PACKAGE}_${PKGVER}-${PKGREL}_all.deb |
11 | ||
12 | DESTDIR= | |
13 | ||
14 | PERL5DIR=${DESTDIR}/usr/share/perl5 | |
15 | DOCDIR=${DESTDIR}/usr/share/doc/${PACKAGE} | |
8415b622 | 16 | BASHCOMPLDIR=${DESTDIR}/usr/share/bash-completion/completions/ |
b68dfb61 | 17 | |
40f2bc5e DM |
18 | REPOID=`./repoid.pl .git` |
19 | ||
132089d5 | 20 | SERVICES = pmgdaemon pmgproxy pmgtunnel pmgmirror |
0f79c55f | 21 | CLITOOLS = pmgdb pmgconfig pmgperf pmgcm pmgqm pmgreport pmgversion pmgupgrade pmgsubscription pmgbackup |
1635608e | 22 | CLISCRIPTS = pmg-smtp-filter pmgsh pmgpolicy pmgbanner |
cb289191 | 23 | CRONSCRIPTS = pmg-hourly pmg-daily |
8b91b776 | 24 | |
a9a4dda6 DM |
25 | CLI_CLASSES = $(addprefix PMG/CLI/, $(addsuffix .pm, ${CLITOOLS})) |
26 | SERVICE_CLASSES = $(addprefix PMG/Service/, $(addsuffix .pm, ${SERVICES})) | |
27 | SERVICE_UNITS = $(addprefix debian/, $(addsuffix .service, ${SERVICES})) | |
2e2d4830 | 28 | TIMER_UNITS = $(addprefix debian/, $(addsuffix .timer, ${CRONSCRIPTS} pmgspamreport pmgreport)) |
6a672919 | 29 | |
a9a4dda6 | 30 | CLI_BINARIES = $(addprefix bin/, ${CLITOOLS} ${CLISCRIPTS} ${CRONSCRIPTS}) |
8de5c848 | 31 | CLI_MANS = $(addsuffix .1, ${CLITOOLS}) pmgsh.1 |
6a672919 DM |
32 | |
33 | ||
10e64d69 | 34 | SERVICE_MANS = $(addsuffix .8, ${SERVICES}) pmg-smtp-filter.8 pmgpolicy.8 |
d358f740 | 35 | CONF_MANS= pmg.conf.5 cluster.conf.5 |
c288dcd7 | 36 | |
07cb898d | 37 | TEMPLATES = \ |
cde18a76 | 38 | fetchmailrc.tt \ |
3dfe317a | 39 | pmgreport.tt \ |
dc41e7db | 40 | spamreport-verbose.tt \ |
ecf86b91 | 41 | spamreport-short.tt \ |
f609bf7f DM |
42 | main.cf.in \ |
43 | main.cf.in.demo \ | |
44 | master.cf.in \ | |
45 | master.cf.in.demo \ | |
07cb898d DM |
46 | init.pre.in \ |
47 | local.cf.in \ | |
48 | v310.pre.in \ | |
49 | v320.pre.in \ | |
50 | razor-agent.conf.in \ | |
33fa90bf DM |
51 | freshclam.conf.in \ |
52 | clamd.conf.in \ | |
07cb898d DM |
53 | postgresql.conf.in \ |
54 | pg_hba.conf.in | |
55 | ||
a9a4dda6 | 56 | TEMPLATES_FILES = $(addprefix templates/, ${TEMPLATES}) |
07cb898d | 57 | |
9beff9f6 DM |
58 | LIBSOURCES = \ |
59 | PMG/pmgcfg.pm \ | |
9d82c6bc | 60 | PMG/RESTEnvironment.pm \ |
758c7b6b | 61 | PMG/Utils.pm \ |
08d6921a | 62 | PMG/HTMLMail.pm \ |
e7c865af | 63 | PMG/ModGroup.pm \ |
758c7b6b | 64 | PMG/SMTPPrinter.pm \ |
0bf65425 | 65 | PMG/Config.pm \ |
9beff9f6 | 66 | PMG/Cluster.pm \ |
9f67f5b3 | 67 | PMG/ClusterConfig.pm \ |
9beff9f6 DM |
68 | PMG/HTTPServer.pm \ |
69 | PMG/Ticket.pm \ | |
70 | PMG/AccessControl.pm \ | |
6b5e9594 | 71 | PMG/AtomicFile.pm \ |
a43bcf61 | 72 | PMG/MailQueue.pm \ |
657d5dd4 | 73 | PMG/Postfix.pm \ |
14726412 | 74 | PMG/SMTP.pm \ |
91a5af02 | 75 | PMG/Unpack.pm \ |
9a8d51a4 | 76 | PMG/Backup.pm \ |
c881fe35 | 77 | PMG/RuleCache.pm \ |
5414dee4 | 78 | PMG/Statistic.pm \ |
62ebb4bc | 79 | PMG/UserConfig.pm \ |
26be105b | 80 | PMG/Fetchmail.pm \ |
a6e3ac60 | 81 | PMG/LDAPConfig.pm \ |
0bf65425 | 82 | PMG/LDAPSet.pm \ |
cad3d400 | 83 | PMG/LDAPCache.pm \ |
a355f100 | 84 | PMG/DBTools.pm \ |
e84bf942 | 85 | PMG/Quarantine.pm \ |
0a580593 DM |
86 | PMG/RuleDB/Group.pm \ |
87 | PMG/RuleDB/Rule.pm \ | |
88 | PMG/RuleDB/Object.pm \ | |
89 | PMG/RuleDB/Quarantine.pm \ | |
90 | PMG/RuleDB/WhoRegex.pm \ | |
f4fe6fc4 DM |
91 | PMG/RuleDB/IPAddress.pm \ |
92 | PMG/RuleDB/IPNet.pm \ | |
e7c865af | 93 | PMG/RuleDB/ModField.pm \ |
f4fe6fc4 | 94 | PMG/RuleDB/MatchFilename.pm \ |
0a580593 DM |
95 | PMG/RuleDB/ReceiverRegex.pm \ |
96 | PMG/RuleDB/EMail.pm \ | |
97 | PMG/RuleDB/Receiver.pm \ | |
98 | PMG/RuleDB/Domain.pm \ | |
99 | PMG/RuleDB/ReceiverDomain.pm \ | |
10621236 | 100 | PMG/RuleDB/LDAP.pm \ |
c712d3a2 | 101 | PMG/RuleDB/LDAPUser.pm \ |
0a580593 | 102 | PMG/RuleDB/TimeFrame.pm \ |
a7865a2b | 103 | PMG/RuleDB/MatchField.pm \ |
11b7d5dc | 104 | PMG/RuleDB/ContentTypeFilter.pm \ |
c4741113 | 105 | PMG/RuleDB/ArchiveFilter.pm \ |
758c7b6b | 106 | PMG/RuleDB/Spam.pm \ |
a29b9649 | 107 | PMG/RuleDB/Virus.pm \ |
f4fe6fc4 | 108 | PMG/RuleDB/ReportSpam.pm \ |
758c7b6b | 109 | PMG/RuleDB/Remove.pm \ |
f4fe6fc4 DM |
110 | PMG/RuleDB/Attach.pm \ |
111 | PMG/RuleDB/BCC.pm \ | |
112 | PMG/RuleDB/Counter.pm \ | |
758c7b6b DM |
113 | PMG/RuleDB/Notify.pm \ |
114 | PMG/RuleDB/Disclaimer.pm \ | |
115 | PMG/RuleDB/Accept.pm \ | |
116 | PMG/RuleDB/Block.pm \ | |
0a580593 | 117 | PMG/RuleDB.pm \ |
8b91b776 | 118 | ${CLI_CLASSES} \ |
6a672919 | 119 | ${SERVICE_CLASSES} \ |
87952a8d | 120 | PMG/API2/Subscription.pm \ |
cc115a48 | 121 | PMG/API2/APT.pm \ |
8b91b776 | 122 | PMG/API2/Network.pm \ |
163fb58f | 123 | PMG/API2/Services.pm \ |
fa04fcb4 | 124 | PMG/API2/Tasks.pm \ |
be6d6ffc | 125 | PMG/API2/LDAP.pm \ |
5b2bb556 | 126 | PMG/API2/Domains.pm \ |
c3346bf1 | 127 | PMG/API2/Fetchmail.pm \ |
62ebb4bc | 128 | PMG/API2/Users.pm \ |
cc947440 | 129 | PMG/API2/Transport.pm \ |
bef31f06 | 130 | PMG/API2/MyNetworks.pm \ |
e29ebc7c | 131 | PMG/API2/MimeTypes.pm \ |
5c583140 | 132 | PMG/API2/Config.pm \ |
fb5f2d1e | 133 | PMG/API2/Cluster.pm \ |
d17c5265 | 134 | PMG/API2/ClamAV.pm \ |
b00d2d73 | 135 | PMG/API2/SpamAssassin.pm \ |
5de9374c | 136 | PMG/API2/Statistics.pm \ |
202c952a | 137 | PMG/API2/MailTracker.pm \ |
464f7494 | 138 | PMG/API2/Backup.pm \ |
9beff9f6 | 139 | PMG/API2/Nodes.pm \ |
657d5dd4 | 140 | PMG/API2/Postfix.pm \ |
b66faa68 | 141 | PMG/API2/Quarantine.pm \ |
9beff9f6 | 142 | PMG/API2/AccessControl.pm \ |
4bea3204 | 143 | PMG/API2/ObjectGroupHelpers.pm \ |
8d836d1d | 144 | PMG/API2/Rules.pm \ |
b52f6573 | 145 | PMG/API2/RuleDB.pm \ |
16fdeb84 | 146 | PMG/API2/SMTPWhitelist.pm \ |
1ad24a43 | 147 | PMG/API2/Who.pm \ |
2499333b | 148 | PMG/API2/When.pm \ |
5f78c353 | 149 | PMG/API2/What.pm \ |
11a86e67 | 150 | PMG/API2/Action.pm \ |
9beff9f6 DM |
151 | PMG/API2.pm |
152 | ||
cb289191 | 153 | SOURCES = ${LIBSOURCES} ${CLI_BINARIES} ${TEMPLATES_FILES} ${CONF_MANS} ${CLI_MANS} ${SERVICE_MANS} ${SERVICE_UNITS} ${TIMER_UNITS} |
6a672919 DM |
154 | |
155 | all: ${SOURCES} | |
b68dfb61 DM |
156 | |
157 | .PHONY: deb | |
6a672919 | 158 | deb ${DEB}: ${SOURCES} |
b68dfb61 DM |
159 | rm -rf build |
160 | rsync -a * build | |
161 | cd build; dpkg-buildpackage -b -us -uc | |
162 | lintian ${DEB} | |
163 | ||
40f2bc5e DM |
164 | |
165 | PMG/pmgcfg.pm: PMG/pmgcfg.pm.in | |
166 | sed -e s/@VERSION@/${PKGVER}/ -e s/@PACKAGERELEASE@/${PKGREL}/ -e s/@PACKAGE@/${PACKAGE}/ -e s/@REPOID@/${REPOID}/ $< >$@.tmp | |
167 | mv $@.tmp $@ | |
168 | ||
8b91b776 DM |
169 | %.bash-completion: |
170 | perl -I. -T -e "use PMG::CLI::$*; PMG::CLI::$*->generate_bash_completions();" >$@.tmp | |
171 | mv $@.tmp $@ | |
172 | ||
8415b622 | 173 | %.service-bash-completion: |
8b91b776 | 174 | perl -I. -T -e "use PMG::Service::$*; PMG::Service::$*->generate_bash_completions();" >$@.tmp |
8415b622 DM |
175 | mv $@.tmp $@ |
176 | ||
cb289191 | 177 | install: ${SOURCES} $(addsuffix .service-bash-completion, ${SERVICES}) $(addsuffix .bash-completion, ${CLITOOLS}) |
8a1ac886 | 178 | for i in ${SERVICES}; do perl -I. -T -e "use PMG::Service::$$i; PMG::Service::$$i->verify_api();"; done |
8b91b776 | 179 | for i in ${CLITOOLS}; do perl -I. -T -e "use PMG::CLI::$$i; PMG::CLI::$$i->verify_api();"; done |
95c6e315 | 180 | perl -I. bin/pmgsh verifyapi |
9beff9f6 | 181 | install -d -m 0755 ${DESTDIR}/usr/bin |
856d9a38 | 182 | install -d -m 0755 -o www-data -g www-data ${DESTDIR}/var/log/pmgproxy |
cb159468 DM |
183 | install -d -m 0755 ${DOCDIR} |
184 | # TODO: is there a better location ? | |
185 | install -m 0644 favicon.ico ${DOCDIR} | |
9beff9f6 DM |
186 | for i in ${LIBSOURCES}; do install -D -m 0644 $$i ${PERL5DIR}/$$i; done |
187 | for i in ${SERVICES}; do install -D -m 0644 PMG/Service/$$i.pm ${PERL5DIR}/PMG/Service/$$i.pm; done | |
8a1ac886 | 188 | for i in ${SERVICES}; do install -m 0755 bin/$$i ${DESTDIR}/usr/bin; done |
8415b622 | 189 | for i in ${SERVICES}; do install -m 0644 -D $$i.service-bash-completion ${BASHCOMPLDIR}/$$i; done |
8b91b776 DM |
190 | for i in ${CLITOOLS}; do install -D -m 0644 PMG/CLI/$$i.pm ${PERL5DIR}/PMG/CLI/$$i.pm; done |
191 | for i in ${CLITOOLS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/bin/$$i; done | |
192 | for i in ${CLITOOLS}; do install -D -m 0644 $$i.bash-completion ${BASHCOMPLDIR}/$$i; done | |
46e12d58 | 193 | for i in ${CLISCRIPTS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/bin/$$i; done |
07cb898d | 194 | for i in ${TEMPLATES}; do install -D -m 0644 templates/$$i ${DESTDIR}/var/lib/pmg/templates/$$i; done |
3bdb2e11 | 195 | for i in ${CLI_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man1/$$i; done |
c288dcd7 | 196 | for i in ${CONF_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man5/$$i; done |
abc1af3e | 197 | for i in ${SERVICE_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man8/$$i; done |
6a672919 | 198 | for i in ${CRONSCRIPTS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/lib/pmg/bin/$$i; done |
cb289191 DM |
199 | install -d -m 0755 ${DESTDIR}/lib/systemd/system |
200 | for i in ${TIMER_UNITS}; do install -m 0644 $$i ${DESTDIR}/lib/systemd/system/; done | |
b68dfb61 DM |
201 | |
202 | .PHONY: upload | |
203 | upload: ${DEB} | |
d35173e5 DM |
204 | ./repoid.pl .git/ check |
205 | tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist stretch | |
b68dfb61 | 206 | |
291abd89 DM |
207 | .PHONY: check |
208 | check: | |
209 | make -C tests check | |
210 | ||
b68dfb61 DM |
211 | distclean: clean |
212 | ||
213 | clean: | |
c288dcd7 | 214 | make cleanup-docgen |
291abd89 | 215 | make -C tests clean |
c288dcd7 | 216 | rm -rf ${CONF_MANS} ./build *.deb *.changes *.buildinfo *.bash-completion *.service-bash-completion |
9d1d3ef6 | 217 | if test -d .git; then rm -f PMG/pmgcfg.pm; fi |
b68dfb61 DM |
218 | find . -name '*~' -exec rm {} ';' |
219 | ||
220 | .PHONY: dinstall | |
221 | dinstall: ${DEB} | |
222 | dpkg -i ${DEB} |