forked from jpouellet/signify-osx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
136 lines (101 loc) · 3.57 KB
/
Makefile
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
PREFIX= /usr/local
BINDIR= ${PREFIX}/bin
MANDIR= ${PREFIX}/share/man
#CVSROOT= anoncvs@anoncvs.openbsd.org:/cvs
CVSROOT= anoncvs@anoncvs3.usa.openbsd.org:/cvs
### sources from upstream
SRCS+= src/lib/libc/crypt/blowfish.c
SRCS+= src/lib/libc/hash/sha2.c
SRCS+= src/lib/libc/net/base64.c
SRCS+= src/lib/libc/string/explicit_bzero.c
SRCS+= src/lib/libutil/bcrypt_pbkdf.c
SRCS+= src/lib/libutil/ohash.c
SRCS+= src/usr.bin/signify/crypto_api.c
SRCS+= src/usr.bin/signify/fe25519.c
SRCS+= src/usr.bin/signify/mod_ed25519.c
SRCS+= src/usr.bin/signify/mod_ge25519.c
SRCS+= src/usr.bin/signify/signify.c
SRCS+= src/usr.bin/signify/sc25519.c
SRCS+= src/usr.bin/signify/zsig.c
INCL+= src/include/blf.h
INCL+= src/include/sha2.h
INCL+= src/lib/libutil/ohash.h
INCL+= src/lib/libutil/util.h # only for bcrypt_pbkdf decl
INCL+= src/usr.bin/signify/crypto_api.h
INCL+= src/usr.bin/signify/fe25519.h
INCL+= src/usr.bin/signify/ge25519.h
INCL+= src/usr.bin/signify/ge25519_base.data
INCL+= src/usr.bin/signify/sc25519.h
INCL+= src/usr.bin/signify/signify.h
MAN= src/usr.bin/signify/signify.1
FETCH_ONLY+= src/etc/signify # keys
FETCH_ONLY+= src/lib/libc/hash/helper.c # src of generated files
FETCH_ONLY+= src/regress/lib/libc/explicit_bzero
FETCH_ONLY+= src/regress/usr.bin/signify
FROM_CVS+= ${SRCS} ${INCL} ${MAN} ${FETCH_ONLY}
### local files
HASH_HELPERS+= src/lib/libc/hash/sha256hl.c
HASH_HELPERS+= src/lib/libc/hash/sha512hl.c
HASH_HELPERS+= src/lib/libc/hash/sha512_256hl.c
LOCAL_SRCS+= ${HASH_HELPERS}
LOCAL_SRCS+= hashaliases.c
LOCAL_SRCS+= freezero.c
### build cfg
CFLAGS+= -Isrc/include
CFLAGS+= -Isrc/lib/libutil
CFLAGS+= -include missing.h
CFLAGS+= '-DDEF_WEAK(a)=asm("")'
CFLAGS+= '-DMAKE_CLONE(a,b)=asm("")'
CFLAGS+= '-Dpledge(a,b)=(0)'
CFLAGS+= -Wall -Wextra
CFLAGS+= -Wno-pointer-sign
CFLAGS+= -Wno-sign-compare
CFLAGS+= -Wno-unused-parameter
### targets
.PHONY: fetch hash-helpers clean install check test up check-updates ls
signify: ${LOCAL_SRCS} ${SRCS} ${INCL}
${CC} ${CFLAGS} -o $@ ${SRCS} ${LOCAL_SRCS}
cp src/usr.bin/signify/signify.1 .
hash-helpers: ${HASH_HELPERS}
src/lib/libc/hash/sha256hl.c: src/lib/libc/hash/helper.c
sed -e 's/hashinc/sha2.h/g' \
-e 's/HASH/SHA256/g' \
-e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' $< > $@
src/lib/libc/hash/sha512hl.c: src/lib/libc/hash/helper.c
sed -e 's/hashinc/sha2.h/g' \
-e 's/HASH/SHA512/g' \
-e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' $< > $@
src/lib/libc/hash/sha512_256hl.c: src/lib/libc/hash/helper.c
sed -e 's/hashinc/sha2.h/g' \
-e 's/HASH/SHA512_256/g' \
-e 's/SHA512_256_CTX/SHA2_CTX/g' $< > $@
src/lib/libc/hash/helper.c:
$(error Missing source files... Maybe you want to `make fetch`?)
fetch:
# Fetch the sources via CVS.
cvs -qd ${CVSROOT} get -P ${FROM_CVS}
# Don't keep CVS Root files around. All they do is cause false-positives
# for change detection when fetching from different CVS mirrors.
find src -name Root -exec rm {} +
install: signify
install -d ${BINDIR} ${MANDIR}/man1
install -Ss -m 755 signify ${BINDIR}
install -S -m 644 signify.1 ${MANDIR}/man1
### regression test targets
REGRESS_BZ_SRCS= src/lib/libc/string/explicit_bzero.c
REGRESS_BZ_SRCS+= src/regress/lib/libc/explicit_bzero/explicit_bzero.c
explicit_bzero: ${REGRESS_BZ_SRCS}
${CC} ${CFLAGS} -o $@ ${REGRESS_BZ_SRCS}
check: test
test: signify explicit_bzero
@sh ./regress.sh
### syncing with upstream
up: check-updates
check-updates:
@(cd src && CVS_RSH=ssh cvs -qnd ${CVSROOT} up 2>&1 \
| (grep -v '^? ' || echo 'Up to date!'))
### misc
ls:
@echo $(FROM_CVS:src/%=%)
clean:
rm -rf signify signify.1 test-results explicit_bzero