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