Adam Langley | 0186787 | 2016-06-30 14:16:59 -0700 | [diff] [blame] | 1 | # Copyright (c) 2016, Google Inc. |
| 2 | # |
| 3 | # Permission to use, copy, modify, and/or distribute this software for any |
| 4 | # purpose with or without fee is hereby granted, provided that the above |
| 5 | # copyright notice and this permission notice appear in all copies. |
| 6 | # |
| 7 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 8 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 9 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 10 | # SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 11 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| 12 | # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 13 | # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ |
| 14 | |
| 15 | licenses(["notice"]) |
| 16 | |
| 17 | exports_files(["LICENSE"]) |
| 18 | |
| 19 | load( |
| 20 | ":BUILD.generated.bzl", |
| 21 | "crypto_headers", |
| 22 | "crypto_internal_headers", |
| 23 | "crypto_sources", |
| 24 | "crypto_sources_linux_x86_64", |
| 25 | "crypto_sources_mac_x86_64", |
| 26 | "ssl_headers", |
| 27 | "ssl_internal_headers", |
| 28 | "ssl_sources", |
| 29 | "tool_sources", |
| 30 | "tool_headers", |
| 31 | ) |
| 32 | |
| 33 | config_setting( |
| 34 | name = "linux_x86_64", |
| 35 | values = {"cpu": "k8"}, |
| 36 | ) |
| 37 | |
| 38 | config_setting( |
| 39 | name = "mac_x86_64", |
| 40 | values = {"cpu": "darwin"}, |
| 41 | ) |
| 42 | |
| 43 | boringssl_copts = [ |
| 44 | # Assembler option --noexecstack adds .note.GNU-stack to each object to |
| 45 | # ensure that binaries can be built with non-executable stack. |
| 46 | "-Wa,--noexecstack", |
| 47 | |
| 48 | # This is needed on Linux systems (at least) to get rwlock in pthread. |
| 49 | "-D_XOPEN_SOURCE=700", |
| 50 | |
Adam Langley | 0186787 | 2016-06-30 14:16:59 -0700 | [diff] [blame] | 51 | # This list of warnings should match those in the top-level CMakeLists.txt. |
| 52 | "-Wall", |
| 53 | "-Werror", |
| 54 | "-Wformat=2", |
| 55 | "-Wsign-compare", |
| 56 | "-Wmissing-field-initializers", |
| 57 | "-Wwrite-strings", |
| 58 | "-Wshadow", |
| 59 | "-fno-common", |
| 60 | |
| 61 | # Modern build environments should be able to set this to use atomic |
| 62 | # operations for reference counting rather than locks. However, it's |
| 63 | # known not to work on some Android builds. |
| 64 | # "-DOPENSSL_C11_ATOMIC", |
| 65 | ] + select({ |
| 66 | ":linux_x86_64": [], |
| 67 | ":mac_x86_64": [], |
| 68 | "//conditions:default": ["-DOPENSSL_NO_ASM"], |
| 69 | }) |
| 70 | |
| 71 | crypto_sources_asm = select({ |
| 72 | ":linux_x86_64": crypto_sources_linux_x86_64, |
| 73 | ":mac_x86_64": crypto_sources_mac_x86_64, |
| 74 | "//conditions:default": [], |
| 75 | }) |
| 76 | |
| 77 | # For C targets only (not C++), compile with C11 support. |
| 78 | boringssl_copts_c11 = boringssl_copts + [ |
| 79 | "-std=c11", |
| 80 | "-Wmissing-prototypes", |
| 81 | "-Wold-style-definition", |
| 82 | "-Wstrict-prototypes", |
| 83 | ] |
| 84 | |
| 85 | # For C targets only (not C++), compile with C11 support. |
| 86 | boringssl_copts_cxx = boringssl_copts + [ |
| 87 | "-std=c++11", |
| 88 | "-Wmissing-declarations", |
| 89 | ] |
| 90 | |
| 91 | cc_library( |
| 92 | name = "crypto", |
| 93 | srcs = crypto_sources + crypto_internal_headers + crypto_sources_asm, |
| 94 | hdrs = crypto_headers, |
| 95 | copts = boringssl_copts_c11, |
| 96 | includes = ["src/include"], |
| 97 | linkopts = select({ |
| 98 | ":mac_x86_64": [], |
| 99 | "//conditions:default": ["-lpthread"], |
| 100 | }), |
| 101 | visibility = ["//visibility:public"], |
| 102 | ) |
| 103 | |
| 104 | cc_library( |
| 105 | name = "ssl", |
| 106 | srcs = ssl_sources + ssl_internal_headers, |
| 107 | hdrs = ssl_headers, |
| 108 | copts = boringssl_copts_c11, |
| 109 | includes = ["src/include"], |
| 110 | visibility = ["//visibility:public"], |
| 111 | deps = [":crypto"], |
| 112 | ) |
| 113 | |
| 114 | cc_binary( |
| 115 | name = "bssl", |
Matt Braithwaite | d17d74d | 2016-08-17 20:10:28 -0700 | [diff] [blame] | 116 | srcs = tool_sources + tool_headers, |
Adam Langley | 0186787 | 2016-06-30 14:16:59 -0700 | [diff] [blame] | 117 | copts = boringssl_copts_cxx, |
| 118 | visibility = ["//visibility:public"], |
| 119 | deps = [":ssl"], |
| 120 | ) |