xref: /openbsd/lib/libssl/Makefile (revision 7214807f)
1*7214807fSjsing# $OpenBSD: Makefile,v 1.59 2020/01/22 01:21:43 jsing Exp $
2b6fe13c7Sbrad
333afedf6Sschwarze.include <bsd.own.mk>
433afedf6Sschwarze.ifndef NOMAN
5f1a3c524SschwarzeSUBDIR=	man
633afedf6Sschwarze.endif
733afedf6Sschwarze
8252ab50eSmiodPC_FILES=openssl.pc libssl.pc
97fb09174Sjasper
10f208b8a0SjsingCLEANFILES=${PC_FILES} ${VERSION_SCRIPT}
119bd621f3Sderaadt
1226febb63SbeckLIB=	ssl
1326febb63Sbeck
1426febb63SbeckCFLAGS+= -Wall -Wundef
15736f6d0bSdoug.if ${COMPILER_VERSION:L} == "clang"
1626febb63SbeckCFLAGS+= -Werror
1726febb63Sbeck.endif
1826febb63SbeckCFLAGS+= -DLIBRESSL_INTERNAL
19f69ab74fSjsing.ifdef TLS1_3
20*7214807fSjsingCFLAGS+= -DLIBRESSL_HAS_TLS1_3_CLIENT
21*7214807fSjsingCFLAGS+= -DLIBRESSL_HAS_TLS1_3_SERVER
22f69ab74fSjsing.endif
2326febb63SbeckCFLAGS+= -I${.CURDIR}
2426febb63Sbeck
2596236fe7SbcookLDADD+= -L${BSDOBJDIR}/lib/libcrypto -lcrypto
2626febb63Sbeck
27a9f45c63SguentherVERSION_SCRIPT=	Symbols.map
28a9f45c63SguentherSYMBOL_LIST=	${.CURDIR}/Symbols.list
29a9f45c63Sguenther
3026febb63SbeckSRCS= \
3187c5d849Sjsing	bio_ssl.c \
3287c5d849Sjsing	bs_ber.c \
3387c5d849Sjsing	bs_cbb.c \
3487c5d849Sjsing	bs_cbs.c \
3587c5d849Sjsing	d1_both.c \
3687c5d849Sjsing	d1_clnt.c \
3787c5d849Sjsing	d1_enc.c \
3887c5d849Sjsing	d1_lib.c \
3987c5d849Sjsing	d1_pkt.c \
4087c5d849Sjsing	d1_srtp.c \
4187c5d849Sjsing	d1_srvr.c \
4287c5d849Sjsing	pqueue.c \
4387c5d849Sjsing	s3_cbc.c \
4487c5d849Sjsing	s3_lib.c \
4587c5d849Sjsing	ssl_algs.c \
4687c5d849Sjsing	ssl_asn1.c \
4787c5d849Sjsing	ssl_both.c \
4887c5d849Sjsing	ssl_cert.c \
4987c5d849Sjsing	ssl_ciph.c \
50a36841cfStb	ssl_ciphers.c \
5187c5d849Sjsing	ssl_clnt.c \
5287c5d849Sjsing	ssl_err.c \
5387c5d849Sjsing	ssl_init.c \
5487c5d849Sjsing	ssl_lib.c \
5587c5d849Sjsing	ssl_methods.c \
5687c5d849Sjsing	ssl_packet.c \
5787c5d849Sjsing	ssl_pkt.c \
5887c5d849Sjsing	ssl_rsa.c \
5987c5d849Sjsing	ssl_sess.c \
6087c5d849Sjsing	ssl_sigalgs.c \
6187c5d849Sjsing	ssl_srvr.c \
6287c5d849Sjsing	ssl_stat.c \
6387c5d849Sjsing	ssl_tlsext.c \
641c0e4449Sjsing	ssl_transcript.c \
6587c5d849Sjsing	ssl_txt.c \
6687c5d849Sjsing	ssl_versions.c \
6787c5d849Sjsing	t1_enc.c \
6887c5d849Sjsing	t1_lib.c \
6987c5d849Sjsing	tls13_buffer.c \
7020290792Sjsing	tls13_client.c \
71c9989395Sjsing	tls13_error.c \
7287c5d849Sjsing	tls13_handshake.c \
739673436aSjsing	tls13_handshake_msg.c \
7487c5d849Sjsing	tls13_key_schedule.c \
75389212baSjsing	tls13_lib.c \
762502d49fSjsing	tls13_record.c \
778630be86Sjsing	tls13_record_layer.c \
788630be86Sjsing	tls13_server.c
7926febb63Sbeck
8087c5d849SjsingHDRS=	dtls1.h srtp.h ssl.h ssl2.h ssl23.h ssl3.h tls1.h
8126febb63Sbeck
8226febb63Sbeck.PATH:	${.CURDIR}
8326febb63Sbeck
8426febb63Sbeckincludes:
8526febb63Sbeck	@test -d ${DESTDIR}/usr/include/openssl || \
8626febb63Sbeck	    mkdir ${DESTDIR}/usr/include/openssl
8726febb63Sbeck	@cd ${.CURDIR}; for i in $(HDRS); do \
8826febb63Sbeck	    j="cmp -s $$i ${DESTDIR}/usr/include/openssl/`basename $$i` || \
8926febb63Sbeck	    ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 $$i\
9026febb63Sbeck		${DESTDIR}/usr/include/openssl"; \
9126febb63Sbeck	    echo $$j; \
9226febb63Sbeck	    eval "$$j"; \
9326febb63Sbeck	done;
9426febb63Sbeck
95a9f45c63Sguenther${VERSION_SCRIPT}: ${SYMBOL_LIST}
96a9f45c63Sguenther	{ printf '{\n\tglobal:\n'; \
97a9f45c63Sguenther	  sed '/^[._a-zA-Z]/s/$$/;/; s/^/		/' ${SYMBOL_LIST}; \
98a9f45c63Sguenther	  printf '\n\tlocal:\n\t\t*;\n};\n'; } >$@.tmp && mv $@.tmp $@
99a9f45c63Sguenther
10026febb63Sbeck.include <bsd.lib.mk>
10126febb63Sbeck
102e62d0eeaSnatanoall: ${PC_FILES}
10353c02d25Snatano${PC_FILES}: ${.CURDIR}/../libcrypto/opensslv.h
10453c02d25Snatano	/bin/sh ${.CURDIR}/generate_pkgconfig.sh -c ${.CURDIR} -o ${.OBJDIR}
10553c02d25Snatano
106e62d0eeaSnatanobeforeinstall:
10726febb63Sbeck	nm -o lib${LIB}.a | egrep -w 'printf|fprintf' && \
10826febb63Sbeck	    (echo please fix stdio usage in this library; false) || true
1097fb09174Sjasper.for p in ${PC_FILES}
1107fb09174Sjasper	${INSTALL} ${INSTALL_COPY} -o root -g ${SHAREGRP} \
1117fb09174Sjasper	    -m ${SHAREMODE} ${.OBJDIR}/$p ${DESTDIR}/usr/lib/pkgconfig/
1127fb09174Sjasper.endfor
1137fb09174Sjasper
11441b8aa9eSderaadt.include <bsd.subdir.mk>
115