Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 1 | // Copyright 2016 Google Inc. All rights reserved. |
| 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 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 15 | package config |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 16 | |
| 17 | import ( |
| 18 | "strings" |
| 19 | |
| 20 | "android/soong/android" |
| 21 | ) |
| 22 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 23 | var ( |
Leo Li | 8756b37 | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 24 | // Flags used by lots of devices. Putting them in package static variables |
| 25 | // will save bytes in build.ninja so they aren't repeated for every file |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 26 | commonGlobalCflags = []string{ |
| 27 | "-DANDROID", |
| 28 | "-fmessage-length=0", |
| 29 | "-W", |
| 30 | "-Wall", |
| 31 | "-Wno-unused", |
| 32 | "-Winit-self", |
| 33 | "-Wpointer-arith", |
| 34 | |
Colin Cross | 7278afc | 2017-11-02 22:38:32 -0700 | [diff] [blame] | 35 | // Make paths in deps files relative |
| 36 | "-no-canonical-prefixes", |
Colin Cross | 39d450b | 2017-11-06 12:53:30 -0800 | [diff] [blame] | 37 | "-fno-canonical-system-headers", |
Colin Cross | 7278afc | 2017-11-02 22:38:32 -0700 | [diff] [blame] | 38 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 39 | "-DNDEBUG", |
| 40 | "-UDEBUG", |
Colin Cross | 7278afc | 2017-11-02 22:38:32 -0700 | [diff] [blame] | 41 | |
| 42 | "-fno-exceptions", |
| 43 | "-Wno-multichar", |
| 44 | |
| 45 | "-O2", |
| 46 | "-g", |
| 47 | |
| 48 | "-fno-strict-aliasing", |
Dan Willemsen | 5d980c8 | 2019-08-27 19:37:10 -0700 | [diff] [blame] | 49 | |
| 50 | "-Werror=date-time", |
Elliott Hughes | 2cdbdf1 | 2019-12-03 18:13:00 -0800 | [diff] [blame] | 51 | "-Werror=pragma-pack", |
| 52 | "-Werror=pragma-pack-suspicious-include", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 53 | } |
| 54 | |
Colin Cross | 6f6a428 | 2016-10-17 14:19:06 -0700 | [diff] [blame] | 55 | commonGlobalConlyflags = []string{} |
Elliott Hughes | 5a0401a | 2016-10-07 13:12:58 -0700 | [diff] [blame] | 56 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 57 | deviceGlobalCflags = []string{ |
| 58 | "-fdiagnostics-color", |
| 59 | |
Colin Cross | 133dbe7 | 2017-11-02 22:55:19 -0700 | [diff] [blame] | 60 | "-ffunction-sections", |
Colin Cross | ea3141d | 2017-11-06 14:02:02 -0800 | [diff] [blame] | 61 | "-fdata-sections", |
| 62 | "-fno-short-enums", |
Colin Cross | 133dbe7 | 2017-11-02 22:55:19 -0700 | [diff] [blame] | 63 | "-funwind-tables", |
| 64 | "-fstack-protector-strong", |
| 65 | "-Wa,--noexecstack", |
| 66 | "-D_FORTIFY_SOURCE=2", |
| 67 | |
| 68 | "-Wstrict-aliasing=2", |
| 69 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 70 | "-Werror=return-type", |
| 71 | "-Werror=non-virtual-dtor", |
| 72 | "-Werror=address", |
| 73 | "-Werror=sequence-point", |
Colin Cross | 133dbe7 | 2017-11-02 22:55:19 -0700 | [diff] [blame] | 74 | "-Werror=format-security", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 75 | } |
| 76 | |
Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 77 | deviceGlobalCppflags = []string{ |
| 78 | "-fvisibility-inlines-hidden", |
| 79 | } |
| 80 | |
Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 81 | deviceGlobalLdflags = []string{ |
| 82 | "-Wl,-z,noexecstack", |
| 83 | "-Wl,-z,relro", |
| 84 | "-Wl,-z,now", |
| 85 | "-Wl,--build-id=md5", |
| 86 | "-Wl,--warn-shared-textrel", |
| 87 | "-Wl,--fatal-warnings", |
| 88 | "-Wl,--no-undefined-version", |
Christopher Ferris | c3a1e22 | 2019-04-10 17:57:50 -0700 | [diff] [blame] | 89 | "-Wl,--exclude-libs,libgcc.a", |
Yi Kong | 3d8792f | 2019-05-06 16:18:33 -0700 | [diff] [blame] | 90 | "-Wl,--exclude-libs,libgcc_stripped.a", |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 91 | "-Wl,--exclude-libs,libunwind_llvm.a", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 94 | deviceGlobalLldflags = append(ClangFilterUnknownLldflags(deviceGlobalLdflags), |
| 95 | []string{ |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 96 | "-fuse-ld=lld", |
| 97 | }...) |
| 98 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 99 | hostGlobalCflags = []string{} |
| 100 | |
Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 101 | hostGlobalCppflags = []string{} |
| 102 | |
Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 103 | hostGlobalLdflags = []string{} |
| 104 | |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame] | 105 | hostGlobalLldflags = []string{"-fuse-ld=lld"} |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 106 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 107 | commonGlobalCppflags = []string{ |
| 108 | "-Wsign-promo", |
| 109 | } |
| 110 | |
| 111 | noOverrideGlobalCflags = []string{ |
| 112 | "-Werror=int-to-pointer-cast", |
| 113 | "-Werror=pointer-to-int-cast", |
George Burgess IV | 6c69164 | 2019-09-18 17:52:05 -0700 | [diff] [blame] | 114 | "-Werror=fortify-source", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 115 | } |
| 116 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 117 | IllegalFlags = []string{ |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 118 | "-w", |
| 119 | } |
Colin Cross | 6f6a428 | 2016-10-17 14:19:06 -0700 | [diff] [blame] | 120 | |
Dan Albert | 043833c | 2017-02-03 16:13:38 -0800 | [diff] [blame] | 121 | CStdVersion = "gnu99" |
Elliott Hughes | 34e4e41 | 2018-11-30 16:03:06 +0000 | [diff] [blame] | 122 | CppStdVersion = "gnu++17" |
Dan Albert | 043833c | 2017-02-03 16:13:38 -0800 | [diff] [blame] | 123 | ExperimentalCStdVersion = "gnu11" |
Elliott Hughes | 3797612 | 2018-11-28 14:16:39 -0800 | [diff] [blame] | 124 | ExperimentalCppStdVersion = "gnu++2a" |
Jayant Chowdhary | 6e8115a | 2017-05-09 10:21:52 -0700 | [diff] [blame] | 125 | |
Dan Albert | c715eda | 2018-01-16 16:21:06 -0800 | [diff] [blame] | 126 | NdkMaxPrebuiltVersionInt = 27 |
Leo Li | 8756b37 | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 127 | |
| 128 | // prebuilts/clang default settings. |
| 129 | ClangDefaultBase = "prebuilts/clang/host" |
Chih-Hung Hsieh | 287a13f | 2020-02-14 14:44:22 -0800 | [diff] [blame] | 130 | ClangDefaultVersion = "clang-r377782b" |
| 131 | ClangDefaultShortVersion = "10.0.4" |
Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 132 | |
Chih-Hung Hsieh | 775edde | 2017-12-24 22:24:47 -0800 | [diff] [blame] | 133 | // Directories with warnings from Android.bp files. |
Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 134 | WarningAllowedProjects = []string{ |
Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 135 | "device/", |
Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 136 | "vendor/", |
| 137 | } |
| 138 | |
Chih-Hung Hsieh | 775edde | 2017-12-24 22:24:47 -0800 | [diff] [blame] | 139 | // Directories with warnings from Android.mk files. |
| 140 | WarningAllowedOldProjects = []string{} |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 141 | ) |
| 142 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 143 | var pctx = android.NewPackageContext("android/soong/cc/config") |
| 144 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 145 | func init() { |
| 146 | if android.BuildOs == android.Linux { |
| 147 | commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=") |
| 148 | } |
| 149 | |
Elliott Hughes | 5a0401a | 2016-10-07 13:12:58 -0700 | [diff] [blame] | 150 | pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " ")) |
Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 151 | pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " ")) |
Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 152 | pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " ")) |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 153 | pctx.StaticVariable("DeviceGlobalLldflags", strings.Join(deviceGlobalLldflags, " ")) |
Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 154 | pctx.StaticVariable("HostGlobalCppflags", strings.Join(hostGlobalCppflags, " ")) |
Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 155 | pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " ")) |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 156 | pctx.StaticVariable("HostGlobalLldflags", strings.Join(hostGlobalLldflags, " ")) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 157 | |
Stephen Hines | 66c8b44 | 2019-06-10 17:40:12 -0700 | [diff] [blame] | 158 | pctx.VariableFunc("CommonClangGlobalCflags", func(ctx android.PackageVarContext) string { |
| 159 | flags := ClangFilterUnknownCflags(commonGlobalCflags) |
| 160 | flags = append(flags, "${ClangExtraCflags}") |
| 161 | |
| 162 | // http://b/131390872 |
| 163 | // Automatically initialize any uninitialized stack variables. |
| 164 | // Prefer zero-init if both options are set. |
| 165 | if ctx.Config().IsEnvTrue("AUTO_ZERO_INITIALIZE") { |
| 166 | flags = append(flags, "-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang") |
| 167 | } else if ctx.Config().IsEnvTrue("AUTO_PATTERN_INITIALIZE") { |
| 168 | flags = append(flags, "-ftrivial-auto-var-init=pattern") |
Stephen Hines | 797e195 | 2020-01-28 14:43:11 -0800 | [diff] [blame] | 169 | } else if ctx.Config().IsEnvTrue("AUTO_UNINITIALIZE") { |
| 170 | flags = append(flags, "-ftrivial-auto-var-init=uninitialized") |
Stephen Hines | 0e1d5d8 | 2020-01-30 15:06:00 -0800 | [diff] [blame] | 171 | } else { |
| 172 | // Default to pattern initialization. |
| 173 | flags = append(flags, "-ftrivial-auto-var-init=pattern") |
Stephen Hines | 66c8b44 | 2019-06-10 17:40:12 -0700 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | return strings.Join(flags, " ") |
| 177 | }) |
| 178 | |
Doug Horn | c32c6b0 | 2019-01-17 14:44:05 -0800 | [diff] [blame] | 179 | pctx.VariableFunc("DeviceClangGlobalCflags", func(ctx android.PackageVarContext) string { |
| 180 | if ctx.Config().Fuchsia() { |
| 181 | return strings.Join(ClangFilterUnknownCflags(deviceGlobalCflags), " ") |
| 182 | } else { |
| 183 | return strings.Join(append(ClangFilterUnknownCflags(deviceGlobalCflags), "${ClangExtraTargetCflags}"), " ") |
| 184 | } |
| 185 | }) |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 186 | pctx.StaticVariable("HostClangGlobalCflags", |
| 187 | strings.Join(ClangFilterUnknownCflags(hostGlobalCflags), " ")) |
| 188 | pctx.StaticVariable("NoOverrideClangGlobalCflags", |
| 189 | strings.Join(append(ClangFilterUnknownCflags(noOverrideGlobalCflags), "${ClangExtraNoOverrideCflags}"), " ")) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 190 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 191 | pctx.StaticVariable("CommonClangGlobalCppflags", |
| 192 | strings.Join(append(ClangFilterUnknownCflags(commonGlobalCppflags), "${ClangExtraCppflags}"), " ")) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 193 | |
Yi Kong | cc80f8d | 2018-06-06 14:42:44 -0700 | [diff] [blame] | 194 | pctx.StaticVariable("ClangExternalCflags", "${ClangExtraExternalCflags}") |
| 195 | |
Colin Cross | 1cfd89a | 2016-09-15 09:30:46 -0700 | [diff] [blame] | 196 | // Everything in these lists is a crime against abstraction and dependency tracking. |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 197 | // Do not add anything to this list. |
Jeff Gaston | 734e380 | 2017-04-10 15:47:24 -0700 | [diff] [blame] | 198 | pctx.PrefixedExistentPathsForSourcesVariable("CommonGlobalIncludes", "-I", |
Colin Cross | e4bba1e | 2016-09-22 15:29:50 -0700 | [diff] [blame] | 199 | []string{ |
Colin Cross | 763a26c | 2016-09-23 15:48:51 +0000 | [diff] [blame] | 200 | "system/core/include", |
Colin Cross | 1928093 | 2016-10-05 12:36:42 -0700 | [diff] [blame] | 201 | "system/media/audio/include", |
Colin Cross | 2d44c2c | 2016-10-05 12:36:42 -0700 | [diff] [blame] | 202 | "hardware/libhardware/include", |
Colin Cross | 328f04e | 2016-11-03 15:45:34 -0700 | [diff] [blame] | 203 | "hardware/libhardware_legacy/include", |
| 204 | "hardware/ril/include", |
Colin Cross | 315a6ff | 2016-10-05 12:36:42 -0700 | [diff] [blame] | 205 | "frameworks/native/include", |
Colin Cross | 14e8dd7 | 2016-12-14 11:13:16 -0800 | [diff] [blame] | 206 | "frameworks/native/opengl/include", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 207 | "frameworks/av/include", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 208 | }) |
| 209 | // This is used by non-NDK modules to get jni.h. export_include_dirs doesn't help |
| 210 | // with this, since there is no associated library. |
Jeff Gaston | 734e380 | 2017-04-10 15:47:24 -0700 | [diff] [blame] | 211 | pctx.PrefixedExistentPathsForSourcesVariable("CommonNativehelperInclude", "-I", |
Steven Moreland | 3afa3cd | 2017-09-25 11:22:02 -0700 | [diff] [blame] | 212 | []string{"libnativehelper/include_jni"}) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 213 | |
Leo Li | 8756b37 | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 214 | pctx.SourcePathVariable("ClangDefaultBase", ClangDefaultBase) |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 215 | pctx.VariableFunc("ClangBase", func(ctx android.PackageVarContext) string { |
| 216 | if override := ctx.Config().Getenv("LLVM_PREBUILTS_BASE"); override != "" { |
| 217 | return override |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 218 | } |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 219 | return "${ClangDefaultBase}" |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 220 | }) |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 221 | pctx.VariableFunc("ClangVersion", func(ctx android.PackageVarContext) string { |
| 222 | if override := ctx.Config().Getenv("LLVM_PREBUILTS_VERSION"); override != "" { |
| 223 | return override |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 224 | } |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 225 | return ClangDefaultVersion |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 226 | }) |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 227 | pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}") |
| 228 | pctx.StaticVariable("ClangBin", "${ClangPath}/bin") |
| 229 | |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 230 | pctx.VariableFunc("ClangShortVersion", func(ctx android.PackageVarContext) string { |
| 231 | if override := ctx.Config().Getenv("LLVM_RELEASE_VERSION"); override != "" { |
| 232 | return override |
Stephen Hines | e55a4cc | 2016-11-18 17:12:38 -0800 | [diff] [blame] | 233 | } |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 234 | return ClangDefaultShortVersion |
Stephen Hines | e55a4cc | 2016-11-18 17:12:38 -0800 | [diff] [blame] | 235 | }) |
Stephen Hines | 755fe07 | 2018-01-24 19:58:36 -0800 | [diff] [blame] | 236 | pctx.StaticVariable("ClangAsanLibDir", "${ClangBase}/linux-x86/${ClangVersion}/lib64/clang/${ClangShortVersion}/lib/linux") |
Alistair Strachan | 777475c | 2016-08-26 12:55:49 -0700 | [diff] [blame] | 237 | |
Jayant Chowdhary | e622d20 | 2017-02-01 19:19:52 -0800 | [diff] [blame] | 238 | // These are tied to the version of LLVM directly in external/llvm, so they might trail the host prebuilts |
| 239 | // being used for the rest of the build process. |
| 240 | pctx.SourcePathVariable("RSClangBase", "prebuilts/clang/host") |
| 241 | pctx.SourcePathVariable("RSClangVersion", "clang-3289846") |
| 242 | pctx.SourcePathVariable("RSReleaseVersion", "3.8") |
| 243 | pctx.StaticVariable("RSLLVMPrebuiltsPath", "${RSClangBase}/${HostPrebuiltTag}/${RSClangVersion}/bin") |
| 244 | pctx.StaticVariable("RSIncludePath", "${RSLLVMPrebuiltsPath}/../lib64/clang/${RSReleaseVersion}/include") |
| 245 | |
Jeff Gaston | 734e380 | 2017-04-10 15:47:24 -0700 | [diff] [blame] | 246 | pctx.PrefixedExistentPathsForSourcesVariable("RsGlobalIncludes", "-I", |
Colin Cross | 2a252be | 2017-05-01 17:37:24 -0700 | [diff] [blame] | 247 | []string{ |
| 248 | "external/clang/lib/Headers", |
| 249 | "frameworks/rs/script_api/include", |
| 250 | }) |
| 251 | |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 252 | pctx.VariableFunc("CcWrapper", func(ctx android.PackageVarContext) string { |
| 253 | if override := ctx.Config().Getenv("CC_WRAPPER"); override != "" { |
| 254 | return override + " " |
Alistair Strachan | 777475c | 2016-08-26 12:55:49 -0700 | [diff] [blame] | 255 | } |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 256 | return "" |
Alistair Strachan | 777475c | 2016-08-26 12:55:49 -0700 | [diff] [blame] | 257 | }) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | var HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", android.Config.PrebuiltOS) |
| 261 | |
Elliott Hughes | de28deb | 2017-10-12 09:07:53 -0700 | [diff] [blame] | 262 | func bionicHeaders(kernelArch string) string { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 263 | return strings.Join([]string{ |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 264 | "-isystem bionic/libc/include", |
| 265 | "-isystem bionic/libc/kernel/uapi", |
| 266 | "-isystem bionic/libc/kernel/uapi/asm-" + kernelArch, |
Elliott Hughes | 98418a0 | 2017-05-25 17:16:10 -0700 | [diff] [blame] | 267 | "-isystem bionic/libc/kernel/android/scsi", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 268 | "-isystem bionic/libc/kernel/android/uapi", |
| 269 | }, " ") |
| 270 | } |