1311116Sdim#	$NetBSD: Makefile,v 1.1.1.2 2023/04/18 14:19:03 christos Exp $
2311116Sdim
3353358Sdim# RCSid:
4353358Sdim#	Id: Makefile,v 1.33 1998/11/11 11:53:53 sjg Exp
5353358Sdim#
6311116Sdim#	@(#) Copyright (c) 1994 Simon J. Gerraty
7311116Sdim#
8311116Sdim#	This file is provided in the hope that it will
9311116Sdim#	be of use.  There is absolutely NO WARRANTY.
10311116Sdim#	Permission to copy, redistribute or otherwise
11311116Sdim#	use this file is hereby granted provided that 
12311116Sdim#	the above copyright notice and this notice are
13311116Sdim#	left intact. 
14321369Sdim#      
15321369Sdim#	Please send copies of changes and bug-fixes to:
16321369Sdim#	sjg@quick.com.au
17321369Sdim#
18321369Sdim
19327952SdimLIB=	crypto
20311116SdimUSE_FORT?= yes	# cryptographic software
21311116SdimUSE_SHLIBDIR=	yes
22311116SdimUSE_FIPS=	no
23311116Sdim#DBG=-g
24311116Sdim
25341825Sdim.include <bsd.own.mk>
26311116Sdim.include <bsd.shlib.mk>
27327952Sdim
28327952Sdim# XXX: There's a bit of work to do before we can enable warnings.
29327952SdimWARNS=0
30327952SdimCWARNFLAGS.clang+=	-Wno-empty-body -Wno-unused-value -Wno-parentheses -Wno-implicit-int-float-conversion
31327952Sdim# XXX: This warning seems to trigger incorrectly
32327952SdimCWARNFLAGS.clang+=	-Wno-atomic-alignment
33327952Sdim
34327952SdimLINTFLAGS+=	-X 161	# constant in conditional context
35327952SdimLINTFLAGS+=	-X 129	# expression has null effect
36327952SdimLINTFLAGS+=	-X 117	# bitwise '>>' on signed value possibly nonportable
37327952SdimLINTFLAGS+=	-X 231	# argument '%s' unused in function '%s'
38327952SdimLINTFLAGS+=	-X 220	# fallthrough on case statement
39327952SdimLINTFLAGS+=	-X 118	# semantics of '%s' change in ANSI C; use explicit cast
40327952Sdim
41327952SdimCPPFLAGS+= -Dlib${LIB} -I. -I${OPENSSLSRC}/crypto -I${OPENSSLSRC}
42327952SdimCPPFLAGS+= -I${OPENSSLSRC}/include -I${OPENSSLSRC}/crypto/include
43341825SdimCPPFLAGS+= -I${OPENSSLSRC}/crypto/asn1 -I${OPENSSLSRC}/crypto/evp
44327952SdimCPPFLAGS+= -I${OPENSSLSRC}/crypto/modes
45327952SdimCPPFLAGS+= -I${OPENSSLSRC}/../include
46311116Sdim
47327952SdimCRYPTODIST=	${NETBSDSRCDIR}/crypto
48327952Sdim
49327952Sdim.include "${NETBSDSRCDIR}/crypto/Makefile.openssl"
50327952Sdim.PATH: ${OPENSSLSRC} ${OPENSSLSRC}/include/openssl
51341825Sdim.PATH: ${OPENSSLSRC}/../include/openssl ${OPENSSLSRC}/include/internal
52341825Sdim
53341825Sdim.include "srcs.inc"
54341825Sdim
55341825SdimAFLAGS+=-DELF
56327952SdimLIBDPLIBS+= crypt ${NETBSDSRCDIR}/lib/libcrypt
57327952Sdim
58341825SdimOS_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
59327952Sdim
60327952Sdim# XXX CFLAGS: While it would be nice to know which compiler flags
61327952Sdim# XXX the library was built with, we don't want pathname information
62321369Sdim# XXX for the host toolchain embedded in the image.
63321369Sdim${SRCS}: buildinf.h
64321369Sdimbuildinf.h: Makefile
65321369Sdim	@echo "#ifndef MK1MF_BUILD" >buildinf.h
66321369Sdim	@echo "#define compiler_flags \"`${CC} -v 2>&1 | grep 'gcc version'`\"" >>buildinf.h
67311116Sdim	@echo "#define PLATFORM \"NetBSD-${MACHINE_ARCH}\"" >>buildinf.h
68311116Sdim	@echo "#define DATE \"NetBSD ${OS_VERSION}\"" >>buildinf.h
69311116Sdim	@echo "#endif" >>buildinf.h
70311116Sdim
71321369SdimCLEANFILES+= buildinf.h
72311116Sdim
73311116Sdim# This list is built from the contents of the include/openssl
74311116Sdim# directory in the OpenSSL source distribution.
75321369SdimINCS+= \
76311116Sdimaes.h \
77344779Sdimasn1.h \
78344779Sdimasn1_mac.h \
79344779Sdimasn1err.h \
80344779Sdimasn1t.h \
81344779Sdimasync.h \
82344779Sdimasyncerr.h \
83311116Sdimbio.h \
84344779Sdimbioerr.h \
85353358Sdimblowfish.h \
86344779Sdimbn.h \
87360784Sdimbnerr.h \
88360784Sdimbuffer.h \
89353358Sdimbuffererr.h \
90341825Sdimcamellia.h \
91341825Sdimcast.h \
92311116Sdimcmac.h \
93353358Sdimcms.h \
94353358Sdimcmserr.h \
95353358Sdimcomp.h \
96353358Sdimcomperr.h \
97353358Sdimconf.h \
98353358Sdimconf_api.h \
99353358Sdimconferr.h \
100353358Sdimcrypto.h \
101344779Sdimcryptoerr.h \
102353358Sdimct.h \
103353358Sdimcterr.h \
104353358Sdimdes.h \
105353358Sdimdh.h \
106344779Sdimdherr.h \
107353358Sdimdsa.h \
108353358Sdimdsaerr.h \
109353358Sdimdtls1.h \
110341825Sdime_os2.h \
111341825Sdimebcdic.h \
112341825Sdimec.h \
113341825Sdimecdh.h \
114341825Sdimecdsa.h \
115341825Sdimecerr.h \
116341825Sdimengine.h \
117311116Sdimengineerr.h \
118321369Sdimerr.h \
119327952Sdimevp.h \
120353358Sdimevperr.h \
121321369Sdimhmac.h \
122321369Sdimkdf.h \
123321369Sdimkdferr.h \
124321369Sdimlhash.h \
125321369Sdimmd2.h \
126321369Sdimmd4.h \
127321369Sdimmd5.h \
128353358Sdimmodes.h \
129353358Sdimobj_mac.h \
130353358Sdimobjects.h \
131353358Sdimobjectserr.h \
132353358Sdimocsp.h \
133353358Sdimocsperr.h \
134321369Sdimopensslconf.h \
135353358Sdimopensslv.h \
136353358Sdimossl_typ.h \
137353358Sdimpem.h \
138327952Sdimpem2.h \
139341825Sdimpemerr.h \
140341825Sdimpkcs12.h \
141341825Sdimpkcs12err.h \
142321369Sdimpkcs7.h \
143353358Sdimpkcs7err.h \
144353358Sdimrand.h \
145353358Sdimrand_drbg.h \
146353358Sdimranderr.h \
147341825Sdimrc2.h \
148341825Sdimrc4.h \
149353358Sdimripemd.h \
150353358Sdimrsa.h \
151353358Sdimrsaerr.h \
152353358Sdimsafestack.h \
153353358Sdimseed.h \
154353358Sdimsha.h \
155353358Sdimsrp.h \
156353358Sdimsrtp.h \
157353358Sdimssl.h \
158353358Sdimssl2.h \
159353358Sdimssl3.h \
160341825Sdimsslerr.h \
161353358Sdimstack.h \
162353358Sdimstore.h \
163353358Sdimstoreerr.h \
164341825Sdimsymhacks.h \
165360784Sdimtls1.h \
166353358Sdimts.h \
167353358Sdimtserr.h \
168353358Sdimtxt_db.h \
169353358Sdimui.h \
170353358Sdimuierr.h \
171353358Sdimwhrlpool.h \
172341825Sdimx509.h \
173341825Sdimx509_vfy.h \
174341825Sdimx509err.h \
175321369Sdimx509v3.h \
176353358Sdimx509v3err.h
177353358Sdim
178353358Sdim# IDEA - patented, but we install the header anyways
179341825SdimINCS+=	idea.h
180321369Sdim
181341825Sdim# RC5 - patented, but we install the header anyways
182341825SdimINCS+=	rc5.h
183327952Sdim
184341825Sdim# MDC2 - patented, but we install the header anyways
185341825SdimINCS+=	mdc2.h
186341825Sdim
187341825Sdim.if (${USE_FIPS} != "no")
188341825Sdim# FIPS
189341825Sdim# This part is always included, because OpenSSL does not protect
190341825Sdim# The FIPS include files
191341825Sdim.PATH: ${OPENSSLSRC}/fips ${OPENSSLSRC}/fips/rand
192341825SdimINCS+=	fips.h fips_rand.h
193341825Sdim.endif
194321369Sdim
195341825Sdim.if (${USE_FIPS} != "no")
196341825SdimCPPFLAGS+=-DOPENSSL_FIPS
197321369Sdim.PATH: ${OPENSSLSRC}/fips/aes
198341825SdimSRCS+=fips_aes_core.c fips_aes_selftest.c
199321369Sdim.PATH: ${OPENSSLSRC}/fips/des
200341825SdimSRCS+=fips_des_enc.c fips_des_selftest.c fips_set_key.c
201341825Sdim# asm/fips-dx86-elf.s 
202341825Sdim.PATH: ${OPENSSLSRC}/fips/dh
203341825SdimSRCS+=fips_dh_check.c fips_dh_gen.c fips_dh_key.c
204341825Sdim.PATH: ${OPENSSLSRC}/fips/dsa
205341825SdimSRCS+=fips_dsa_ossl.c fips_dsa_gen.c fips_dsa_selftest.c
206341825Sdim#.PATH: ${OPENSSLSRC}/fips/rand
207341825SdimSRCS+=fips_rand.c
208321369Sdim.PATH: ${OPENSSLSRC}/fips/rsa
209321369SdimSRCS+=fips_rsa_eay.c fips_rsa_gen.c fips_rsa_selftest.c
210321369SdimSRCS+=fips_sha1dgst.c fips_sha1_selftest.c
211321369Sdim# asm/sx86-elf.s
212341825Sdim.PATH: ${OPENSSLSRC}/fips/sha1
213341825Sdim#.PATH: ${OPENSSLSRC}/fips
214341825SdimSRCS+=fips.c fips_err_wrapper.c
215341825Sdim
216341825SdimSRCS+=rc5_skey.c i_skey.c mdc2dgst.c
217341825Sdim.endif
218341825Sdim
219341825SdimCOPTS.eng_padlock.c = -Wno-stack-protector
220321369Sdim
221321369SdimINCSDIR=/usr/include/openssl
222353358Sdim
223341825SdimLDFLAGS+=-Wl,--version-script=${.CURDIR}/crypto.map
224341825Sdim
225341825SdimPKGCONFIG=libcrypto
226321369Sdim.include "${.CURDIR}/../../pkgconfig.mk"
227341825Sdim
228341825Sdim
229353358Sdim.include <bsd.lib.mk>
230353358Sdim
231353358Sdim