Skip to content

Commit 80443a1

Browse files
committed
ms-tpm-20-ref: inline BUILD variables.
Use DAMP not DRY rules. Bug: b/402294836
1 parent aa81f90 commit 80443a1

File tree

1 file changed

+72
-63
lines changed

1 file changed

+72
-63
lines changed

base/cvd/BUILD.ms-tpm-20-ref.bazel

Lines changed: 72 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,6 @@
11
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
22
load("@rules_cc//cc:cc_library.bzl", "cc_library")
33

4-
# From PLATFORM_INC in TPMCmd/Makefile.am
5-
PLATFORM_INC = [
6-
"TPMCmd/Platform/include",
7-
"TPMCmd/Platform/include/prototypes",
8-
]
9-
10-
# From SIMULATOR_INC in TPMCmd/Makefile.am
11-
SIMULATOR_INC = [
12-
"TPMCmd/Simulator/include",
13-
"TPMCmd/Simulator/include/prototypes",
14-
]
15-
16-
# From TPM_INC in TPMCmd/Makefile.am
17-
TPM_INC = [
18-
"TPMCmd/tpm/include",
19-
"TPMCmd/tpm/include/platform_interface",
20-
"TPMCmd/tpm/include/platform_interface/prototypes",
21-
"TPMCmd/tpm/include/private",
22-
"TPMCmd/tpm/include/private/prototypes",
23-
"TPMCmd/tpm/include/public",
24-
"TPMCmd/tpm/cryptolibs",
25-
"TPMCmd/tpm/cryptolibs/common/include",
26-
"TPMCmd/tpm/cryptolibs/Ossl/include",
27-
"TPMCmd/tpm/cryptolibs/TpmBigNum/include",
28-
"TPMCmd/TpmConfiguration",
29-
]
30-
31-
# From configure.ac
32-
DEFINES = [
33-
"HASH_LIB=Ossl",
34-
"SYM_LIB=Ossl",
35-
"MATH_LIB=TpmBigNum",
36-
"BN_MATH_LIB=Ossl",
37-
]
38-
39-
# From configure.ac
40-
COMPILER_FLAGS = [
41-
"-std=gnu11",
42-
"-Werror",
43-
"-Wall",
44-
"-Wformat-security",
45-
"-fstack-protector-all",
46-
"-fPIC",
47-
]
48-
49-
# From configure.ac
50-
LINK_FLAGS = [
51-
"-Wl,--no-undefined",
52-
"-Wl,-z,noexecstack",
53-
"-Wl,-z,now",
54-
"-Wl,-z,relro",
55-
]
56-
574
# Use the provided configuration, plus patches in build_external/ms-tpm-20-ref.
585
cc_library(
596
name = "tpm_configuration",
@@ -65,15 +12,23 @@ cc_library(
6512
cc_library(
6613
name = "platform_headers",
6714
srcs = glob(["TPMCmd/Platform/**/*.h"]),
68-
includes = PLATFORM_INC,
15+
# From PLATFORM_INC in TPMCmd/Makefile.am
16+
includes = [
17+
"TPMCmd/Platform/include",
18+
"TPMCmd/Platform/include/prototypes",
19+
],
6920
deps = [":tpm_configuration"],
7021
)
7122

7223
# From SIMULATOR_H in bootstrap
7324
cc_library(
7425
name = "simulator_headers",
7526
srcs = glob(["TPMCmd/Simulator/**/*.h"]),
76-
includes = SIMULATOR_INC,
27+
# From SIMULATOR_INC in TPMCmd/Makefile.am
28+
includes = [
29+
"TPMCmd/Simulator/include",
30+
"TPMCmd/Simulator/include/prototypes",
31+
],
7732
)
7833

7934
# From TPM_H in bootstrap; added .inl files
@@ -83,14 +38,39 @@ cc_library(
8338
"TPMCmd/tpm/**/*.h",
8439
"TPMCmd/tpm/**/*.inl",
8540
]),
86-
includes = TPM_INC,
41+
# From TPM_INC in TPMCmd/Makefile.am
42+
includes = [
43+
"TPMCmd/TpmConfiguration",
44+
"TPMCmd/tpm/cryptolibs",
45+
"TPMCmd/tpm/cryptolibs/Ossl/include",
46+
"TPMCmd/tpm/cryptolibs/TpmBigNum/include",
47+
"TPMCmd/tpm/cryptolibs/common/include",
48+
"TPMCmd/tpm/include",
49+
"TPMCmd/tpm/include/platform_interface",
50+
"TPMCmd/tpm/include/platform_interface/prototypes",
51+
"TPMCmd/tpm/include/private",
52+
"TPMCmd/tpm/include/private/prototypes",
53+
"TPMCmd/tpm/include/public",
54+
],
8755
)
8856

8957
cc_library(
9058
name = "platform",
9159
srcs = glob(["TPMCmd/Platform/**/*.c"]),
92-
copts = COMPILER_FLAGS,
93-
defines = DEFINES,
60+
copts = [
61+
"-std=gnu11",
62+
"-Werror",
63+
"-Wall",
64+
"-Wformat-security",
65+
"-fstack-protector-all",
66+
"-fPIC",
67+
],
68+
defines = [
69+
"HASH_LIB=Ossl",
70+
"SYM_LIB=Ossl",
71+
"MATH_LIB=TpmBigNum",
72+
"BN_MATH_LIB=Ossl",
73+
],
9474
deps = [
9575
":platform_headers",
9676
":tpm_headers",
@@ -100,8 +80,20 @@ cc_library(
10080
cc_library(
10181
name = "tpm",
10282
srcs = glob(["TPMCmd/tpm/**/*.c"]),
103-
copts = COMPILER_FLAGS,
104-
defines = DEFINES,
83+
copts = [
84+
"-std=gnu11",
85+
"-Werror",
86+
"-Wall",
87+
"-Wformat-security",
88+
"-fstack-protector-all",
89+
"-fPIC",
90+
],
91+
defines = [
92+
"HASH_LIB=Ossl",
93+
"SYM_LIB=Ossl",
94+
"MATH_LIB=TpmBigNum",
95+
"BN_MATH_LIB=Ossl",
96+
],
10597
deps = [
10698
":platform_headers",
10799
":tpm_headers",
@@ -113,9 +105,26 @@ cc_library(
113105
cc_binary(
114106
name = "simulator",
115107
srcs = glob(["TPMCmd/Simulator/**/*.c"]),
116-
copts = COMPILER_FLAGS,
117-
defines = DEFINES,
118-
linkopts = LINK_FLAGS,
108+
copts = [
109+
"-std=gnu11",
110+
"-Werror",
111+
"-Wall",
112+
"-Wformat-security",
113+
"-fstack-protector-all",
114+
"-fPIC",
115+
],
116+
defines = [
117+
"HASH_LIB=Ossl",
118+
"SYM_LIB=Ossl",
119+
"MATH_LIB=TpmBigNum",
120+
"BN_MATH_LIB=Ossl",
121+
],
122+
linkopts = [
123+
"-Wl,--no-undefined",
124+
"-Wl,-z,noexecstack",
125+
"-Wl,-z,now",
126+
"-Wl,-z,relro",
127+
],
119128
visibility = ["//visibility:public"],
120129
deps = [
121130
":platform",

0 commit comments

Comments
 (0)