xref: /openbsd/lib/libfido2/Makefile (revision 2b41d92f)
1# $OpenBSD: Makefile,v 1.9 2022/11/13 14:09:17 tb Exp $
2
3.PATH:	${.CURDIR}/man ${.CURDIR}/src
4
5CFLAGS+= -I${.CURDIR}/src -std=c99
6CFLAGS+= -D_FIDO_INTERNAL -DHAVE_UNISTD_H
7
8WARNINGS=	yes
9CDIAGFLAGS+=	-Wall -Wextra
10CDIAGFLAGS+=	-Werror
11
12LDADD+=		-L${BSDOBJDIR}/lib/libcbor -lcbor
13LDADD+=		-L${BSDOBJDIR}/lib/libcrypto -lcrypto
14LDADD+=		-L${BSDOBJDIR}/lib/libz -lz
15
16SYMBOL_LIST=	Symbols.list
17VERSION_SCRIPT=	Symbols.map
18CLEANFILES=	${SYMBOL_LIST} ${VERSION_SCRIPT}
19
20LIB=	fido2
21SRCS=	aes256.c assert.c authkey.c bio.c blob.c buf.c cbor.c compress.c
22SRCS+=	config.c cred.c credman.c dev.c ecdh.c eddsa.c err.c es256.c
23SRCS+=	hid.c hid_openbsd.c hid_unix.c info.c io.c iso7816.c largeblob.c
24SRCS+=	log.c nfc.c pin.c random.c reset.c rs1.c rs256.c time.c touch.c
25SRCS+=	tpm.c types.c u2f.c util.c
26
27HDRS=	fido.h fido/bio.h fido/config.h fido/credman.h fido/eddsa.h fido/err.h
28HDRS+=	fido/es256.h fido/param.h fido/rs256.h fido/types.h
29
30MAN=	eddsa_pk_new.3 es256_pk_new.3 fido_assert_allow_cred.3 fido_assert_new.3
31MAN+=	fido_assert_set_authdata.3 fido_assert_verify.3 fido_bio_dev_get_info.3
32MAN+=	fido_bio_enroll_new.3 fido_bio_info_new.3 fido_bio_template.3
33MAN+=	fido_cbor_info_new.3 fido_cred_exclude.3 fido_cred_new.3
34MAN+=	fido_cred_set_authdata.3 fido_cred_verify.3 fido_credman_metadata_new.3
35MAN+=	fido_dev_get_assert.3 fido_dev_info_manifest.3 fido_dev_make_cred.3
36MAN+=	fido_dev_open.3 fido_dev_set_io_functions.3 fido_dev_set_pin.3
37MAN+=	fido_init.3 fido_strerr.3 rs256_pk_new.3 fido_dev_get_touch_begin.3
38MAN+=	fido_dev_enable_entattest.3 fido_dev_largeblob_get.3
39
40includes:
41	@for i in $(HDRS); do \
42		j="test -d ${DESTDIR}/usr/include/`dirname $$i` || \
43		    ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
44		    ${DESTDIR}/usr/include/`dirname $$i`"; \
45		echo $$j; \
46		eval "$$j"; \
47		j="cmp -s src/$$i ${DESTDIR}/usr/include/$$i || \
48		    ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \
49		    -m 444 ${.CURDIR}/src/$$i ${DESTDIR}/usr/include/$$i"; \
50		echo $$j; \
51		eval "$$j"; \
52	done
53
54${SYMBOL_LIST}: ${.CURDIR}/src/export.llvm
55	sort ${.CURDIR}/src/export.llvm | sed 's/^_//' > $@.tmp && mv $@.tmp $@
56
57${VERSION_SCRIPT}: ${SYMBOL_LIST}
58	{ printf '{\n\tglobal:\n'; \
59	  sed '/^[._a-zA-Z]/s/$$/;/; s/^/		/' ${SYMBOL_LIST}; \
60	  printf '\n\tlocal:\n\t\t*;\n};\n'; } >$@.tmp && mv $@.tmp $@
61
62.include <bsd.lib.mk>
63