]> git.proxmox.com Git - pmg-api.git/blob - Makefile
bump version to 5.0-46
[pmg-api.git] / Makefile
1 PACKAGE=pmg-api
2 PKGVER=5.0
3 PKGREL=46
4
5 # this requires package pmg-doc-generator
6 export NOVIEW=1
7 include /usr/share/pmg-doc-generator/pmg-doc-generator.mk
8
9
10 DEB=${PACKAGE}_${PKGVER}-${PKGREL}_all.deb
11
12 DESTDIR=
13
14 PERL5DIR=${DESTDIR}/usr/share/perl5
15 DOCDIR=${DESTDIR}/usr/share/doc/${PACKAGE}
16 BASHCOMPLDIR=${DESTDIR}/usr/share/bash-completion/completions/
17
18 REPOID=`./repoid.pl .git`
19
20 SERVICES = pmgdaemon pmgproxy pmgtunnel pmgmirror
21 CLITOOLS = pmgdb pmgconfig pmgperf pmgcm pmgqm pmgreport pmgversion pmgupgrade pmgsubscription pmgbackup
22 CLISCRIPTS = pmg-smtp-filter pmgsh pmgpolicy pmgbanner
23 CRONSCRIPTS = pmg-hourly pmg-daily
24
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}))
28 TIMER_UNITS = $(addprefix debian/, $(addsuffix .timer, ${CRONSCRIPTS} pmgspamreport pmgreport))
29
30 CLI_BINARIES = $(addprefix bin/, ${CLITOOLS} ${CLISCRIPTS} ${CRONSCRIPTS})
31 CLI_MANS = $(addsuffix .1, ${CLITOOLS}) pmgsh.1
32
33
34 SERVICE_MANS = $(addsuffix .8, ${SERVICES}) pmg-smtp-filter.8 pmgpolicy.8
35 CONF_MANS= pmg.conf.5 cluster.conf.5
36
37 TEMPLATES = \
38 fetchmailrc.tt \
39 pmgreport.tt \
40 spamreport-verbose.tt \
41 spamreport-short.tt \
42 main.cf.in \
43 main.cf.in.demo \
44 master.cf.in \
45 master.cf.in.demo \
46 init.pre.in \
47 local.cf.in \
48 v310.pre.in \
49 v320.pre.in \
50 razor-agent.conf.in \
51 freshclam.conf.in \
52 clamd.conf.in \
53 postgresql.conf.in \
54 pg_hba.conf.in
55
56 TEMPLATES_FILES = $(addprefix templates/, ${TEMPLATES})
57
58 LIBSOURCES = \
59 PMG/pmgcfg.pm \
60 PMG/RESTEnvironment.pm \
61 PMG/Utils.pm \
62 PMG/HTMLMail.pm \
63 PMG/ModGroup.pm \
64 PMG/SMTPPrinter.pm \
65 PMG/Config.pm \
66 PMG/Cluster.pm \
67 PMG/ClusterConfig.pm \
68 PMG/HTTPServer.pm \
69 PMG/Ticket.pm \
70 PMG/AccessControl.pm \
71 PMG/AtomicFile.pm \
72 PMG/MailQueue.pm \
73 PMG/Postfix.pm \
74 PMG/SMTP.pm \
75 PMG/Unpack.pm \
76 PMG/Backup.pm \
77 PMG/RuleCache.pm \
78 PMG/Statistic.pm \
79 PMG/UserConfig.pm \
80 PMG/Fetchmail.pm \
81 PMG/LDAPConfig.pm \
82 PMG/LDAPSet.pm \
83 PMG/LDAPCache.pm \
84 PMG/DBTools.pm \
85 PMG/Quarantine.pm \
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 \
91 PMG/RuleDB/IPAddress.pm \
92 PMG/RuleDB/IPNet.pm \
93 PMG/RuleDB/ModField.pm \
94 PMG/RuleDB/MatchFilename.pm \
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 \
100 PMG/RuleDB/LDAP.pm \
101 PMG/RuleDB/LDAPUser.pm \
102 PMG/RuleDB/TimeFrame.pm \
103 PMG/RuleDB/MatchField.pm \
104 PMG/RuleDB/ContentTypeFilter.pm \
105 PMG/RuleDB/ArchiveFilter.pm \
106 PMG/RuleDB/Spam.pm \
107 PMG/RuleDB/Virus.pm \
108 PMG/RuleDB/ReportSpam.pm \
109 PMG/RuleDB/Remove.pm \
110 PMG/RuleDB/Attach.pm \
111 PMG/RuleDB/BCC.pm \
112 PMG/RuleDB/Counter.pm \
113 PMG/RuleDB/Notify.pm \
114 PMG/RuleDB/Disclaimer.pm \
115 PMG/RuleDB/Accept.pm \
116 PMG/RuleDB/Block.pm \
117 PMG/RuleDB.pm \
118 ${CLI_CLASSES} \
119 ${SERVICE_CLASSES} \
120 PMG/API2/Subscription.pm \
121 PMG/API2/APT.pm \
122 PMG/API2/Network.pm \
123 PMG/API2/Services.pm \
124 PMG/API2/Tasks.pm \
125 PMG/API2/LDAP.pm \
126 PMG/API2/Domains.pm \
127 PMG/API2/Fetchmail.pm \
128 PMG/API2/Users.pm \
129 PMG/API2/Transport.pm \
130 PMG/API2/MyNetworks.pm \
131 PMG/API2/MimeTypes.pm \
132 PMG/API2/Config.pm \
133 PMG/API2/Cluster.pm \
134 PMG/API2/ClamAV.pm \
135 PMG/API2/SpamAssassin.pm \
136 PMG/API2/Statistics.pm \
137 PMG/API2/MailTracker.pm \
138 PMG/API2/Backup.pm \
139 PMG/API2/Nodes.pm \
140 PMG/API2/Postfix.pm \
141 PMG/API2/Quarantine.pm \
142 PMG/API2/AccessControl.pm \
143 PMG/API2/ObjectGroupHelpers.pm \
144 PMG/API2/Rules.pm \
145 PMG/API2/RuleDB.pm \
146 PMG/API2/SMTPWhitelist.pm \
147 PMG/API2/Who.pm \
148 PMG/API2/When.pm \
149 PMG/API2/What.pm \
150 PMG/API2/Action.pm \
151 PMG/API2.pm
152
153 SOURCES = ${LIBSOURCES} ${CLI_BINARIES} ${TEMPLATES_FILES} ${CONF_MANS} ${CLI_MANS} ${SERVICE_MANS} ${SERVICE_UNITS} ${TIMER_UNITS} pmg-sources.list pmg-apt.conf pmg-initramfs.conf
154
155 all: ${SOURCES}
156
157 .PHONY: deb
158 deb ${DEB}: ${SOURCES}
159 rm -rf build
160 rsync -a * build
161 cd build; dpkg-buildpackage -b -us -uc
162 lintian ${DEB}
163
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
169 %.bash-completion:
170 perl -I. -T -e "use PMG::CLI::$*; PMG::CLI::$*->generate_bash_completions();" >$@.tmp
171 mv $@.tmp $@
172
173 %.service-bash-completion:
174 perl -I. -T -e "use PMG::Service::$*; PMG::Service::$*->generate_bash_completions();" >$@.tmp
175 mv $@.tmp $@
176
177 install: ${SOURCES} $(addsuffix .service-bash-completion, ${SERVICES}) $(addsuffix .bash-completion, ${CLITOOLS})
178 for i in ${SERVICES}; do perl -I. -T -e "use PMG::Service::$$i; PMG::Service::$$i->verify_api();"; done
179 for i in ${CLITOOLS}; do perl -I. -T -e "use PMG::CLI::$$i; PMG::CLI::$$i->verify_api();"; done
180 perl -I. bin/pmgsh verifyapi
181 install -d -m 0755 ${DESTDIR}/usr/bin
182 install -d -m 0755 -o www-data -g www-data ${DESTDIR}/var/log/pmgproxy
183 install -d -m 0755 ${DOCDIR}
184 # TODO: is there a better location ?
185 install -m 0644 favicon.ico ${DOCDIR}
186 install -D -m 0644 pmg-apt.conf ${DESTDIR}/etc/apt/apt.conf.d/75pmgconf
187 install -D -m 0644 pmg-sources.list ${DESTDIR}/etc/apt/sources.list.d/pmg-enterprise.list
188 for i in ${LIBSOURCES}; do install -D -m 0644 $$i ${PERL5DIR}/$$i; done
189 for i in ${SERVICES}; do install -D -m 0644 PMG/Service/$$i.pm ${PERL5DIR}/PMG/Service/$$i.pm; done
190 for i in ${SERVICES}; do install -m 0755 bin/$$i ${DESTDIR}/usr/bin; done
191 for i in ${SERVICES}; do install -m 0644 -D $$i.service-bash-completion ${BASHCOMPLDIR}/$$i; done
192 for i in ${CLITOOLS}; do install -D -m 0644 PMG/CLI/$$i.pm ${PERL5DIR}/PMG/CLI/$$i.pm; done
193 for i in ${CLITOOLS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/bin/$$i; done
194 for i in ${CLITOOLS}; do install -D -m 0644 $$i.bash-completion ${BASHCOMPLDIR}/$$i; done
195 for i in ${CLISCRIPTS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/bin/$$i; done
196 for i in ${TEMPLATES}; do install -D -m 0644 templates/$$i ${DESTDIR}/var/lib/pmg/templates/$$i; done
197 for i in ${CLI_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man1/$$i; done
198 for i in ${CONF_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man5/$$i; done
199 for i in ${SERVICE_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man8/$$i; done
200 for i in ${CRONSCRIPTS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/lib/pmg/bin/$$i; done
201 install -d -m 0755 ${DESTDIR}/lib/systemd/system
202 for i in ${TIMER_UNITS}; do install -m 0644 $$i ${DESTDIR}/lib/systemd/system/; done
203 install -D -m 0644 pmg-initramfs.conf ${DESTDIR}/etc/initramfs-tools/conf.d/pmg-initramfs.conf
204
205 .PHONY: upload
206 upload: ${DEB}
207 ./repoid.pl .git/ check
208 tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist stretch
209
210 .PHONY: check
211 check:
212 make -C tests check
213
214 distclean: clean
215
216 clean:
217 make cleanup-docgen
218 make -C tests clean
219 rm -rf ${CONF_MANS} ./build *.deb *.changes *.buildinfo *.bash-completion *.service-bash-completion
220 if test -d .git; then rm -f PMG/pmgcfg.pm; fi
221 find . -name '*~' -exec rm {} ';'
222
223 .PHONY: dinstall
224 dinstall: ${DEB}
225 dpkg -i ${DEB}