1 | # $Id: Makefile.kmk 108206 2025-02-13 16:35:33Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the OpenSSL base directory.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox base platform packages, as
|
---|
10 | # available from https://www.alldomusa.eu.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 |
|
---|
28 | SUB_DEPTH = ../../..
|
---|
29 | include $(KBUILD_PATH)/subheader.kmk
|
---|
30 |
|
---|
31 | # Make sure our Config.kmk is included.
|
---|
32 | ifndef VBOX_PATH_CRYPTO
|
---|
33 | include $(PATH_SUB_CURRENT)/Config.kmk
|
---|
34 | endif
|
---|
35 |
|
---|
36 | # Include sub-makefiles.
|
---|
37 | include $(PATH_SUB_CURRENT)/providers/Makefile.kmk
|
---|
38 | include $(PATH_SUB_CURRENT)/crypto/Makefile.kmk
|
---|
39 | include $(PATH_SUB_CURRENT)/ssl/Makefile.kmk
|
---|
40 |
|
---|
41 | # Let kBuild generate the rules.
|
---|
42 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
43 |
|
---|
44 | #
|
---|
45 | # Re-creates certain openssl headers which exist as templates.
|
---|
46 | #
|
---|
47 | OSSL_HDR_TEMPLATES := \
|
---|
48 | $(PATH_SUB_CURRENT)/include/openssl/asn1.h.in \
|
---|
49 | $(PATH_SUB_CURRENT)/include/openssl/asn1t.h.in \
|
---|
50 | $(PATH_SUB_CURRENT)/include/openssl/bio.h.in \
|
---|
51 | $(PATH_SUB_CURRENT)/include/openssl/cmp.h.in \
|
---|
52 | $(PATH_SUB_CURRENT)/include/openssl/cms.h.in \
|
---|
53 | $(PATH_SUB_CURRENT)/include/openssl/conf.h.in \
|
---|
54 | $(PATH_SUB_CURRENT)/include/openssl/configuration.h.in \
|
---|
55 | $(PATH_SUB_CURRENT)/include/openssl/core_names.h.in \
|
---|
56 | $(PATH_SUB_CURRENT)/include/openssl/crmf.h.in \
|
---|
57 | $(PATH_SUB_CURRENT)/include/openssl/crypto.h.in \
|
---|
58 | $(PATH_SUB_CURRENT)/include/openssl/ct.h.in \
|
---|
59 | $(PATH_SUB_CURRENT)/include/openssl/err.h.in \
|
---|
60 | $(PATH_SUB_CURRENT)/include/openssl/ess.h.in \
|
---|
61 | $(PATH_SUB_CURRENT)/include/openssl/fipskey.h.in \
|
---|
62 | $(PATH_SUB_CURRENT)/include/openssl/lhash.h.in \
|
---|
63 | $(PATH_SUB_CURRENT)/include/openssl/opensslv.h.in \
|
---|
64 | $(PATH_SUB_CURRENT)/include/openssl/ocsp.h.in \
|
---|
65 | $(PATH_SUB_CURRENT)/include/openssl/pkcs12.h.in \
|
---|
66 | $(PATH_SUB_CURRENT)/include/openssl/pkcs7.h.in \
|
---|
67 | $(PATH_SUB_CURRENT)/include/openssl/safestack.h.in \
|
---|
68 | $(PATH_SUB_CURRENT)/include/openssl/srp.h.in \
|
---|
69 | $(PATH_SUB_CURRENT)/include/openssl/ssl.h.in \
|
---|
70 | $(PATH_SUB_CURRENT)/include/openssl/ui.h.in \
|
---|
71 | $(PATH_SUB_CURRENT)/include/openssl/x509.h.in \
|
---|
72 | $(PATH_SUB_CURRENT)/include/openssl/x509_vfy.h.in \
|
---|
73 | $(PATH_SUB_CURRENT)/include/openssl/x509v3.h.in
|
---|
74 |
|
---|
75 | #
|
---|
76 | # Big fat @todo:
|
---|
77 | # I'm too stupid atm to figure out how to get this executed sequentially
|
---|
78 | # instead of getting it expanded and executed at once...
|
---|
79 | #
|
---|
80 | recreate-headers: $(PATH_SUB_CURRENT)/util/dofile.pl \
|
---|
81 | $(OSSL_HDR_TEMPLATES) \
|
---|
82 | recreate-crypto-sources \
|
---|
83 | recreate-internal-headers \
|
---|
84 | recreate-providers-headers
|
---|
85 | $(foreach header, $(OSSL_HDR_TEMPLATES), \
|
---|
86 | perl -I$(PATH_SUB_CURRENT) \
|
---|
87 | -Mconfigdata $(PATH_SUB_CURRENT)/util/dofile.pl -oMakefile \
|
---|
88 | $(header) > $(PATH_SUB_CURRENT)/gen-includes/openssl/$(basename $(notdir $(header)));))
|
---|
89 |
|
---|
90 | # At the moment there is a single template in include/internal, hence no list nor for loop
|
---|
91 | recreate-internal-headers: $(PATH_SUB_CURRENT)/util/dofile.pl
|
---|
92 | perl -I$(PATH_SUB_CURRENT) \
|
---|
93 | -Mconfigdata $(PATH_SUB_CURRENT)/util/dofile.pl -oMakefile \
|
---|
94 | $(PATH_SUB_CURRENT)/include/internal/param_names.h.in > $(PATH_SUB_CURRENT)/gen-includes/internal/param_names.h
|
---|
95 |
|
---|
96 | #
|
---|
97 | # How to regenerate the openssl-mangling.h
|
---|
98 | #
|
---|
99 | openssl-mangling.h openssl-mangling-new.h: $(VBox-libcrypto_1_TARGET) $(VBox-libssl_1_TARGET) FORCE
|
---|
100 | $(RM) -f -- $@
|
---|
101 | $(APPEND_EXT) -tn $@ \
|
---|
102 | '/* $(DOLLAR)Id: $(DOLLAR) */' \
|
---|
103 | "/** @file" \
|
---|
104 | " * Autogenerate symbol mangling header for openssl." \
|
---|
105 | " */" \
|
---|
106 | "" \
|
---|
107 | "/*" \
|
---|
108 | " * Copyright (C) 2011$(if-expr $(date %Y) > 2011,-$(date %Y),) Oracle and/or its affiliates." \
|
---|
109 | " *" \
|
---|
110 | " * This file is part of VirtualBox base platform packages, as" \
|
---|
111 | " * available from https://www.alldomusa.eu.org." \
|
---|
112 | " *" \
|
---|
113 | " * This program is free software; you can redistribute it and/or" \
|
---|
114 | " * modify it under the terms of the GNU General Public License" \
|
---|
115 | " * as published by the Free Software Foundation, in version 3 of the" \
|
---|
116 | " * License." \
|
---|
117 | " *" \
|
---|
118 | " * This program is distributed in the hope that it will be useful, but" \
|
---|
119 | " * WITHOUT ANY WARRANTY; without even the implied warranty of" \
|
---|
120 | " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU" \
|
---|
121 | " * General Public License for more details." \
|
---|
122 | " *" \
|
---|
123 | " * You should have received a copy of the GNU General Public License" \
|
---|
124 | " * along with this program; if not, see <https://www.gnu.org/licenses>." \
|
---|
125 | " *" \
|
---|
126 | " * SPDX-License-Identifier: GPL-3.0-only" \
|
---|
127 | " */" \
|
---|
128 | "" \
|
---|
129 | "#ifndef ___openssl_mangling_h___" \
|
---|
130 | "#define ___openssl_mangling_h___" \
|
---|
131 | "# ifdef VBOX_IN_EXTPACK" \
|
---|
132 | "# define OPENSSL_MANGLER(a_Name) OracleExtPack_ ## a_Name" \
|
---|
133 | "# define OPENSSL_MANGLER_ASM(a_Name) _OracleExtPack_ ## a_Name" \
|
---|
134 | "# else" \
|
---|
135 | "# define OPENSSL_MANGLER(a_Name) VBox_ ## a_Name" \
|
---|
136 | "# define OPENSSL_MANGLER_ASM(a_Name) _VBox_ ## a_Name" \
|
---|
137 | "# endif"
|
---|
138 | nm $(filter-out FORCE, $+) \
|
---|
139 | | $(SED) \
|
---|
140 | -e '/^[[:xdigit:]][[:xdigit:]]* [TSDBC] /!d' \
|
---|
141 | -e '/\.eh$(DOLLAR)/d' \
|
---|
142 | -e 's/^[^ ]* [TSDBC] $(if $(intersects $(KBUILD_TARGET), darwin os2 win),_,)\([[:alpha:]_].*\)/\1/' \
|
---|
143 | -e 's/[[:space:]]*//g' \
|
---|
144 | -e 's/^VBox_//' \
|
---|
145 | | sort \
|
---|
146 | | $(SED) -e 's/^\(.*\)$(DOLLAR)/#ifndef OPENSSL_MANGLE_ASM\n# ifndef \1\n# define \1 OPENSSL_MANGLER(\1)\n# endif\n#else\n# ifndef _\1\n# define _\1 OPENSSL_MANGLER_ASM(\1)\n# endif\n#endif/' --append-text $@
|
---|
147 | $(APPEND_EXT) -n $@ \
|
---|
148 | "#endif" \
|
---|
149 | ""
|
---|
150 |
|
---|
151 | #
|
---|
152 | # Lists unmangled symbols.
|
---|
153 | #
|
---|
154 | .PHONY: check-openssl-mangling
|
---|
155 | check-openssl-mangling: \
|
---|
156 | $(VBox-libcrypto_1_TARGET) \
|
---|
157 | $(VBox-libssl_1_TARGET) \
|
---|
158 | $(VBoxExtPack-libcrypto_1_TARGET) \
|
---|
159 | $(VBoxExtPack-libssl_1_TARGET) FORCE
|
---|
160 | nm $(VBox-libcrypto_1_TARGET) $(VBox-libssl_1_TARGET) \
|
---|
161 | | $(SED) \
|
---|
162 | -e '/^[[:xdigit:]][[:xdigit:]]* [TSDBC] /!d' \
|
---|
163 | -e 's/^[^ ]* [TSDBC] $(if $(intersects $(KBUILD_TARGET), darwin os2 win),_,)\([[:alpha:]_].*\)/\1/' \
|
---|
164 | -e 's/[[:space:]]*//g' \
|
---|
165 | -e '/^VBox_/d' \
|
---|
166 | | sort
|
---|
167 | nm $(VBoxExtPack-libcrypto_1_TARGET) $(VBoxExtPack-libssl_1_TARGET) \
|
---|
168 | | $(SED) \
|
---|
169 | -e '/^[[:xdigit:]][[:xdigit:]]* [TSDBC] /!d' \
|
---|
170 | -e 's/^[^ ]* [TSDBC] $(if $(intersects $(KBUILD_TARGET), darwin os2 win),_,)\([[:alpha:]_].*\)/\1/' \
|
---|
171 | -e 's/[[:space:]]*//g' \
|
---|
172 | -e '/^OracleExtPack_/d' \
|
---|
173 | | sort
|
---|