1 | # $Id: Makefile.kmk 127528 2018-12-17 11:52:21Z michael $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for OpenSSL crypto.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2019 Oracle Corporation
|
---|
8 | #
|
---|
9 | # Oracle Corporation confidential
|
---|
10 | # All rights reserved
|
---|
11 | #
|
---|
12 |
|
---|
13 | SUB_DEPTH = ../../../..
|
---|
14 | include $(KBUILD_PATH)/subheader.kmk
|
---|
15 |
|
---|
16 | #
|
---|
17 | # Include sub-makefiles.
|
---|
18 | #
|
---|
19 | # Note! For joining the sub libraries into a crypto lib, we do some trickery to
|
---|
20 | # collect the sub-library names here.
|
---|
21 | #
|
---|
22 | VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS := $(LIBRARIES)
|
---|
23 | if defined(VBOX_ONLY_VALIDATIONKIT)
|
---|
24 | include $(VBOX_PATH_CRYPTO)/sha/Makefile.kmk
|
---|
25 | else
|
---|
26 | include $(sort $(wildcard $(VBOX_PATH_CRYPTO)/*/Makefile.kmk))
|
---|
27 | endif
|
---|
28 | VBOX_CRYPTO_SUBLIBS := $(filter-out $(VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS), $(LIBRARIES))
|
---|
29 | VBOX_CRYPTO_SUBLIBS_X86 := $(filter %-x86, $(VBOX_CRYPTO_SUBLIBS))
|
---|
30 | VBOX_CRYPTO_SUBLIBS := $(filter-out %-x86, $(VBOX_CRYPTO_SUBLIBS))
|
---|
31 | if defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS)
|
---|
32 | $(eval LIBRARIES = $(VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS) crypto_sha)
|
---|
33 | else if "$(SDK_VBOX_OPENSSL_INCS)" != "$(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)"
|
---|
34 | $(eval LIBRARIES = $(VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS))
|
---|
35 | endif
|
---|
36 | VBOX_LIBRARIES_BEFORE_CRYPTO_SUBDIRS :=
|
---|
37 |
|
---|
38 |
|
---|
39 | #
|
---|
40 | # The VBoxRT libcrypto.
|
---|
41 | #
|
---|
42 | LIBRARIES += VBox-libcrypto
|
---|
43 | VBox-libcrypto_TEMPLATE = LIBCRYPTO
|
---|
44 | VBox-libcrypto_INCS = $(VBox-libcrypto_0_OUTDIR)
|
---|
45 | VBox-libcrypto_SOURCES = \
|
---|
46 | cpt_err.c \
|
---|
47 | cryptlib.c \
|
---|
48 | ctype.c \
|
---|
49 | cversion.c \
|
---|
50 | ebcdic.c \
|
---|
51 | ex_data.c \
|
---|
52 | getenv.c \
|
---|
53 | init.c \
|
---|
54 | mem.c \
|
---|
55 | mem_dbg.c \
|
---|
56 | mem_sec.c \
|
---|
57 | o_dir.c \
|
---|
58 | o_fips.c \
|
---|
59 | o_fopen.c \
|
---|
60 | o_init.c \
|
---|
61 | o_str.c \
|
---|
62 | o_time.c \
|
---|
63 | uid.c \
|
---|
64 | threads_iprt.c
|
---|
65 |
|
---|
66 | ifdef VBOX_WITH_CRYPTO_ASM
|
---|
67 | VBox-libcrypto_DEFS.x86 += OPENSSL_CPUID_OBJ=x86cpuid.o
|
---|
68 | VBox-libcrypto_SOURCES.x86 += $(VBOX_PATH_CRYPTO_GENASM)/x86cpuid.S
|
---|
69 | VBox-libcrypto_DEFS.amd64 += OPENSSL_CPUID_OBJ=x86_64cpuid.o
|
---|
70 | VBox-libcrypto_SOURCES.amd64 += $(VBOX_PATH_CRYPTO_GENASM)/x86_64cpuid.S
|
---|
71 | else
|
---|
72 | VBox-libcrypto_SOURCES += mem_clr.c
|
---|
73 | endif
|
---|
74 |
|
---|
75 | ifdef VBOX_WITH_OPENSSL_FIPS
|
---|
76 | VBox-libcrypto_SOURCES += o_fips.c fips_ers.c
|
---|
77 | endif
|
---|
78 |
|
---|
79 | if defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS)
|
---|
80 | VBox-libcrypto_SOURCES += $(crypto_sha_1_TARGET)
|
---|
81 | else if "$(SDK_VBOX_OPENSSL_INCS)" == "$(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)"
|
---|
82 | VBox-libcrypto_SOURCES += $(foreach sublib,$(VBOX_CRYPTO_SUBLIBS), $($(sublib)_1_TARGET))
|
---|
83 | endif
|
---|
84 |
|
---|
85 | VBox-libcrypto_CLEAN = $(VBox-libcrypto_0_OUTDIR)/buildinf.h
|
---|
86 | VBox-libcrypto_INTERMEDIATES = $(VBox-libcrypto_0_OUTDIR)/buildinf.h
|
---|
87 |
|
---|
88 |
|
---|
89 | ifdef VBOX_WITH_32_ON_64_MAIN_API # 32-bit edition.
|
---|
90 | LIBRARIES += VBox-libcrypto-x86
|
---|
91 | VBox-libcrypto-x86_TEMPLATE = VBoxLibCrypto-x86
|
---|
92 | VBox-libcrypto-x86_EXTENDS = VBox-libcrypto
|
---|
93 | VBox-libcrypto-x86_SOURCES = $(filter %.c %.cpp,$(VBox-libcrypto_SOURCES)) \
|
---|
94 | $(foreach sublib,$(VBOX_CRYPTO_SUBLIBS_X86), $($(sublib)_1_TARGET))
|
---|
95 | endif
|
---|
96 |
|
---|
97 |
|
---|
98 | ifdef VBOX_NEED_EXTPACK_OPENSSL
|
---|
99 | #
|
---|
100 | # The extension pack libcrypto.
|
---|
101 | #
|
---|
102 | LIBRARIES += VBoxExtPack-libcrypto
|
---|
103 | VBoxExtPack-libcrypto = For the Oracle Extension Pack
|
---|
104 | VBoxExtPack-libcrypto_EXTENDS = VBox-libcrypto
|
---|
105 | VBoxExtPack-libcrypto_DEFS = $(VBox-libcrypto_DEFS) VBOX_IN_EXTPACK
|
---|
106 | VBoxExtPack-libcrypto_SOURCES = \
|
---|
107 | $(filter %.c %.cpp,$(VBox-libcrypto_SOURCES)) \
|
---|
108 | $(foreach sublib,$(VBOX_CRYPTO_SUBLIBS), $(VBoxExtPack-$(sublib)_1_TARGET))
|
---|
109 | define def_VBoxExtPack_libcrypto_inherit
|
---|
110 | LIBRARIES += VBoxExtPack-$(sublib)
|
---|
111 | VBoxExtPack-$(sublib) = Oracle Extension Pack version of $(sublib)
|
---|
112 | VBoxExtPack-$(sublib)_EXTENDS = $(sublib)
|
---|
113 | VBoxExtPack-$(sublib)_EXTENDS_BY = appending
|
---|
114 | VBoxExtPack-$(sublib)_DEFS = VBOX_IN_EXTPACK
|
---|
115 | VBoxExtPack-$(sublib)_DEFPATH = $($(sublib)_DEFPATH)
|
---|
116 | ## @todo kBuild: DEFPATH isn't inherited! FIXME!
|
---|
117 | endef
|
---|
118 | $(foreach sublib,$(VBOX_CRYPTO_SUBLIBS), $(eval $(def_VBoxExtPack_libcrypto_inherit)))
|
---|
119 |
|
---|
120 | endif # VBOX_NEED_EXTPACK_OPENSSL
|
---|
121 |
|
---|
122 |
|
---|
123 | #
|
---|
124 | # ...
|
---|
125 | #
|
---|
126 | recreate-openssl-asm: $(VBOX_PATH_CRYPTO)/perlasm/x86asm.pl \
|
---|
127 | $(VBOX_PATH_CRYPTO)/x86cpuid.pl \
|
---|
128 | $(VBOX_PATH_CRYPTO)/x86_64cpuid.pl \
|
---|
129 | recreate-aes-asm \
|
---|
130 | recreate-bn-asm \
|
---|
131 | recreate-chacha-asm \
|
---|
132 | recreate-ec-asm \
|
---|
133 | recreate-md5-asm \
|
---|
134 | recreate-modes-asm \
|
---|
135 | recreate-rc4-asm \
|
---|
136 | recreate-sha-asm
|
---|
137 | perl $(VBOX_PATH_CRYPTO)/x86cpuid.pl elf -fPIC $(VBOX_PATH_CRYPTO)/genasm-elf/x86cpuid.S
|
---|
138 | perl $(VBOX_PATH_CRYPTO)/x86_64cpuid.pl elf $(VBOX_PATH_CRYPTO)/genasm-elf/x86_64cpuid.S
|
---|
139 | perl $(VBOX_PATH_CRYPTO)/x86cpuid.pl macosx $(VBOX_PATH_CRYPTO)/genasm-macosx/x86cpuid.S
|
---|
140 | perl $(VBOX_PATH_CRYPTO)/x86_64cpuid.pl macosx $(VBOX_PATH_CRYPTO)/genasm-macosx/x86_64cpuid.S
|
---|
141 | perl $(VBOX_PATH_CRYPTO)/x86cpuid.pl win32n $(VBOX_PATH_CRYPTO)/genasm-nasm/x86cpuid.S
|
---|
142 | perl $(VBOX_PATH_CRYPTO)/x86_64cpuid.pl nasm $(VBOX_PATH_CRYPTO)/genasm-nasm/x86_64cpuid.S
|
---|
143 |
|
---|
144 |
|
---|
145 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
146 |
|
---|
147 |
|
---|
148 | #
|
---|
149 | # Generate
|
---|
150 | #
|
---|
151 | $(VBox-libcrypto_0_OUTDIR)/buildinf.h: $(VBOX_PATH_CRYPTO)/Makefile.kmk | $$(dir $$@)
|
---|
152 | $(call MSG_GENERATE,,$@)
|
---|
153 | $(QUIET)$(RM) -f $@
|
---|
154 | $(QUIET)$(APPEND) $@ '/* auto-generated by crypto/Makefile.kmk for crypto/cversion.c */'
|
---|
155 | $(QUIET)$(APPEND) $@ '#ifndef MK1MF_BUILD'
|
---|
156 | $(QUIET)$(APPEND) $@ '# define PLATFORM "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"'
|
---|
157 | $(QUIET)$(APPEND) $@ '# define DATE "$(date-utc )"'
|
---|
158 | $(QUIET)$(APPEND) $@ 'static const char compiler_flags[] ='
|
---|
159 | $(QUIET)$(APPEND) $@ ' "$(VBox-libcrypto_CFLAGS)";'
|
---|
160 | $(QUIET)$(APPEND) $@ '#endif'
|
---|
161 |
|
---|