forked from nym-zone/easyseed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.inc
78 lines (67 loc) · 1.92 KB
/
Makefile.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
PROG=easyseed
MANSEC=1
OBJS= $(PROG).o \
vectors.o
WORDLISTS= chinese_simplified \
chinese_traditional \
czech \
english \
french \
indonesian \
italian \
japanese \
korean \
russian \
spanish \
ukrainian
VECTORSRC= mkvectors.sh \
vectors.h \
vectors.json \
test_EN_BIP39.json \
test_JP_BIP39.json
libutf8proc.a: utf8proc/utf8proc.[ch] utf8proc/utf8proc_data.c
make -C utf8proc libutf8proc.a
mv utf8proc/libutf8proc.a $@
#manfmt: $(PROG).$(MANSEC).html $(PROG).$(MANSEC).md $(PROG).$(MANSEC).txt
manfmt: $(PROG).$(MANSEC).html $(PROG).$(MANSEC).txt
$(PROG).$(MANSEC).html: $(PROG).$(MANSEC)
mandoc -I os=Bitcoin -T html $< > $@
#Currently broken with message:
#mandoc -I os=Bitcoin -T markdown easyseed.1 > easyseed.1.md
#mandoc: mdoc_markdown.c:333: md_node: Assertion `n->tok >= MDOC_Dd && n->tok < MDOC_MAX' failed.
#$(PROG).$(MANSEC).md: $(PROG).$(MANSEC)
# mandoc -I os=Bitcoin -T markdown $< > $@
$(PROG).$(MANSEC).txt: $(PROG).$(MANSEC)
# XXX: Ridiculous kludge around make/shell quoting issues which
# prevent me from simply using sed expression $'s/[^\b]\b//g' :
mandoc -I os=Bitcoin -T utf8 $< | \
tr '\b' '^' | sed $(SEDRE) -e 's/[^^]\^//g' > $@
wordlist.h: wordlist/*
for lang in $(WORDLISTS) ; do \
echo "static const char *$${lang}[2048] = {" ; \
{ \
ctr=2048 ; \
while read w ; do \
if [ $$((ctr -= 1)) -eq 0 ] ; then \
printf '\tu8"%s"\n};\n' "$$w" ; \
else \
printf '\tu8"%s",\n' "$$w" ; \
fi ; \
done < wordlist/$${lang}.txt ; \
printf 'static const char %s_hash[] = "%s";\n' \
$${lang} \
`$(HASHPROG) wordlist/$${lang}.txt | \
grep -Eo '^[0-9a-f]+'` ; \
} ; \
done > $@
#
# Requires jq. Also, the shell script is awful.
# I will check in a "baked" version.
#
vectors.c: $(VECTORSRC)
./mkvectors.sh > $@
clean:
rm -f $(PROG) $(OBJS) wordlist.h \
$(PROG).$(MANSEC).html $(PROG).$(MANSEC).md $(PROG).$(MANSEC).txt
check: $(PROG)
./$(PROG) -T