]> pd.if.org Git - zpackage/blob - Makefile
5b677ca0356baa9eb73860836f9a30ccc6f70867
[zpackage] / Makefile
1 CC=clang --target=x86_64-pc-linux-musl
2 CC=/usr/musl/bin/musl-clang
3 #CC=/usr/musl/bin/musl-gcc
4 #CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api --target=x86_64-pc-linux-musl
5 CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api
6
7 ZPMVER:=$(shell git describe --tags --match 'v[0-9]*' | sed -e 's/^v//' | sed -e 's/-g.\+//' | sed -e 's/-/./g')
8
9 LZMAFLAGS=-Ilzma/api -Ilzma/tuklib -Ilzma/lzma -Ilzma/common -Ilzma/check -Ilzma/lz -Ilzma/rangecoder -Ilzma/simple -Ilzma/delta -DHAVE_CHECK_CRC64 -DHAVE_CHECK_CRC32 -DHAVE_ENCODER_LZMA2 -DHAVE_DECODER_LZMA2 -DHAVE_MF_BT4
10
11 LDFLAGS=-fuse-ld=lld -L. -static
12
13 LZMACHECKSRC=lzma/check/check.c lzma/check/crc32_fast.c lzma/check/crc64_fast.c lzma/check/crc32_table.c lzma/check/crc64_table.c
14 LZMASRC=$(shell ls lzma/lzma/*.c lzma/common/*.c lzma/lz/*.c) $(LZMACHECKSRC) lzma/rangecoder/price_table.c
15 LZMAOBJ=$(filter-out lzma/common/stream_encoder_mt.o, $(LZMASRC:%.c=%.o))
16
17 JSWSRC=lib/jsw/jsw_avltree.c \
18 lib/jsw/jsw_atree.c \
19 lib/jsw/jsw_hlib.c \
20 lib/jsw/jsw_rbtree.c
21
22 JSWOBJ=$(JSWSRC:%.c=%.o)
23 LIBZPMSRC=sha256.c db.c compress.c uncompress.c zpm.c zpm_hash.c \
24           foreach_path.c vercmp.c findpkg.c quote.c dbquery.c script_hash.c \
25           parse.c integ.c seterror.c notes.c
26
27 LIBZPMOBJ=$(addprefix lib/, $(LIBZPMSRC:%.c=%.o))
28
29 curdir=$(shell pwd)
30
31 ZPKGBIN=zpm-addfile zpm-extract zpm-init zpm-vercmp zpm-stat zpm-hash \
32         zpm-findpkg zpm-shell zpm-soneed zpm-foreach-path zpm-parse \
33         zpm-script zpm-soname zpm-syncfs zpm-packagehash zpm-verify \
34         zpm-elftype zpm-quote zpm-note zpm-search zpm-add zpm-fetchurl
35
36 SCRIPTS=zpm zpm-install zpm-merge zpm-list zpm-preserve zpm-test zpm-log \
37         zpm-contents zpm-uninstall zpm-pathmod zpm-rmpackage zpm-newpackage \
38         zpm-pkg zpm-pkgfile zpm-gc zpm-repo zpm-update zpm-confgit
39
40 MANPAGES=doc/zpm.8 $(addprefix doc/zpm-, list.8 contents.8 hash.8 quote.8 pathmod.8 note.8 vercmp.8 repo.8 gc.8)
41 COMPILED=$(ZPKGBIN)
42 PROGRAMS=$(SCRIPTS) $(COMPILED)
43
44 def: programs
45         strip $(ZPKGBIN)
46
47 d:
48         printf '%s\n' $(LZMAOBJ)
49         printf '%s\n' $(PATH)
50
51 libzpm.a: $(LIBZPMOBJ) sqlite/sqlite3.o \
52         $(LZMAOBJ) \
53         $(JSWOBJ)
54         ar rcuv $@ $?
55
56 package: zpm-$(ZPMVER)-1.zpm
57
58 lzmaupdate:
59         find xz/src/liblzma -type d -name .deps -prune \
60                 -o -type f -printf '%P\n' \
61                 | xargs -IZ echo Z Z Z \
62                 | xargs printf 'test -e lzma/%s && cp xz/src/liblzma/%s lzma/%s\n' \
63                 | sh
64
65 #lzma/lz/lz_decoder.o: lzma/lz/lz_decoder.c
66 #lzma/lz/lz_encoder.o: lzma/lz/lz_encoder.c
67
68 lzma/%.o: lzma/%.c
69         $(CC) $(CFLAGS) $(LZMAFLAGS) -c -o $@ $<
70
71 lib/liblzma.a: $(LZMAOBJ)
72         ar rcuv $@ $?
73
74 lib/libjsw.a: $(JSWOBJ)
75         ar rcuv $@ $?
76
77 ZPM:= ./zpm -P.
78
79 zpm-$(ZPMVER)-1.zpm: programs $(MANPAGES)
80         rm -f $@
81         $(ZPM) newpackage -C zpm-$(ZPMVER)-1
82         $(ZPM) add -v -u root -g root -f $@ -P /sbin zpm-$(ZPMVER)-1 $(sort $(PROGRAMS))
83         $(ZPM) add -v -u root -g root -f $@ -P /usr/share/man/man8 -S doc $(MANPAGES)
84
85 tarball: zpm-$(ZPMVER)-1.tar.xz
86
87 zpm-$(ZPMVER)-1.tar.xz: programs
88         rm -f $@
89         tar -cJf $@ --transform='s|^|sbin/|' \
90                 $(PROGRAMS)
91
92 lzma.c: mklzma
93         sh mklzma
94
95 lzma.o: lzma.c
96         gcc -std=c99 -Wall -c -o $@ $<
97
98 stest: $(ZPKGBIN)
99         PATH=$(curdir)/t:$(curdir):$(PATH) t/$(T).t
100
101 t/ctap/prove: t/ctap/prove.o
102         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
103
104 test: $(ZPKGBIN) t/ctap/prove
105         @PATH=$(curdir)/t:$(curdir):$(PATH) t/ctap/prove t/*.t
106
107 programs: $(ZPKGBIN)
108
109 uncompress: uncompress.o 
110         $(CC) $(CFLAGS) -o $@ $+ -llzma
111
112 zpm-elftype: elf/elftype.c
113         $(CC) -Ielf $(CFLAGS) -o $@ $+
114
115 zpm-soname: elf/soname.c
116         $(CC) -Ielf $(CFLAGS) -o $@ $+
117
118 zpm-soneed: elf/needed.c
119         $(CC) -Ielf $(CFLAGS) -o $@ $+
120
121 zpm-addfile: zpm-addfile.o libzpm.a libelf.a
122         $(CC) -Ielf $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
123
124 zpm-hash: zpm-hash.o libzpm.a
125         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
126
127 zpm-verify: zpm-verify.o t/ctap/ctap.o libzpm.a
128         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< t/ctap/ctap.o -lzpm -lelf
129
130 zpm-init: zpm-init.o libzpm.a
131         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
132
133 zpm-extract: zpm-extract.o libzpm.a
134         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
135
136 zpm-script: zpm-script.o libzpm.a
137         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
138         
139 zpm-packagehash: zpm-packagehash.o libzpm.a
140         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
141
142 zpm-foreach-path.o: CFLAGS+=-Wno-unused-parameter
143 zpm-script.o: CFLAGS+=-Wno-unused-parameter
144
145 zpm-foreach-path: zpm-foreach-path.o libzpm.a sqlite/sqlite3.h
146         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
147
148 zpm-findpkg: zpm-findpkg.o libzpm.a
149         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
150
151 zpm-search: zpm-search.o libzpm.a
152         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
153
154 zpm-note: zpm-note.o libzpm.a
155         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
156
157 zpm-syncfs: zpm-syncfs.o libzpm.a libelf.a
158         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf -lm
159
160 zpm-parse: zpm-parse.o lib/parse.o
161         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
162
163 zpm-add: zpm-add.o libzpm.a libelf.a
164         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lzpm -lelf
165
166 zpm-quote: zpm-quote.o
167         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
168
169 db.sql: schema/main.sql schema/syncconflicts.sql schema/syncinfo.sql schema/preserve_packages.sql schema/age.sql
170         echo 'begin;' > $@
171         cat $+ >> $@
172         echo 'commit;' >> $@
173
174 newdb.c: db.sql
175         echo "char createdb[] = {" > $@
176         xxd -i < $< >> $@
177         echo ", 0};" >> $@
178
179 sqlite/sqlite3.o: sqlite/sqlite3.c sqlite/config.h
180         $(CC) -O3 -Wall -std=c99 -Ilib -D_HAVE_SQLITE_CONFIG_H=1 -c -o $@ $<
181
182 sqlite/extensions.o: sqlite/extensions.c
183         $(CC) -O3 -Wall -std=c99 -I. -Isqlite -DSQLITE_CORE=1 -c -o $@ $<
184
185 sqlite/shell.o: sqlite/shell.c sqlite/config.h Makefile
186         $(CC) -Wall -std=c99 -Ilib \
187                 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
188                 '-DSQLITE_SHELL_INIT_PROC(x)=zpm_setup_extensions(x)' \
189                 -D_POSIX_C_SOURCE=200112L -c -o $@ $<
190
191 lib/zpm.o: newdb.c
192
193 zpm-vercmp: zpm-vercmp.o lib/vercmp.o
194         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
195         
196 zpm-shell: sqlite/sqlite3.o sqlite/shell.o sqlite/extensions.o lib/vercmp.o
197         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
198
199 libelf.a: elf/libelf.o
200         ar rcuv $@ $?
201
202 install: $(COMPILED) $(MANPAGES)
203         test -d $(DESTDIR)/sbin || install -d $(DESTDIR)/sbin
204         install $(PROGRAMS) $(DESTDIR)/sbin
205         mkdir -p $(DESTDIR)/usr/share/man/man8
206         install -m644 $(MANPAGES) $(DESTDIR)/usr/share/man/man8
207
208 scan-prep: clean sqlite/sqlite3.o sqlite/shell.o lib/liblzma.a
209         @echo scan-build -v -o report make -j10
210
211 # crypto/tls items
212 X255OBJ= \
213 base.o \
214 fe_0.o \
215 fe_1.o \
216 fe_add.o \
217 fe_copy.o \
218 fe_cswap.o \
219 fe_frombytes.o \
220 fe_invert.o \
221 fe_mul.o \
222 fe_mul121666.o \
223 fe_sq.o \
224 fe_sub.o \
225 fe_tobytes.o \
226 scalarmult.o
227
228 TLSOBJ= tlse.o x25519.o chacha.o base64.o pem.o forward.o handshake.o \
229         buffer.o parse_client_hello.o parse_message.o cipher_supported.o \
230         packet_update.o hmac_message.o hkdf.o hash.o cipher_name.o
231
232 crypto/x25519.o: $(addprefix crypto/ref10/, $(X255OBJ))
233         ld -o $@ -r $+
234
235 crypto/%.o: CFLAGS+=-Icrypto -DTFM_DESC -DTFM_NO_ASM -Itomsfastmath/src/headers \
236         -Wno-pointer-sign -Wno-missing-braces -Ilibtomcrypt/src/headers
237
238 #       /usr/musl/bin/musl-clang -Wall -Wextra -Wno-missing-braces -Werror -Wno-pointer-sign -I. -DTFM_DESC -DTFM_NO_ASM -I ../libtomcrypt/src/headers -I ../tomsfastmath/src/headers -DSTRICT_TLS -DIGNORE_SESSION_ID --rtlib=compiler-rt   -c -o tlse.o tlse.c
239
240 #/usr/musl/bin/musl-clang -Wall -Wextra -Wno-missing-braces -Werror -Wno-pointer-sign -I. -DTFM_DESC -DTFM_NO_ASM -I ../libtomcrypt/src/headers -I ../tomsfastmath/src/headers -DSTRICT_TLS -DIGNORE_SESSION_ID --rtlib=compiler-rt   -c -o tlse.o tlse.c
241
242 tls.o: $(addprefix crypto/, $(TLSOBJ))
243         ld -o $@ -r $+
244
245 TFMOBJ= \
246    addsub/fp_add.o \
247    addsub/fp_add_d.o \
248    addsub/fp_addmod.o \
249    addsub/fp_cmp.o \
250    addsub/fp_cmp_d.o \
251    addsub/fp_cmp_mag.o \
252    addsub/fp_sub.o \
253    addsub/fp_sub_d.o \
254    addsub/fp_submod.o \
255    addsub/s_fp_add.o \
256    addsub/s_fp_sub.o \
257    bin/fp_radix_size.o \
258    bin/fp_read_radix.o \
259    bin/fp_read_signed_bin.o \
260    bin/fp_reverse.o \
261    bin/fp_read_unsigned_bin.o \
262    bin/fp_signed_bin_size.o \
263    bin/fp_s_rmap.o \
264    bin/fp_toradix.o \
265    bin/fp_toradix_n.o \
266    bin/fp_to_signed_bin.o \
267    bin/fp_to_unsigned_bin.o \
268    bin/fp_unsigned_bin_size.o \
269    bit/fp_cnt_lsb.o \
270    bit/fp_count_bits.o \
271    bit/fp_div_2.o \
272    bit/fp_div_2d.o \
273    bit/fp_lshd.o \
274    bit/fp_mod_2d.o \
275    bit/fp_rshd.o \
276    divide/fp_div.o \
277    divide/fp_div_d.o \
278    divide/fp_mod.o \
279    divide/fp_mod_d.o \
280    exptmod/fp_2expt.o \
281    exptmod/fp_exptmod.o \
282    misc/fp_ident.o \
283    misc/fp_rand.o \
284    misc/fp_set.o \
285    mont/fp_montgomery_calc_normalization.o \
286    mont/fp_montgomery_reduce.o \
287    mont/fp_montgomery_setup.o \
288    mul/fp_mul_2.o \
289    mul/fp_mul_2d.o \
290    mul/fp_mul.o \
291    mul/fp_mul_comba_12.o \
292    mul/fp_mul_comba_17.o \
293    mul/fp_mul_comba_20.o \
294    mul/fp_mul_comba_24.o \
295    mul/fp_mul_comba_28.o \
296    mul/fp_mul_comba_32.o \
297    mul/fp_mul_comba_3.o \
298    mul/fp_mul_comba_48.o \
299    mul/fp_mul_comba_4.o \
300    mul/fp_mul_comba_64.o \
301    mul/fp_mul_comba_6.o \
302    mul/fp_mul_comba_7.o \
303    mul/fp_mul_comba_8.o \
304    mul/fp_mul_comba.o \
305    mul/fp_mul_comba_small_set.o \
306    mul/fp_mul_d.o \
307    mul/fp_mul_comba_9.o \
308    mul/fp_mulmod.o \
309    numtheory/fp_gcd.o \
310    numtheory/fp_invmod.o \
311    numtheory/fp_isprime.o \
312    numtheory/fp_isprime_ex.o \
313    numtheory/fp_lcm.o \
314    numtheory/fp_prime_miller_rabin.o \
315    numtheory/fp_prime_random_ex.o \
316    sqr/fp_sqr.o \
317    sqr/fp_sqr_comba_12.o \
318    sqr/fp_sqr_comba_17.o \
319    sqr/fp_sqr_comba_20.o \
320    sqr/fp_sqr_comba_24.o \
321    sqr/fp_sqr_comba_28.o \
322    sqr/fp_sqr_comba_32.o \
323    sqr/fp_sqr_comba_48.o \
324    sqr/fp_sqr_comba_3.o \
325    sqr/fp_sqr_comba_4.o \
326    sqr/fp_sqr_comba_64.o \
327    sqr/fp_sqr_comba_6.o \
328    sqr/fp_sqr_comba_7.o \
329    sqr/fp_sqr_comba_8.o \
330    sqr/fp_sqr_comba_9.o \
331    sqr/fp_sqr_comba.o \
332    sqr/fp_sqr_comba_generic.o \
333    sqr/fp_sqr_comba_small_set.o \
334    sqr/fp_sqrmod.o
335
336 tomsfastmath/src/addsub/%.o: CFLAGS+=-DTFM_DESC -DTFM_NO_ASM -Itomsfastmath/src/headers -DARGTYPE=4
337 tomsfastmath/src/%.o: CFLAGS+=-DTFM_DESC -DTFM_NO_ASM -Itomsfastmath/src/headers -DARGTYPE=4
338
339 tfm.o: $(addprefix tomsfastmath/src/, $(TFMOBJ))
340         ld -o $@ -r $+
341
342 LTCOBJ= \
343    ciphers/aes/aes.o \
344    ciphers/anubis.o \
345    ciphers/blowfish.o \
346    ciphers/camellia.o \
347    ciphers/cast5.o \
348    ciphers/des.o \
349    ciphers/kasumi.o \
350    ciphers/khazad.o \
351    ciphers/kseed.o \
352    ciphers/multi2.o \
353    ciphers/noekeon.o \
354    ciphers/rc2.o \
355    ciphers/rc5.o \
356    ciphers/rc6.o \
357    ciphers/safer/safer.o \
358    ciphers/safer/saferp.o \
359    ciphers/skipjack.o \
360    ciphers/twofish/twofish.o \
361    ciphers/xtea.o \
362    encauth/ccm/ccm_add_aad.o \
363    encauth/ccm/ccm_add_nonce.o \
364    encauth/ccm/ccm_done.o \
365    encauth/ccm/ccm_init.o \
366    encauth/ccm/ccm_memory.o \
367    encauth/ccm/ccm_process.o \
368    encauth/ccm/ccm_reset.o \
369    encauth/ccm/ccm_test.o \
370    encauth/chachapoly/chacha20poly1305_add_aad.o \
371    encauth/chachapoly/chacha20poly1305_decrypt.o \
372    encauth/chachapoly/chacha20poly1305_done.o \
373    encauth/chachapoly/chacha20poly1305_encrypt.o \
374    encauth/chachapoly/chacha20poly1305_init.o \
375    encauth/chachapoly/chacha20poly1305_memory.o \
376    encauth/chachapoly/chacha20poly1305_setiv.o \
377    encauth/chachapoly/chacha20poly1305_setiv_rfc7905.o \
378    encauth/chachapoly/chacha20poly1305_test.o \
379    encauth/eax/eax_addheader.o \
380    encauth/eax/eax_decrypt.o \
381    encauth/eax/eax_decrypt_verify_memory.o \
382    encauth/eax/eax_done.o \
383    encauth/eax/eax_encrypt.o \
384    encauth/eax/eax_encrypt_authenticate_memory.o \
385    encauth/eax/eax_init.o \
386    encauth/eax/eax_test.o \
387    encauth/gcm/gcm_add_aad.o \
388    encauth/gcm/gcm_add_iv.o \
389    encauth/gcm/gcm_done.o \
390    encauth/gcm/gcm_gf_mult.o \
391    encauth/gcm/gcm_init.o \
392    encauth/gcm/gcm_memory.o \
393    encauth/gcm/gcm_mult_h.o \
394    encauth/gcm/gcm_process.o \
395    encauth/gcm/gcm_reset.o \
396    encauth/gcm/gcm_test.o \
397    misc/crypt/crypt_find_cipher_id.o \
398    misc/crypt/crypt_find_hash_any.o \
399    misc/crypt/crypt_find_hash.o \
400    encauth/ocb/ocb_decrypt.o \
401    encauth/ocb/ocb_decrypt_verify_memory.o \
402    encauth/ocb/ocb_done_decrypt.o \
403    encauth/ocb/ocb_done_encrypt.o \
404    misc/crypt/crypt_find_hash_id.o \
405    misc/crypt/crypt_find_hash_oid.o \
406    encauth/ocb/ocb_encrypt.o \
407    encauth/ocb/ocb_encrypt_authenticate_memory.o \
408    encauth/ocb/ocb_init.o \
409    encauth/ocb/ocb_ntz.o \
410    encauth/ocb/ocb_shift_xor.o \
411    encauth/ocb/ocb_test.o \
412    encauth/ocb/s_ocb_done.o \
413    encauth/ocb3/ocb3_add_aad.o \
414    encauth/ocb3/ocb3_decrypt.o \
415    encauth/ocb3/ocb3_decrypt_last.o \
416    encauth/ocb3/ocb3_decrypt_verify_memory.o \
417    encauth/ocb3/ocb3_done.o \
418    encauth/ocb3/ocb3_encrypt.o \
419    encauth/ocb3/ocb3_encrypt_authenticate_memory.o \
420    encauth/ocb3/ocb3_encrypt_last.o \
421    encauth/ocb3/ocb3_init.o \
422    encauth/ocb3/ocb3_int_ntz.o \
423    encauth/ocb3/ocb3_int_xor_blocks.o \
424    encauth/ocb3/ocb3_test.o \
425    hashes/blake2b.o \
426    hashes/blake2s.o \
427    hashes/chc/chc.o \
428    hashes/helper/hash_file.o \
429    hashes/helper/hash_filehandle.o \
430    hashes/helper/hash_memory.o \
431    hashes/helper/hash_memory_multi.o \
432    hashes/md2.o \
433    hashes/md4.o \
434    hashes/md5.o \
435    hashes/rmd128.o \
436    hashes/rmd160.o \
437    hashes/rmd256.o \
438    hashes/rmd320.o \
439    hashes/sha1.o \
440    hashes/sha2/sha224.o \
441    hashes/sha2/sha256.o \
442    hashes/sha2/sha384.o \
443    hashes/sha2/sha512.o \
444    hashes/sha2/sha512_224.o \
445    hashes/sha2/sha512_256.o \
446    hashes/sha3.o \
447    hashes/sha3_test.o \
448    hashes/tiger.o \
449    hashes/whirl/whirl.o \
450    mac/blake2/blake2bmac.o \
451    mac/blake2/blake2bmac_file.o \
452    mac/blake2/blake2bmac_memory.o \
453    mac/blake2/blake2bmac_memory_multi.o \
454    mac/blake2/blake2bmac_test.o \
455    mac/blake2/blake2smac.o \
456    mac/blake2/blake2smac_file.o \
457    mac/blake2/blake2smac_memory.o \
458    mac/blake2/blake2smac_memory_multi.o \
459    mac/blake2/blake2smac_test.o \
460    mac/f9/f9_done.o \
461    mac/f9/f9_file.o \
462    mac/f9/f9_init.o \
463    mac/f9/f9_memory.o \
464    mac/f9/f9_memory_multi.o \
465    mac/f9/f9_process.o \
466    mac/f9/f9_test.o \
467    mac/hmac/hmac_done.o \
468    mac/hmac/hmac_file.o \
469    mac/hmac/hmac_init.o \
470    mac/hmac/hmac_memory.o \
471    mac/hmac/hmac_memory_multi.o \
472    mac/hmac/hmac_process.o \
473    mac/hmac/hmac_test.o \
474    mac/omac/omac_done.o \
475    mac/omac/omac_file.o \
476    mac/omac/omac_init.o \
477    mac/omac/omac_memory.o \
478    mac/omac/omac_memory_multi.o \
479    mac/omac/omac_process.o \
480    misc/crypt/crypt_find_prng.o \
481    mac/omac/omac_test.o \
482    mac/pelican/pelican.o \
483    mac/pelican/pelican_memory.o \
484    mac/pelican/pelican_test.o \
485    mac/pmac/pmac_done.o \
486    mac/pmac/pmac_file.o \
487    mac/pmac/pmac_init.o \
488    mac/pmac/pmac_memory.o \
489    mac/pmac/pmac_memory_multi.o \
490    mac/pmac/pmac_ntz.o \
491    mac/pmac/pmac_process.o \
492    mac/pmac/pmac_shift_xor.o \
493    mac/pmac/pmac_test.o \
494    mac/poly1305/poly1305.o \
495    mac/poly1305/poly1305_file.o \
496    mac/poly1305/poly1305_memory.o \
497    mac/poly1305/poly1305_memory_multi.o \
498    mac/poly1305/poly1305_test.o \
499    mac/xcbc/xcbc_done.o \
500    mac/xcbc/xcbc_file.o \
501    mac/xcbc/xcbc_init.o \
502    mac/xcbc/xcbc_memory.o \
503    mac/xcbc/xcbc_memory_multi.o \
504    mac/xcbc/xcbc_process.o \
505    mac/xcbc/xcbc_test.o \
506    math/fp/ltc_ecc_fp_mulmod.o \
507    math/gmp_desc.o \
508    math/ltm_desc.o \
509    math/multi.o \
510    math/radix_to_bin.o \
511    math/rand_bn.o \
512    math/rand_prime.o \
513    math/tfm_desc.o \
514    misc/adler32.o \
515    misc/base64/base64_decode.o \
516    misc/base64/base64_encode.o \
517    misc/burn_stack.o \
518    misc/compare_testvector.o \
519    misc/crc32.o \
520    misc/crypt/crypt.o \
521    misc/crypt/crypt_argchk.o \
522    misc/crypt/crypt_cipher_descriptor.o \
523    misc/crypt/crypt_cipher_is_valid.o \
524    misc/crypt/crypt_constants.o \
525    misc/crypt/crypt_find_cipher.o \
526    misc/crypt/crypt_find_cipher_any.o \
527    misc/crypt/crypt_fsa.o \
528    misc/crypt/crypt_hash_descriptor.o \
529    misc/crypt/crypt_hash_is_valid.o \
530    misc/crypt/crypt_inits.o \
531    misc/crypt/crypt_ltc_mp_descriptor.o \
532    misc/crypt/crypt_prng_descriptor.o \
533    misc/crypt/crypt_prng_is_valid.o \
534    misc/crypt/crypt_prng_rng_descriptor.o \
535    misc/crypt/crypt_register_all_ciphers.o \
536    misc/crypt/crypt_register_all_hashes.o \
537    misc/crypt/crypt_register_all_prngs.o \
538    misc/crypt/crypt_register_cipher.o \
539    misc/crypt/crypt_register_hash.o \
540    misc/crypt/crypt_register_prng.o \
541    misc/crypt/crypt_sizes.o \
542    misc/crypt/crypt_unregister_cipher.o \
543    misc/crypt/crypt_unregister_hash.o \
544    misc/crypt/crypt_unregister_prng.o \
545    misc/error_to_string.o \
546    misc/hkdf/hkdf.o \
547    misc/hkdf/hkdf_test.o \
548    misc/mem_neq.o \
549    misc/pk_get_oid.o \
550    misc/pkcs5/pkcs_5_1.o \
551    misc/pkcs5/pkcs_5_2.o \
552    misc/pkcs5/pkcs_5_test.o \
553    misc/zeromem.o \
554    modes/cbc/cbc_decrypt.o \
555    modes/cbc/cbc_done.o \
556    modes/cbc/cbc_encrypt.o \
557    modes/cbc/cbc_getiv.o \
558    modes/cbc/cbc_setiv.o \
559    modes/cbc/cbc_start.o \
560    modes/cfb/cfb_decrypt.o \
561    modes/cfb/cfb_done.o \
562    modes/cfb/cfb_encrypt.o \
563    modes/cfb/cfb_getiv.o \
564    modes/cfb/cfb_setiv.o \
565    modes/cfb/cfb_start.o \
566    modes/ctr/ctr_decrypt.o \
567    modes/ctr/ctr_done.o \
568    modes/ctr/ctr_encrypt.o \
569    modes/ctr/ctr_getiv.o \
570    modes/ctr/ctr_setiv.o \
571    modes/ctr/ctr_start.o \
572    modes/ctr/ctr_test.o \
573    modes/ecb/ecb_decrypt.o \
574    modes/ecb/ecb_done.o \
575    modes/ecb/ecb_encrypt.o \
576    modes/ecb/ecb_start.o \
577    modes/f8/f8_decrypt.o \
578    modes/f8/f8_done.o \
579    modes/f8/f8_encrypt.o \
580    modes/f8/f8_getiv.o \
581    modes/f8/f8_setiv.o \
582    modes/f8/f8_start.o \
583    modes/f8/f8_test_mode.o \
584    modes/lrw/lrw_decrypt.o \
585    modes/lrw/lrw_done.o \
586    modes/lrw/lrw_encrypt.o \
587    modes/lrw/lrw_getiv.o \
588    modes/lrw/lrw_process.o \
589    modes/lrw/lrw_start.o \
590    modes/lrw/lrw_setiv.o \
591    modes/lrw/lrw_test.o \
592    modes/ofb/ofb_decrypt.o \
593    modes/ofb/ofb_done.o \
594    modes/ofb/ofb_encrypt.o \
595    modes/ofb/ofb_getiv.o \
596    modes/ofb/ofb_setiv.o \
597    modes/ofb/ofb_start.o \
598    modes/xts/xts_decrypt.o \
599    modes/xts/xts_done.o \
600    modes/xts/xts_encrypt.o \
601    modes/xts/xts_init.o \
602    modes/xts/xts_mult_x.o \
603    modes/xts/xts_test.o \
604    pk/asn1/der/bit/der_decode_bit_string.o \
605    pk/asn1/der/bit/der_decode_raw_bit_string.o \
606    pk/asn1/der/bit/der_encode_bit_string.o \
607    pk/asn1/der/bit/der_encode_raw_bit_string.o \
608    pk/asn1/der/bit/der_length_bit_string.o \
609    pk/asn1/der/boolean/der_decode_boolean.o \
610    pk/asn1/der/boolean/der_encode_boolean.o \
611    pk/asn1/der/boolean/der_length_boolean.o \
612    pk/asn1/der/choice/der_decode_choice.o \
613    pk/asn1/der/generalizedtime/der_decode_generalizedtime.o \
614    pk/asn1/der/generalizedtime/der_encode_generalizedtime.o \
615    pk/asn1/der/generalizedtime/der_length_generalizedtime.o \
616    pk/asn1/der/ia5/der_decode_ia5_string.o \
617    pk/asn1/der/ia5/der_encode_ia5_string.o \
618    pk/asn1/der/ia5/der_length_ia5_string.o \
619    pk/asn1/der/integer/der_decode_integer.o \
620    pk/asn1/der/integer/der_encode_integer.o \
621    pk/asn1/der/integer/der_length_integer.o \
622    pk/asn1/der/object_identifier/der_decode_object_identifier.o \
623    pk/asn1/der/object_identifier/der_encode_object_identifier.o \
624    pk/asn1/der/object_identifier/der_length_object_identifier.o \
625    pk/asn1/der/octet/der_decode_octet_string.o \
626    pk/asn1/der/octet/der_encode_octet_string.o \
627    pk/asn1/der/octet/der_length_octet_string.o \
628    pk/asn1/der/printable_string/der_decode_printable_string.o \
629    pk/asn1/der/printable_string/der_encode_printable_string.o \
630    pk/asn1/der/printable_string/der_length_printable_string.o \
631    pk/asn1/der/sequence/der_decode_sequence_ex.o \
632    pk/asn1/der/sequence/der_decode_sequence_flexi.o \
633    pk/asn1/der/sequence/der_decode_sequence_multi.o \
634    pk/asn1/der/sequence/der_decode_subject_public_key_info.o \
635    pk/asn1/der/sequence/der_encode_sequence_ex.o \
636    pk/asn1/der/sequence/der_encode_sequence_multi.o \
637    pk/asn1/der/sequence/der_encode_subject_public_key_info.o \
638    pk/asn1/der/sequence/der_length_sequence.o \
639    pk/asn1/der/sequence/der_sequence_free.o \
640    pk/asn1/der/sequence/der_sequence_shrink.o \
641    pk/asn1/der/set/der_encode_set.o \
642    pk/asn1/der/set/der_encode_setof.o \
643    pk/asn1/der/short_integer/der_decode_short_integer.o \
644    pk/asn1/der/short_integer/der_encode_short_integer.o \
645    pk/asn1/der/short_integer/der_length_short_integer.o \
646    pk/asn1/der/teletex_string/der_decode_teletex_string.o \
647    pk/asn1/der/teletex_string/der_length_teletex_string.o \
648    pk/asn1/der/utctime/der_decode_utctime.o \
649    pk/asn1/der/utctime/der_encode_utctime.o \
650    pk/asn1/der/utf8/der_decode_utf8_string.o \
651    pk/asn1/der/utctime/der_length_utctime.o \
652    pk/asn1/der/utf8/der_encode_utf8_string.o \
653    pk/asn1/der/utf8/der_length_utf8_string.o \
654    pk/dh/dh.o \
655    pk/dh/dh_check_pubkey.o \
656    pk/dh/dh_export.o \
657    pk/dh/dh_export_key.o \
658    pk/dh/dh_free.o \
659    pk/dh/dh_generate_key.o \
660    pk/dh/dh_import.o \
661    pk/dh/dh_set.o \
662    pk/dh/dh_set_pg_dhparam.o \
663    pk/dh/dh_shared_secret.o \
664    pk/dsa/dsa_decrypt_key.o \
665    pk/dsa/dsa_encrypt_key.o \
666    pk/dsa/dsa_export.o \
667    pk/dsa/dsa_generate_key.o \
668    pk/dsa/dsa_generate_pqg.o \
669    pk/dsa/dsa_free.o \
670    pk/dsa/dsa_import.o \
671    pk/dsa/dsa_make_key.o \
672    pk/dsa/dsa_set.o \
673    pk/dsa/dsa_set_pqg_dsaparam.o \
674    pk/dsa/dsa_shared_secret.o \
675    pk/dsa/dsa_sign_hash.o \
676    pk/dsa/dsa_verify_hash.o \
677    pk/dsa/dsa_verify_key.o \
678    pk/ecc/ecc.o \
679    pk/ecc/ecc_ansi_x963_export.o \
680    pk/ecc/ecc_ansi_x963_import.o \
681    pk/ecc/ecc_decrypt_key.o \
682    pk/ecc/ecc_encrypt_key.o \
683    pk/ecc/ecc_export.o \
684    pk/ecc/ecc_free.o \
685    pk/ecc/ecc_get_size.o \
686    pk/ecc/ecc_import.o \
687    pk/ecc/ecc_make_key.o \
688    pk/ecc/ecc_shared_secret.o \
689    pk/ecc/ecc_sign_hash.o \
690    pk/ecc/ecc_sizes.o \
691    pk/ecc/ecc_test.o \
692    pk/ecc/ecc_verify_hash.o \
693    pk/ecc/ltc_ecc_map.o \
694    pk/ecc/ltc_ecc_is_valid_idx.o \
695    pk/ecc/ltc_ecc_mul2add.o \
696    pk/ecc/ltc_ecc_mulmod.o \
697    pk/ecc/ltc_ecc_mulmod_timing.o \
698    pk/ecc/ltc_ecc_points.o \
699    pk/ecc/ltc_ecc_projective_add_point.o \
700    pk/ecc/ltc_ecc_projective_dbl_point.o \
701    pk/katja/katja_decrypt_key.o \
702    pk/katja/katja_encrypt_key.o \
703    pk/katja/katja_export.o \
704    pk/katja/katja_exptmod.o \
705    pk/katja/katja_free.o \
706    pk/katja/katja_import.o \
707    pk/katja/katja_make_key.o \
708    pk/pkcs1/pkcs_1_i2osp.o \
709    pk/pkcs1/pkcs_1_mgf1.o \
710    pk/pkcs1/pkcs_1_oaep_decode.o \
711    pk/pkcs1/pkcs_1_oaep_encode.o \
712    pk/pkcs1/pkcs_1_os2ip.o \
713    pk/pkcs1/pkcs_1_pss_decode.o \
714    pk/pkcs1/pkcs_1_pss_encode.o \
715    pk/pkcs1/pkcs_1_v1_5_decode.o \
716    pk/pkcs1/pkcs_1_v1_5_encode.o \
717    pk/rsa/rsa_decrypt_key.o \
718    pk/rsa/rsa_encrypt_key.o \
719    pk/rsa/rsa_export.o \
720    pk/rsa/rsa_exptmod.o \
721    pk/rsa/rsa_free.o \
722    pk/rsa/rsa_get_size.o \
723    pk/rsa/rsa_import.o \
724    pk/rsa/rsa_import_pkcs8.o \
725    pk/rsa/rsa_import_x509.o \
726    pk/rsa/rsa_make_key.o \
727    pk/rsa/rsa_set.o \
728    pk/rsa/rsa_sign_hash.o \
729    pk/rsa/rsa_sign_saltlen_get.o \
730    pk/rsa/rsa_verify_hash.o \
731    prngs/chacha20.o \
732    prngs/fortuna.o \
733    prngs/rc4.o \
734    prngs/rng_get_bytes.o \
735    prngs/rng_make_prng.o \
736    prngs/sober128.o \
737    prngs/sprng.o \
738    prngs/yarrow.o \
739    stream/chacha/chacha_crypt.o \
740    stream/chacha/chacha_done.o \
741    stream/chacha/chacha_ivctr32.o \
742    stream/chacha/chacha_ivctr64.o \
743    stream/chacha/chacha_keystream.o \
744    stream/chacha/chacha_setup.o \
745    stream/chacha/chacha_test.o \
746    stream/rc4/rc4_stream.o \
747    stream/rc4/rc4_test.o \
748    stream/sober128/sober128_stream.o \
749    stream/sober128/sober128_test.o
750
751 libtomcrypt/%.o: CFLAGS+=-DTFM_DESC -Isrc/headers -Itomsfastmath/src/headers -DARGTYPE=4 -DLTC_NO_ASM -DTFM_NO_ASM -Ilibtomcrypt/src/headers -DLTC_SOURCE
752
753 ltc.o: $(addprefix libtomcrypt/src/, $(LTCOBJ))
754         ld -o $@ -r $+
755
756 crypto/rfc3986.c: crypto/rfc3986.re
757         re2c --input custom --tags -o $@ $<
758
759 rfc3986: rfc3986.c
760         $(CC) -Wall -W -Wextra -Werror -o $@ $+
761
762 zpm-fetchurl.o: CFLAGS+=-DTFM_DESC -Isrc/headers -Itomsfastmath/src/headers -DARGTYPE=4 -DLTC_NO_ASM -DTFM_NO_ASM -Ilibtomcrypt/src/headers -DLTC_SOURCE -Icrypto -Wno-pointer-sign -DDEBUG
763
764 zpm-fetchurl: ltc.o tls.o tfm.o zpm-fetchurl.o crypto/https.o crypto/rfc3986.o
765
766 testddg: zpm-fetchurl
767         ./zpm-fetchurl duckduckgo.com 443 /
768
769 testgra: zpm-fetchurl
770         ./zpm-fetchurl granicus.if.org 443 /
771
772 clean:
773         rm -f *.o sqlite/*.o lib/*.o $(LZMAOBJ) liblzma.a \
774                 libelf.a libzpm.a zpm-addfile soname \
775                 *.xz \
776                 local.db \
777                 t/ctap/*.o \
778                 $(ZPKGBIN) \
779                 db.sql \
780                 elf/*.o lib/jsw/*.o \
781                 $(addprefix crypto/ref10/, $(X255OBJ)) \
782                 $(addprefix crypto/, $(TLSOBJ)) \
783                 $(addprefix tomsfastmath/src/, $(TFMOBJ)) \
784                 $(addprefix libtomcrypt/src/, $(LTCOBJ)) \
785                 x25519.o