VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.3/crypto/Makefile.kmk@ 96662

Last change on this file since 96662 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 7.4 KB
Line 
1# $Id: Makefile.kmk 96407 2022-08-22 17:43:14Z vboxsync $
2## @file
3# Sub-Makefile for OpenSSL crypto.
4#
5
6#
7# Copyright (C) 2006-2022 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# SPDX-License-Identifier: GPL-3.0-only
26#
27
28SUB_DEPTH = ../../../..
29include $(KBUILD_PATH)/subheader.kmk
30
31#
32# Include sub-makefiles.
33#
34# Note! For joining the sub libraries into a crypto lib, we do some trickery to
35# collect the sub-library names here.
36#
37VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS := $(LIBRARIES)
38if defined(VBOX_ONLY_VALIDATIONKIT) && !defined(VBOX_WITH_VALIDATIONKIT_UNITTESTS_PACKING)
39 include $(VBOX_PATH_CRYPTO)/sha/Makefile.kmk
40else # Validation Kit unit tests need this.
41 include $(sort $(wildcard $(VBOX_PATH_CRYPTO)/*/Makefile.kmk))
42endif
43VBOX_CRYPTO_SUBLIBS := $(filter-out $(VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS), $(LIBRARIES))
44VBOX_CRYPTO_SUBLIBS_X86 := $(filter %-x86, $(VBOX_CRYPTO_SUBLIBS))
45VBOX_CRYPTO_SUBLIBS := $(filter-out %-x86, $(VBOX_CRYPTO_SUBLIBS))
46if defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS)
47 $(eval LIBRARIES = $(VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS) crypto_sha)
48else if "$(SDK_VBOX_OPENSSL_INCS)" != "$(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)"
49 $(eval LIBRARIES = $(VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS))
50endif
51VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS :=
52
53
54#
55# The VBoxRT libcrypto.
56#
57LIBRARIES += VBox-libcrypto
58VBox-libcrypto_TEMPLATE = LIBCRYPTO
59VBox-libcrypto_INCS = $(VBox-libcrypto_0_OUTDIR)
60VBox-libcrypto_SOURCES = \
61 asn1_dsa.c \
62 bsearch.c \
63 context.c \
64 core_algorithm.c \
65 core_fetch.c \
66 core_namemap.c \
67 cpt_err.c \
68 cpuid.c \
69 cryptlib.c \
70 ctype.c \
71 cversion.c \
72 der_writer.c \
73 ebcdic.c \
74 ex_data.c \
75 getenv.c \
76 info.c \
77 init.c \
78 initthread.c \
79 mem.c \
80 mem_sec.c \
81 o_dir.c \
82 o_fopen.c \
83 o_init.c \
84 o_str.c \
85 o_time.c \
86 packet.c \
87 param_build.c \
88 param_build_set.c \
89 params.c \
90 params_dup.c \
91 params_from_text.c \
92 passphrase.c \
93 provider.c \
94 provider_child.c \
95 provider_conf.c \
96 provider_core.c \
97 provider_predefined.c \
98 punycode.c \
99 self_test_core.c \
100 sparse_array.c \
101 threads_iprt.c \
102 trace.c \
103 uid.c
104
105ifdef VBOX_WITH_CRYPTO_ASM
106 VBox-libcrypto_DEFS.x86 += OPENSSL_CPUID_OBJ=x86cpuid.o
107 VBox-libcrypto_SOURCES.x86 += $(VBOX_PATH_CRYPTO_GENASM)/x86cpuid.S
108 VBox-libcrypto_DEFS.amd64 += OPENSSL_CPUID_OBJ=x86_64cpuid.o
109 VBox-libcrypto_SOURCES.amd64 += $(VBOX_PATH_CRYPTO_GENASM)/x86_64cpuid.S
110else
111 VBox-libcrypto_SOURCES += mem_clr.c
112endif
113
114ifdef VBOX_WITH_OPENSSL_FIPS
115 VBox-libcrypto_SOURCES += o_fips.c fips_ers.c
116endif
117
118VBox-libcrypto_SOURCES += $(PATH_STAGE_LIB)/VBox-libproviders$(VBOX_SUFF_LIB)
119
120if defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS)
121 VBox-libcrypto_SOURCES += $(crypto_sha_1_TARGET)
122else if "$(SDK_VBOX_OPENSSL_INCS)" == "$(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)"
123 VBox-libcrypto_SOURCES += $(foreach sublib,$(VBOX_CRYPTO_SUBLIBS), $($(sublib)_1_TARGET))
124endif
125
126VBox-libcrypto_CLEAN = $(VBox-libcrypto_0_OUTDIR)/buildinf.h
127VBox-libcrypto_INTERMEDIATES = $(VBox-libcrypto_0_OUTDIR)/buildinf.h
128
129
130ifdef VBOX_WITH_32_ON_64_MAIN_API # 32-bit edition.
131 LIBRARIES += VBox-libcrypto-x86
132 VBox-libcrypto-x86_TEMPLATE = VBoxLibCrypto-x86
133 VBox-libcrypto-x86_EXTENDS = VBox-libcrypto
134 VBox-libcrypto-x86_SOURCES = $(filter %.c %.cpp,$(VBox-libcrypto_SOURCES)) \
135 $(PATH_STAGE_LIB)/VBox-libproviders-x86$(VBOX_SUFF_LIB) \
136 $(foreach sublib,$(VBOX_CRYPTO_SUBLIBS_X86), $($(sublib)_1_TARGET))
137endif
138
139
140if defined(VBOX_NEED_EXTPACK_OPENSSL) && !defined(VBOX_ONLY_VALIDATIONKIT) # Not needed for Validation Kit.
141#
142# The extension pack libcrypto.
143#
144LIBRARIES += VBoxExtPack-libcrypto
145VBoxExtPack-libcrypto = For the Oracle Extension Pack
146VBoxExtPack-libcrypto_EXTENDS = VBox-libcrypto
147VBoxExtPack-libcrypto_DEFS = $(VBox-libcrypto_DEFS) VBOX_IN_EXTPACK
148VBoxExtPack-libcrypto_SOURCES = \
149 $(filter %.c %.cpp,$(VBox-libcrypto_SOURCES)) \
150 $(foreach sublib,$(VBOX_CRYPTO_SUBLIBS), $(VBoxExtPack-$(sublib)_1_TARGET))
151define def_VBoxExtPack_libcrypto_inherit
152 LIBRARIES += VBoxExtPack-$(sublib)
153 VBoxExtPack-$(sublib) = Oracle Extension Pack version of $(sublib)
154 VBoxExtPack-$(sublib)_EXTENDS = $(sublib)
155 VBoxExtPack-$(sublib)_EXTENDS_BY = appending
156 VBoxExtPack-$(sublib)_DEFS = VBOX_IN_EXTPACK
157 VBoxExtPack-$(sublib)_DEFPATH = $($(sublib)_DEFPATH)
158 ## @todo kBuild: DEFPATH isn't inherited! FIXME!
159endef
160$(foreach sublib,$(VBOX_CRYPTO_SUBLIBS), $(eval $(def_VBoxExtPack_libcrypto_inherit)))
161
162endif # VBOX_NEED_EXTPACK_OPENSSL
163
164
165ifdef VBOX_WITH_BLD_RTSIGNTOOL_SIGNING
166#
167# The build program libcrypto version.
168#
169LIBRARIES += VBoxBldProg-libcrypto
170VBoxBldProg-libcrypto = For bldRTSignTool
171VBoxBldProg-libcrypto_EXTENDS = VBox-libcrypto
172VBoxBldProg-libcrypto_TEMPLATE = VBoxLibCryptoBldProg
173VBoxBldProg-libcrypto_DEFS = $(VBox-libcrypto_DEFS)
174VBoxBldProg-libcrypto_SOURCES = \
175 $(filter %.c %.cpp,$(VBox-libcrypto_SOURCES)) \
176 $(PATH_STAGE_LIB)/VBoxBldProg-libproviders$(VBOX_SUFF_LIB) \
177 $(foreach sublib,$(VBOX_CRYPTO_SUBLIBS), $(VBoxBldProg-$(sublib)_1_TARGET))
178define def_VBoxBldProg_libcrypto_inherit
179 LIBRARIES += VBoxBldProg-$(sublib)
180 VBoxBldProg-$(sublib) = bldRTSignTool version of $(sublib)
181 VBoxBldProg-$(sublib)_EXTENDS = $(sublib)
182 VBoxBldProg-$(sublib)_EXTENDS_BY = appending
183 VBoxBldProg-$(sublib)_TEMPLATE = VBoxSubLibCryptoBldProg
184 VBoxBldProg-$(sublib)_DEFPATH = $($(sublib)_DEFPATH)
185 ## @todo kBuild: DEFPATH isn't inherited! FIXME!
186endef
187$(foreach sublib,$(VBOX_CRYPTO_SUBLIBS), $(eval $(def_VBoxBldProg_libcrypto_inherit)))
188
189endif # VBOX_WITH_BLD_RTSIGNTOOL_SIGNING
190
191
192#
193# ...
194#
195recreate-openssl-asm: $(VBOX_PATH_CRYPTO)/perlasm/x86asm.pl \
196 $(VBOX_PATH_CRYPTO)/x86cpuid.pl \
197 $(VBOX_PATH_CRYPTO)/x86_64cpuid.pl \
198 recreate-aes-asm \
199 recreate-bn-asm \
200 recreate-chacha-asm \
201 recreate-ec-asm \
202 recreate-md5-asm \
203 recreate-modes-asm \
204 recreate-poly1305-asm \
205 recreate-rc4-asm \
206 recreate-sha-asm
207 perl $(VBOX_PATH_CRYPTO)/x86cpuid.pl elf -fPIC $(VBOX_PATH_CRYPTO)/genasm-elf/x86cpuid.S
208 perl $(VBOX_PATH_CRYPTO)/x86_64cpuid.pl elf $(VBOX_PATH_CRYPTO)/genasm-elf/x86_64cpuid.S
209 perl $(VBOX_PATH_CRYPTO)/x86cpuid.pl macosx $(VBOX_PATH_CRYPTO)/genasm-macosx/x86cpuid.S
210 perl $(VBOX_PATH_CRYPTO)/x86_64cpuid.pl macosx $(VBOX_PATH_CRYPTO)/genasm-macosx/x86_64cpuid.S
211 perl $(VBOX_PATH_CRYPTO)/x86cpuid.pl win32n $(VBOX_PATH_CRYPTO)/genasm-nasm/x86cpuid.S
212 perl $(VBOX_PATH_CRYPTO)/x86_64cpuid.pl nasm $(VBOX_PATH_CRYPTO)/genasm-nasm/x86_64cpuid.S
213
214
215include $(FILE_KBUILD_SUB_FOOTER)
216
217
218#
219# Generate
220#
221$(VBox-libcrypto_0_OUTDIR)/buildinf.h: $(VBOX_PATH_CRYPTO)/Makefile.kmk | $$(dir $$@)
222 $(call MSG_GENERATE,,$@)
223 $(QUIET)$(RM) -f $@
224 $(QUIET)$(APPEND) $@ '/* auto-generated by crypto/Makefile.kmk for crypto/cversion.c */'
225 $(QUIET)$(APPEND) $@ '#ifndef MK1MF_BUILD'
226 $(QUIET)$(APPEND) $@ '# define PLATFORM "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"'
227 $(QUIET)$(APPEND) $@ '# define DATE "$(date-utc )"'
228 $(QUIET)$(APPEND) $@ 'static const char compiler_flags[] ='
229 $(QUIET)$(APPEND) $@ ' "$(VBox-libcrypto_CFLAGS)";'
230 $(QUIET)$(APPEND) $@ '#endif'
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette