check for non-ASCII local-parts without SMTPUTF8
[ghsmtp.git] / Makefile
blobee0d65894b3008a438c6afa4d7e5231ec7856278
1 USES := ldns libglog libidn2 opendkim openssl
3 CXXFLAGS += -IPEGTL/include -Ijson/include -Icppcodec
5 LDLIBS += \
6 -lboost_filesystem \
7 -lboost_iostreams \
8 -lboost_system \
9 -lcdb \
10 -lfmt \
11 -lgflags \
12 -lmagic \
13 -lopenarc \
14 -lopendmarc \
15 -lpsl \
16 -lspf2 \
17 -lsrs2 \
18 -lunistring
20 PROGRAMS := arcsign arcverify dns_tool smtp msg sasl snd socks5
22 arcsign_STEMS := arcsign \
23 message Domain IP IP4 IP6 Mailbox OpenARC OpenDKIM OpenDMARC Pill SRS SRS0 osutil esc
25 arcverify_STEMS := arcverify \
26 message Domain IP IP4 IP6 Mailbox OpenARC OpenDKIM OpenDMARC Pill SRS SRS0 osutil esc
28 DNS := DNS DNS-rrs DNS-fcrdns DNS-message
30 dns_tool_STEMS := dns_tool \
31 $(DNS) \
32 Domain \
33 IP \
34 IP4 \
35 IP6 \
36 POSIX \
37 SPF \
38 Sock \
39 SockBuffer \
40 TLS-OpenSSL \
41 esc \
42 osutil
44 msg_STEMS := msg \
45 CDB \
46 $(DNS) \
47 Domain \
48 IP \
49 IP4 \
50 IP6 \
51 Mailbox \
52 OpenDKIM \
53 OpenDMARC \
54 POSIX \
55 SPF \
56 Sock \
57 SockBuffer \
58 TLS-OpenSSL \
59 esc \
60 osutil
62 sasl_STEMS := sasl \
63 Base64 \
64 Domain \
65 IP \
66 IP4 \
67 IP6 \
68 POSIX \
69 Sock \
70 SockBuffer \
71 TLS-OpenSSL \
72 esc \
73 osutil
75 smtp_STEMS := smtp \
76 CDB \
77 $(DNS) \
78 Domain \
79 IP \
80 IP4 \
81 IP6 \
82 Mailbox \
83 MessageStore \
84 OpenARC \
85 OpenDKIM \
86 OpenDMARC \
87 POSIX \
88 Pill \
89 SPF \
90 SRS \
91 SRS0 \
92 Send \
93 Session \
94 Sock \
95 SockBuffer \
96 TLS-OpenSSL \
97 esc \
98 message \
99 osutil
101 snd_STEMS := snd \
102 Base64 \
103 $(DNS) \
104 Domain \
105 IP \
106 IP4 \
107 IP6 \
108 Magic \
109 Mailbox \
110 MessageStore \
111 OpenDKIM \
112 OpenDMARC \
113 POSIX \
114 Pill \
115 SPF \
116 Sock \
117 SockBuffer \
118 TLS-OpenSSL \
119 esc \
120 osutil
122 socks5_STEMS := socks5 \
123 $(DNS) \
124 Domain \
125 IP \
126 IP4 \
127 IP6 \
128 POSIX \
129 Pill \
130 Sock \
131 SockBuffer \
132 TLS-OpenSSL \
133 esc \
134 osutil
136 TESTS := \
137 Base64-test \
138 CDB-test \
139 DNS-test \
140 Domain-test \
141 IP4-test \
142 IP6-test \
143 Magic-test \
144 Mailbox-test \
145 MessageStore-test \
146 Now-test \
147 OpenDKIM-test \
148 POSIX-test \
149 Pill-test \
150 SPF-test \
151 SRS-test \
152 SRS0-test \
153 Send-test \
154 Session-test \
155 Sock-test \
156 SockBuffer-test \
157 TLD-test \
158 TLS-OpenSSL-test \
159 default_init_allocator-test \
160 esc-test \
161 iobuffer-test \
162 is_ascii-test \
163 message-test \
164 osutil-test
166 Base64-test_STEMS := Base64
167 CDB-test_STEMS := CDB osutil
169 DNS-test_STEMS := $(DNS) DNS-ldns Domain IP IP4 IP6 POSIX Sock SockBuffer TLS-OpenSSL esc osutil
171 Domain-test_STEMS := $(DNS) Domain IP IP4 IP6 POSIX Sock SockBuffer TLS-OpenSSL esc osutil
172 IP4-test_STEMS := $(DNS) Domain IP IP4 IP6 POSIX Sock SockBuffer TLS-OpenSSL esc osutil
173 IP6-test_STEMS := $(DNS) Domain IP IP4 IP6 POSIX Sock SockBuffer TLS-OpenSSL esc osutil
174 Magic-test_STEMS := Magic
175 Mailbox-test_STEMS := Mailbox Domain IP IP4 IP6 osutil
176 MessageStore-test_STEMS := $(DNS) Domain IP IP4 IP6 MessageStore Pill POSIX Sock SockBuffer TLS-OpenSSL esc osutil
177 OpenDKIM-test_STEMS := OpenDKIM
178 POSIX-test_STEMS := POSIX
179 Pill-test_STEMS := Pill
180 SPF-test_STEMS := $(DNS) Domain IP IP4 IP6 SPF POSIX Sock SockBuffer TLS-OpenSSL esc osutil
181 SRS-test_STEMS := SRS Domain Mailbox IP IP4 IP6
182 SRS0-test_STEMS := SRS0 SRS osutil Domain IP IP4 IP6 Mailbox
183 Send-test_STEMS := $(DNS) Domain IP IP4 IP6 Mailbox OpenARC OpenDKIM OpenDMARC POSIX Pill SPF Send Sock SockBuffer TLS-OpenSSL esc message osutil
185 osutil-test_STEMS := osutil
186 message-test_STEMS := message Domain IP IP4 IP6 Mailbox OpenARC OpenDKIM OpenDMARC Pill SRS SRS0 osutil esc
188 Session-test_STEMS := \
189 CDB \
190 $(DNS) \
191 Domain \
192 IP \
193 IP4 \
194 IP6 \
195 Mailbox \
196 MessageStore \
197 OpenARC \
198 OpenDKIM \
199 OpenDMARC \
200 POSIX \
201 Pill \
202 SPF \
203 SRS \
204 SRS0 \
205 Send \
206 Session \
207 Sock \
208 SockBuffer \
209 TLS-OpenSSL \
210 esc \
211 message \
212 osutil
214 Sock-test_STEMS := Domain IP IP4 IP6 POSIX Sock SockBuffer TLS-OpenSSL esc osutil
215 SockBuffer-test_STEMS := Domain IP IP4 IP6 POSIX Sock SockBuffer TLS-OpenSSL esc osutil
216 TLS-OpenSSL-test_STEMS := Domain IP IP4 IP6 POSIX TLS-OpenSSL osutil
217 esc-test_STEMS := esc
219 databases := \
220 accept_domains.cdb \
221 allow.cdb \
222 bad_recipients.cdb \
223 bad_senders.cdb \
224 block.cdb \
225 forward.cdb \
226 ip-block.cdb \
227 temp_fail.cdb
229 all:: $(databases) public_suffix_list.dat
231 TMPDIR ?= /tmp
233 export TEST_MAILDIR=$(TMPDIR)/Maildir
234 export MAILDIR=$(TEST_MAILDIR)
236 export ASAN_OPTIONS=detect_leaks=0
238 export GHSMTP_SERVER_ID=digilicious.com
240 export LLVM_PROFILE_FILE=smtp.profraw
242 $(TEST_MAILDIR):
243 mkdir -p $@
245 #smtp.cpp: smtp.rl
246 # ragel -o smtp.cpp smtp.rl
248 clean-test::
249 rm -f smtp.profraw
250 rm -f smtp.profdata
251 rm -rf $(TEST_MAILDIR)/*
253 %.cdb : % cdb-gen
254 ./cdb-gen < $< | cdb -c $@
256 clean::
257 rm -f accept_domains.cdb
258 rm -f block.cdb
259 rm -f cdb-gen
260 rm -f forward.cdb
261 rm -f ip-block.cdb
262 rm -f allow.cdb
264 accept_domains.cdb: accept_domains cdb-gen
265 allow.cdb: allow cdb-gen
266 block.cdb: block cdb-gen
267 ip-block.cdb: ip-block cdb-gen
268 three-level-tlds.cdb: three-level-tlds cdb-gen
270 forward.cdb: forward
271 cat $< | cdb -c $@
273 public_suffix_list.dat:
274 wget --timestamping https://publicsuffix.org/list/public_suffix_list.dat
276 opt_flags := -Og
278 # safty_flags := # nada
280 # visibility_flags := # nada
282 lto_flags := # nada
284 include MKUltra/rules
286 regression:: $(programs) $(TEST_MAILDIR)
287 @for f in testcase_dir/* ; do \
288 echo -n test `basename $$f` ""; \
289 tmp_out=`mktemp`; \
290 valgrind ./smtp < $$f > $$tmp_out; \
291 diff testout_dir/`basename $$f` $$tmp_out && echo ...pass; \
292 rm $$tmp_out; \
293 done
295 check::
296 @for f in testcase_dir/* ; do \
297 echo -n test `basename $$f` ""; \
298 tmp_out=`mktemp`; \
299 ./smtp < $$f > $$tmp_out; \
300 diff testout_dir/`basename $$f` $$tmp_out && echo ...pass; \
301 if [ -e smtp.profraw ] ; then mv smtp.profraw /tmp/smtp-profile/`basename $$f`; fi; \
302 rm $$tmp_out; \
303 done
305 net-check::
306 @for f in testcase_dir/* ; do \
307 echo -n test `basename $$f` ""; \
308 tmp_out=`mktemp`; \
309 ncat localhost 225 < $$f > $$tmp_out; \
310 diff testout_dir/`basename $$f` $$tmp_out && echo ...pass; \
311 if [ -e smtp.profraw ] ; then mv smtp.profraw /tmp/smtp-profile/`basename $$f`; fi; \
312 rm $$tmp_out; \
313 done
315 check:: msg snd
316 ./msg --selftest
317 GHSMTP_CLIENT_ID=digilicious.com ./snd --selftest
319 show::
320 llvm-profdata merge -sparse /tmp/smtp-profile/* -o smtp.profdata
321 llvm-cov show ./smtp -instr-profile=smtp.profdata
323 init::
324 touch accept_domains bad_recipients bad_senders block ip-block temp_fail
325 sudo dnf install boost-devel file-devel fmt-devel glog-devel ldns-devel libidn2-devel libopenarc-devel libopendkim-devel libopendmarc-devel libpsl-devel libspf2-devel tinycdb-devel libunistring-devel