]> git.proxmox.com Git - pmg-api.git/blob - src/Makefile
tree-wide typo fixes
[pmg-api.git] / src / Makefile
1 -include /usr/share/pmg-doc-generator/pmg-doc-generator.mk
2
3 DESTDIR=
4
5 PERL5DIR=${DESTDIR}/usr/share/perl5
6 DOCDIR=${DESTDIR}/usr/share/doc/pmg-api/
7 BASHCOMPLDIR=${DESTDIR}/usr/share/bash-completion/completions/
8
9 SERVICES = pmgdaemon pmgproxy pmgtunnel pmgmirror
10 CLITOOLS = pmgdb pmgconfig pmgperf pmgcm pmgqm pmgreport pmgversion pmgupgrade pmgsubscription pmgbackup pmg7to8
11 CLISCRIPTS = pmg-smtp-filter pmgsh pmgpolicy pmgbanner pmg-system-report
12 CRONSCRIPTS = pmg-hourly pmg-daily
13
14 CLI_CLASSES = $(addprefix PMG/CLI/, $(addsuffix .pm, ${CLITOOLS}))
15 SERVICE_CLASSES = $(addprefix PMG/Service/, $(addsuffix .pm, ${SERVICES}))
16 SERVICE_UNITS = $(addprefix debian/, $(addsuffix .service, ${SERVICES} pmg-pbsbackup@))
17 TIMER_UNITS = $(addprefix debian/, $(addsuffix .timer, ${CRONSCRIPTS} pmgspamreport pmgreport))
18
19 CLI_BINARIES = $(addprefix bin/, ${CLITOOLS} ${CLISCRIPTS} ${CRONSCRIPTS})
20 CLI_MANS = $(addsuffix .1, ${CLITOOLS}) pmgsh.1 pmg-system-report.1
21
22
23 SERVICE_MANS = $(addsuffix .8, ${SERVICES}) pmg-smtp-filter.8 pmgpolicy.8
24 CONF_MANS= pmg.conf.5 cluster.conf.5
25
26 TEMPLATES = \
27 fetchmailrc.tt \
28 pmgreport.tt \
29 spamreport-verbose.tt \
30 spamreport-short.tt \
31 main.cf.in \
32 main.cf.in.demo \
33 master.cf.in \
34 master.cf.in.demo \
35 init.pre.in \
36 local.cf.in \
37 v310.pre.in \
38 v320.pre.in \
39 v342.pre.in \
40 v400.pre.in \
41 razor-agent.conf.in \
42 freshclam.conf.in \
43 clamd.conf.in \
44 postgresql.conf.in \
45 pg_hba.conf.in \
46 backup-notification.tt \
47
48 TEMPLATES_FILES = $(addprefix templates/, ${TEMPLATES})
49
50 LIBSOURCES = \
51 PMG/pmgcfg.pm \
52 PMG/RESTEnvironment.pm \
53 PMG/Utils.pm \
54 PMG/MIMEUtils.pm \
55 PMG/HTMLMail.pm \
56 PMG/ModGroup.pm \
57 PMG/SMTPPrinter.pm \
58 PMG/CertHelpers.pm \
59 PMG/Config.pm \
60 PMG/Cluster.pm \
61 PMG/ClusterConfig.pm \
62 PMG/HTTPServer.pm \
63 PMG/Ticket.pm \
64 PMG/AccessControl.pm \
65 PMG/AtomicFile.pm \
66 PMG/MailQueue.pm \
67 PMG/Postfix.pm \
68 PMG/SMTP.pm \
69 PMG/Unpack.pm \
70 PMG/Backup.pm \
71 PMG/PBSConfig.pm \
72 PMG/PBSSchedule.pm \
73 PMG/RuleCache.pm \
74 PMG/Statistic.pm \
75 PMG/UserConfig.pm \
76 PMG/Fetchmail.pm \
77 PMG/LDAPConfig.pm \
78 PMG/LDAPSet.pm \
79 PMG/LDAPCache.pm \
80 PMG/DBTools.pm \
81 PMG/DKIMSign.pm \
82 PMG/Quarantine.pm \
83 PMG/Report.pm \
84 PMG/SACustom.pm \
85 PMG/TFAConfig.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/MatchArchiveFilename.pm \
96 PMG/RuleDB/ReceiverRegex.pm \
97 PMG/RuleDB/EMail.pm \
98 PMG/RuleDB/Receiver.pm \
99 PMG/RuleDB/Domain.pm \
100 PMG/RuleDB/ReceiverDomain.pm \
101 PMG/RuleDB/LDAP.pm \
102 PMG/RuleDB/LDAPUser.pm \
103 PMG/RuleDB/TimeFrame.pm \
104 PMG/RuleDB/MatchField.pm \
105 PMG/RuleDB/ContentTypeFilter.pm \
106 PMG/RuleDB/ArchiveFilter.pm \
107 PMG/RuleDB/Spam.pm \
108 PMG/RuleDB/Virus.pm \
109 PMG/RuleDB/ReportSpam.pm \
110 PMG/RuleDB/Remove.pm \
111 PMG/RuleDB/Attach.pm \
112 PMG/RuleDB/BCC.pm \
113 PMG/RuleDB/Counter.pm \
114 PMG/RuleDB/Notify.pm \
115 PMG/RuleDB/Disclaimer.pm \
116 PMG/RuleDB/Accept.pm \
117 PMG/RuleDB/Block.pm \
118 PMG/RuleDB.pm \
119 ${CLI_CLASSES} \
120 ${SERVICE_CLASSES} \
121 PMG/NodeConfig.pm \
122 PMG/API2/Subscription.pm \
123 PMG/API2/APT.pm \
124 PMG/API2/Network.pm \
125 PMG/API2/Services.pm \
126 PMG/API2/Tasks.pm \
127 PMG/API2/LDAP.pm \
128 PMG/API2/DestinationTLSPolicy.pm\
129 PMG/API2/Domains.pm \
130 PMG/API2/DKIMSignDomains.pm \
131 PMG/API2/DKIMSign.pm \
132 PMG/API2/Fetchmail.pm \
133 PMG/API2/InboundTLSDomains.pm \
134 PMG/API2/Users.pm \
135 PMG/API2/Transport.pm \
136 PMG/API2/MyNetworks.pm \
137 PMG/API2/MimeTypes.pm \
138 PMG/API2/Config.pm \
139 PMG/API2/Cluster.pm \
140 PMG/API2/ClamAV.pm \
141 PMG/API2/SpamAssassin.pm \
142 PMG/API2/SACustom.pm \
143 PMG/API2/Statistics.pm \
144 PMG/API2/MailTracker.pm \
145 PMG/API2/Backup.pm \
146 PMG/API2/PBS/Job.pm \
147 PMG/API2/PBS/Remote.pm \
148 PMG/API2/Nodes.pm \
149 PMG/API2/Postfix.pm \
150 PMG/API2/Quarantine.pm \
151 PMG/API2/AccessControl.pm \
152 PMG/API2/TFA.pm \
153 PMG/API2/TFAConfig.pm \
154 PMG/API2/ObjectGroupHelpers.pm \
155 PMG/API2/Rules.pm \
156 PMG/API2/RuleDB.pm \
157 PMG/API2/SMTPWhitelist.pm \
158 PMG/API2/Who.pm \
159 PMG/API2/When.pm \
160 PMG/API2/What.pm \
161 PMG/API2/Action.pm \
162 PMG/API2/Certificates.pm \
163 PMG/API2/ACME.pm \
164 PMG/API2/ACMEPlugin.pm \
165 PMG/API2/NodeConfig.pm \
166 PMG/API2.pm \
167
168 SOURCES = ${LIBSOURCES} ${CLI_BINARIES} ${TEMPLATES_FILES} ${CONF_MANS} ${CLI_MANS} ${SERVICE_MANS} ${SERVICE_UNITS} ${TIMER_UNITS} pmg-sources.list pmg-initramfs.conf
169
170 all: ${SOURCES}
171
172 # TODO: fallbacks for version/release if not build via packaging
173 REPOID ?= $(or $(shell git rev-parse --short=12 HEAD), unknown)
174 PMG/pmgcfg.pm: PMG/pmgcfg.pm.in
175 sed -e s/@VERSION@/${PMGVERSION}/ -e s/@PMGRELEASE@/${PMGRELEASE}/ -e s/@PACKAGE@/${PACKAGE}/ -e s/@REPOID@/${REPOID}/ $< >$@.tmp
176 mv $@.tmp $@
177
178 %.bash-completion:
179 perl -I. -T -e "use PMG::CLI::$*; PMG::CLI::$*->generate_bash_completions();" >$@.tmp
180 mv $@.tmp $@
181
182 %.service-bash-completion:
183 perl -I. -T -e "use PMG::Service::$*; PMG::Service::$*->generate_bash_completions();" >$@.tmp
184 mv $@.tmp $@
185
186 install: ${SOURCES} $(addsuffix .service-bash-completion, ${SERVICES}) $(addsuffix .bash-completion, ${CLITOOLS})
187 for i in ${SERVICES}; do perl -I. -T -e "use PMG::Service::$$i; PMG::Service::$$i->verify_api();"; done
188 for i in ${CLITOOLS}; do perl -I. -T -e "use PMG::CLI::$$i; PMG::CLI::$$i->verify_api();"; done
189 perl -I. bin/pmgsh verifyapi
190 install -d -m 0755 ${DESTDIR}/usr/bin
191 install -d -m 0755 -o www-data -g www-data ${DESTDIR}/var/log/pmgproxy
192 install -d -m 0755 ${DOCDIR}
193 # TODO: is there a better location ?
194 install -m 0644 favicon.ico ${DOCDIR}
195 install -D -m 0644 pmg-sources.list ${DESTDIR}/etc/apt/sources.list.d/pmg-enterprise.list
196 for i in ${LIBSOURCES}; do install -D -m 0644 $$i ${PERL5DIR}/$$i; done
197 for i in ${SERVICES}; do install -D -m 0644 PMG/Service/$$i.pm ${PERL5DIR}/PMG/Service/$$i.pm; done
198 for i in ${SERVICES}; do install -m 0755 bin/$$i ${DESTDIR}/usr/bin; done
199 for i in ${SERVICES}; do install -m 0644 -D $$i.service-bash-completion ${BASHCOMPLDIR}/$$i; done
200 for i in ${CLITOOLS}; do install -D -m 0644 PMG/CLI/$$i.pm ${PERL5DIR}/PMG/CLI/$$i.pm; done
201 for i in ${CLITOOLS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/bin/$$i; done
202 for i in ${CLITOOLS}; do install -D -m 0644 $$i.bash-completion ${BASHCOMPLDIR}/$$i; done
203 for i in ${CLISCRIPTS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/bin/$$i; done
204 for i in ${TEMPLATES}; do install -D -m 0644 templates/$$i ${DESTDIR}/var/lib/pmg/templates/$$i; done
205 for i in ${CLI_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man1/$$i; done
206 for i in ${CONF_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man5/$$i; done
207 for i in ${SERVICE_MANS}; do install -D -m 0644 $$i ${DESTDIR}/usr/share/man/man8/$$i; done
208 for i in ${CRONSCRIPTS}; do install -D -m 0755 bin/$$i ${DESTDIR}/usr/lib/pmg/bin/$$i; done
209 install -d -m 0755 ${DESTDIR}/lib/systemd/system
210 for i in ${TIMER_UNITS}; do install -m 0644 $$i ${DESTDIR}/lib/systemd/system/; done
211 install -D -m 0644 pmg-initramfs.conf ${DESTDIR}/etc/initramfs-tools/conf.d/pmg-initramfs.conf
212
213 .PHONY: check
214 check:
215 make -C tests check
216
217 .PHONY: clean
218 clean:
219 $(MAKE) -C tests clean
220 rm -f *.xml.tmp *.1 *.5 *.8 *{synopsis,opts}.adoc docinfo.xml
221 rm -f PMG/pmgcfg.pm
222 rm -rf ${CONF_MANS} *.bash-completion *.service-bash-completion
223 if test -d .git; then rm -f PMG/pmgcfg.pm; fi
224 find . -name '*~' -exec rm {} ';'
225
226 pmg7to8.1: bin/pmg7to8
227 printf ".TH PMGTO8 1\n.SH NAME\npmg7to8 \- Proxmox Mail Gateway upgrade checker script for 7.3+ to current 8.x\n" > $@.tmp
228 printf ".SH DESCRIPTION\nThis tool will help you to detect common pitfalls and misconfguration\
229 before, and during the upgrade of a Proxmox Mail Gateway system\n" >> $@.tmp
230 printf "Any failure must be addressed before the upgrade, and any warning must be addressed, \
231 or at least carefully evaluated, if a false-positive is suspected\n" >> $@.tmp
232 printf ".SH SYNOPSIS\npmg7to8\n" >> $@.tmp
233 mv $@.tmp $@
234
235 %.1: bin/%
236 rm -f $@
237 podselect $< |pod2man -n $(notdir $*) -s 1 -r ${PKGVER} -c"Proxmox Documentation" >$@.tmp
238 mv $@.tmp $@