xref: /aosp_15_r20/external/ms-tpm-20-ref/Android.bp (revision 5c591343844d1f9da7da26467c4bf7efc8a7a413)
1// Copyright (C) 2020 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
16//     CONSULT THE OWNERS AND [email protected] BEFORE
17//     DEPENDING ON IT IN YOUR PROJECT. ***
18package {
19    default_applicable_licenses: ["external_ms-tpm-20-ref_license"],
20}
21
22// Added automatically by a large-scale-change that took the approach of
23// 'apply every license found to every target'. While this makes sure we respect
24// every license restriction, it may not be entirely correct.
25//
26// e.g. GPL in an MIT project might only apply to the contrib/ directory.
27//
28// Please consider splitting the single license below into multiple licenses,
29// taking care not to lose any license_kind information, and overriding the
30// default license using the 'licenses: [...]' property on targets as needed.
31//
32// For unused files, consider creating a 'fileGroup' with "//visibility:private"
33// to attach the license to, and including a comment whether the files may be
34// used in the current project.
35// See: http://go/android-license-faq
36license {
37    name: "external_ms-tpm-20-ref_license",
38    visibility: [":__subpackages__"],
39    license_kinds: [
40        "SPDX-license-identifier-BSD",
41        "SPDX-license-identifier-GPL-2.0",
42        "SPDX-license-identifier-MIT",
43        "legacy_by_exception_only", // by exception only
44    ],
45    license_text: [
46        "LICENSE",
47    ],
48}
49
50cc_defaults {
51    name: "ms-tpm-20-ref-defaults",
52    local_include_dirs: [
53        "TPMCmd/Platform/include",
54        "TPMCmd/Platform/include/prototypes",
55        "TPMCmd/Simulator/include",
56        "TPMCmd/Simulator/include/prototypes",
57        "TPMCmd/tpm/include",
58        "TPMCmd/tpm/include/Ossl",
59        "TPMCmd/tpm/include/prototypes",
60    ],
61    device_supported: false,
62    host_supported: true,
63    shared_libs: [
64        "libcrypto",
65    ],
66    cflags: [
67        "-DMAX_SYM_DATA=256",
68        "-DDEBUG=YES",
69        "-DUSE_DEBUG_RNG=NO",
70        "-DALG_CAMELLIA=ALG_NO",
71        "-Wno-logical-op-parentheses",
72        "-Wno-empty-body",
73        "-Wno-missing-field-initializers",
74        "-Wno-unused-parameter",
75        "-Wno-typedef-redefinition",
76    ],
77    target: {
78        darwin: {
79            enabled: true,
80        },
81    },
82}
83
84cc_library_static {
85    name: "ms-tpm-20-ref-lib",
86    srcs: [
87        "TPMCmd/Platform/src/*.c",
88        "TPMCmd/Simulator/src/TPMCmdp.c",
89        "TPMCmd/Simulator/src/TcpServer.c",
90        "TPMCmd/tpm/src/command/**/*.c",
91        "TPMCmd/tpm/src/crypt/*.c",
92        "TPMCmd/tpm/src/crypt/ossl/*.c",
93        "TPMCmd/tpm/src/events/*.c",
94        "TPMCmd/tpm/src/main/*.c",
95        "TPMCmd/tpm/src/subsystem/*.c",
96        "TPMCmd/tpm/src/support/*.c",
97        "TPMCmd/tpm/src/X509/*.c",
98    ],
99    export_include_dirs: [
100        "TPMCmd/Platform/include",
101        "TPMCmd/Platform/include/prototypes",
102        "TPMCmd/Simulator/include",
103        "TPMCmd/Simulator/include/prototypes",
104        "TPMCmd/tpm/include",
105        "TPMCmd/tpm/include/Ossl",
106        "TPMCmd/tpm/include/prototypes",
107    ],
108    target: {
109        windows: {
110            enabled: true,
111            cflags: [
112                "-Wno-unknown-pragmas",
113            ],
114            host_ldlibs: [
115                "-lws2_32",
116            ],
117        },
118    },
119    defaults: [ "ms-tpm-20-ref-defaults" ],
120}
121
122cc_binary_host {
123    name: "ms-tpm-20-ref",
124    srcs: [
125        "TPMCmd/Simulator/src/TPMCmds.c",
126    ],
127    static_libs: [
128        "ms-tpm-20-ref-lib",
129    ],
130    defaults: [ "ms-tpm-20-ref-defaults" ],
131}
132