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