| 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 ( | 
| Alex Naidis | 5df73d0 | 2017-04-05 20:08:41 +0200 | [diff] [blame] | 18 | 	"fmt" | 
| Stephen Crane | ba090d1 | 2017-05-09 15:44:35 -0700 | [diff] [blame] | 19 | 	"runtime" | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 20 | 	"strings" | 
 | 21 |  | 
 | 22 | 	"android/soong/android" | 
 | 23 | ) | 
 | 24 |  | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 25 | var ( | 
| Leo Li | 8756b37 | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 26 | 	// Flags used by lots of devices.  Putting them in package static variables | 
 | 27 | 	// 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] | 28 | 	commonGlobalCflags = []string{ | 
 | 29 | 		"-DANDROID", | 
 | 30 | 		"-fmessage-length=0", | 
 | 31 | 		"-W", | 
 | 32 | 		"-Wall", | 
 | 33 | 		"-Wno-unused", | 
 | 34 | 		"-Winit-self", | 
 | 35 | 		"-Wpointer-arith", | 
 | 36 |  | 
| Colin Cross | 7278afc | 2017-11-02 22:38:32 -0700 | [diff] [blame] | 37 | 		// Make paths in deps files relative | 
 | 38 | 		"-no-canonical-prefixes", | 
| Colin Cross | 39d450b | 2017-11-06 12:53:30 -0800 | [diff] [blame] | 39 | 		"-fno-canonical-system-headers", | 
| Colin Cross | 7278afc | 2017-11-02 22:38:32 -0700 | [diff] [blame] | 40 |  | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 41 | 		"-DNDEBUG", | 
 | 42 | 		"-UDEBUG", | 
| Colin Cross | 7278afc | 2017-11-02 22:38:32 -0700 | [diff] [blame] | 43 |  | 
 | 44 | 		"-fno-exceptions", | 
 | 45 | 		"-Wno-multichar", | 
 | 46 |  | 
 | 47 | 		"-O2", | 
 | 48 | 		"-g", | 
 | 49 |  | 
 | 50 | 		"-fno-strict-aliasing", | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 51 | 	} | 
 | 52 |  | 
| Colin Cross | 6f6a428 | 2016-10-17 14:19:06 -0700 | [diff] [blame] | 53 | 	commonGlobalConlyflags = []string{} | 
| Elliott Hughes | 5a0401a | 2016-10-07 13:12:58 -0700 | [diff] [blame] | 54 |  | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 55 | 	deviceGlobalCflags = []string{ | 
 | 56 | 		"-fdiagnostics-color", | 
 | 57 |  | 
| Colin Cross | 133dbe7 | 2017-11-02 22:55:19 -0700 | [diff] [blame] | 58 | 		"-ffunction-sections", | 
| Colin Cross | ea3141d | 2017-11-06 14:02:02 -0800 | [diff] [blame] | 59 | 		"-fdata-sections", | 
 | 60 | 		"-fno-short-enums", | 
| Colin Cross | 133dbe7 | 2017-11-02 22:55:19 -0700 | [diff] [blame] | 61 | 		"-funwind-tables", | 
 | 62 | 		"-fstack-protector-strong", | 
 | 63 | 		"-Wa,--noexecstack", | 
 | 64 | 		"-D_FORTIFY_SOURCE=2", | 
 | 65 |  | 
 | 66 | 		"-Wstrict-aliasing=2", | 
 | 67 |  | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 68 | 		"-Werror=return-type", | 
 | 69 | 		"-Werror=non-virtual-dtor", | 
 | 70 | 		"-Werror=address", | 
 | 71 | 		"-Werror=sequence-point", | 
 | 72 | 		"-Werror=date-time", | 
| Colin Cross | 133dbe7 | 2017-11-02 22:55:19 -0700 | [diff] [blame] | 73 | 		"-Werror=format-security", | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 74 | 	} | 
 | 75 |  | 
| Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 76 | 	deviceGlobalCppflags = []string{ | 
 | 77 | 		"-fvisibility-inlines-hidden", | 
 | 78 | 	} | 
 | 79 |  | 
| Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 80 | 	deviceGlobalLdflags = []string{ | 
 | 81 | 		"-Wl,-z,noexecstack", | 
 | 82 | 		"-Wl,-z,relro", | 
 | 83 | 		"-Wl,-z,now", | 
 | 84 | 		"-Wl,--build-id=md5", | 
 | 85 | 		"-Wl,--warn-shared-textrel", | 
 | 86 | 		"-Wl,--fatal-warnings", | 
 | 87 | 		"-Wl,--no-undefined-version", | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 88 | 	} | 
 | 89 |  | 
 | 90 | 	hostGlobalCflags = []string{} | 
 | 91 |  | 
| Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 92 | 	hostGlobalCppflags = []string{} | 
 | 93 |  | 
| Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 94 | 	hostGlobalLdflags = []string{} | 
 | 95 |  | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 96 | 	commonGlobalCppflags = []string{ | 
 | 97 | 		"-Wsign-promo", | 
 | 98 | 	} | 
 | 99 |  | 
 | 100 | 	noOverrideGlobalCflags = []string{ | 
 | 101 | 		"-Werror=int-to-pointer-cast", | 
 | 102 | 		"-Werror=pointer-to-int-cast", | 
 | 103 | 	} | 
 | 104 |  | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 105 | 	IllegalFlags = []string{ | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 106 | 		"-w", | 
 | 107 | 	} | 
| Colin Cross | 6f6a428 | 2016-10-17 14:19:06 -0700 | [diff] [blame] | 108 |  | 
| Dan Albert | 043833c | 2017-02-03 16:13:38 -0800 | [diff] [blame] | 109 | 	CStdVersion               = "gnu99" | 
 | 110 | 	CppStdVersion             = "gnu++14" | 
 | 111 | 	GccCppStdVersion          = "gnu++11" | 
 | 112 | 	ExperimentalCStdVersion   = "gnu11" | 
 | 113 | 	ExperimentalCppStdVersion = "gnu++1z" | 
| Jayant Chowdhary | 6e8115a | 2017-05-09 10:21:52 -0700 | [diff] [blame] | 114 |  | 
 | 115 | 	NdkMaxPrebuiltVersionInt = 24 | 
| Leo Li | 8756b37 | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 116 |  | 
 | 117 | 	// prebuilts/clang default settings. | 
 | 118 | 	ClangDefaultBase         = "prebuilts/clang/host" | 
| Stephen Hines | 0ed7d24 | 2017-10-04 16:12:37 -0700 | [diff] [blame] | 119 | 	ClangDefaultVersion      = "clang-4393122" | 
 | 120 | 	ClangDefaultShortVersion = "5.0.1" | 
| Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 121 |  | 
 | 122 | 	WarningAllowedProjects = []string{ | 
| Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 123 | 		"external/skia/", | 
 | 124 | 		"device/", | 
| Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 125 | 		"frameworks/av/media/libstagefright/codecs/", | 
| Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 126 | 		"vendor/", | 
 | 127 | 	} | 
 | 128 |  | 
 | 129 | 	// Some Android.mk files still have warnings. | 
 | 130 | 	WarningAllowedOldProjects = []string{ | 
| Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 131 | 		"frameworks/av/drm/mediacas/plugins/", | 
| Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 132 | 		"hardware/libhardware/modules/", | 
| Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 133 | 		"hardware/qcom/", | 
| Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 134 | 		"tools/adt/idea/android/ultimate/get_modification_time/jni/", | 
 | 135 | 	} | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 136 | ) | 
 | 137 |  | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 138 | var pctx = android.NewPackageContext("android/soong/cc/config") | 
 | 139 |  | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 140 | func init() { | 
 | 141 | 	if android.BuildOs == android.Linux { | 
 | 142 | 		commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=") | 
 | 143 | 	} | 
 | 144 |  | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 145 | 	pctx.StaticVariable("CommonGlobalCflags", strings.Join(commonGlobalCflags, " ")) | 
| Elliott Hughes | 5a0401a | 2016-10-07 13:12:58 -0700 | [diff] [blame] | 146 | 	pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " ")) | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 147 | 	pctx.StaticVariable("DeviceGlobalCflags", strings.Join(deviceGlobalCflags, " ")) | 
| Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 148 | 	pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " ")) | 
| Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 149 | 	pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " ")) | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 150 | 	pctx.StaticVariable("HostGlobalCflags", strings.Join(hostGlobalCflags, " ")) | 
| Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 151 | 	pctx.StaticVariable("HostGlobalCppflags", strings.Join(hostGlobalCppflags, " ")) | 
| Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 152 | 	pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " ")) | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 153 | 	pctx.StaticVariable("NoOverrideGlobalCflags", strings.Join(noOverrideGlobalCflags, " ")) | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 154 |  | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 155 | 	pctx.StaticVariable("CommonGlobalCppflags", strings.Join(commonGlobalCppflags, " ")) | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 156 |  | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 157 | 	pctx.StaticVariable("CommonClangGlobalCflags", | 
 | 158 | 		strings.Join(append(ClangFilterUnknownCflags(commonGlobalCflags), "${ClangExtraCflags}"), " ")) | 
 | 159 | 	pctx.StaticVariable("DeviceClangGlobalCflags", | 
 | 160 | 		strings.Join(append(ClangFilterUnknownCflags(deviceGlobalCflags), "${ClangExtraTargetCflags}"), " ")) | 
 | 161 | 	pctx.StaticVariable("HostClangGlobalCflags", | 
 | 162 | 		strings.Join(ClangFilterUnknownCflags(hostGlobalCflags), " ")) | 
 | 163 | 	pctx.StaticVariable("NoOverrideClangGlobalCflags", | 
 | 164 | 		strings.Join(append(ClangFilterUnknownCflags(noOverrideGlobalCflags), "${ClangExtraNoOverrideCflags}"), " ")) | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 165 |  | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 166 | 	pctx.StaticVariable("CommonClangGlobalCppflags", | 
 | 167 | 		strings.Join(append(ClangFilterUnknownCflags(commonGlobalCppflags), "${ClangExtraCppflags}"), " ")) | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 168 |  | 
| Colin Cross | 1cfd89a | 2016-09-15 09:30:46 -0700 | [diff] [blame] | 169 | 	// Everything in these lists is a crime against abstraction and dependency tracking. | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 170 | 	// Do not add anything to this list. | 
| Jeff Gaston | 734e380 | 2017-04-10 15:47:24 -0700 | [diff] [blame] | 171 | 	pctx.PrefixedExistentPathsForSourcesVariable("CommonGlobalIncludes", "-I", | 
| Colin Cross | e4bba1e | 2016-09-22 15:29:50 -0700 | [diff] [blame] | 172 | 		[]string{ | 
| Colin Cross | 763a26c | 2016-09-23 15:48:51 +0000 | [diff] [blame] | 173 | 			"system/core/include", | 
| Colin Cross | 1928093 | 2016-10-05 12:36:42 -0700 | [diff] [blame] | 174 | 			"system/media/audio/include", | 
| Colin Cross | 2d44c2c | 2016-10-05 12:36:42 -0700 | [diff] [blame] | 175 | 			"hardware/libhardware/include", | 
| Colin Cross | 328f04e | 2016-11-03 15:45:34 -0700 | [diff] [blame] | 176 | 			"hardware/libhardware_legacy/include", | 
 | 177 | 			"hardware/ril/include", | 
 | 178 | 			"libnativehelper/include", | 
| Colin Cross | 315a6ff | 2016-10-05 12:36:42 -0700 | [diff] [blame] | 179 | 			"frameworks/native/include", | 
| Colin Cross | 14e8dd7 | 2016-12-14 11:13:16 -0800 | [diff] [blame] | 180 | 			"frameworks/native/opengl/include", | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 181 | 			"frameworks/av/include", | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 182 | 		}) | 
 | 183 | 	// This is used by non-NDK modules to get jni.h. export_include_dirs doesn't help | 
 | 184 | 	// with this, since there is no associated library. | 
| Jeff Gaston | 734e380 | 2017-04-10 15:47:24 -0700 | [diff] [blame] | 185 | 	pctx.PrefixedExistentPathsForSourcesVariable("CommonNativehelperInclude", "-I", | 
| Steven Moreland | 3afa3cd | 2017-09-25 11:22:02 -0700 | [diff] [blame] | 186 | 		[]string{"libnativehelper/include_jni"}) | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 187 |  | 
| Leo Li | 8756b37 | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 188 | 	pctx.SourcePathVariable("ClangDefaultBase", ClangDefaultBase) | 
| Colin Cross | 0875c52 | 2017-11-28 17:34:01 -0800 | [diff] [blame] | 189 | 	pctx.VariableFunc("ClangBase", func(config android.Config) (string, error) { | 
 | 190 | 		if override := config.Getenv("LLVM_PREBUILTS_BASE"); override != "" { | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 191 | 			return override, nil | 
 | 192 | 		} | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 193 | 		return "${ClangDefaultBase}", nil | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 194 | 	}) | 
| Colin Cross | 0875c52 | 2017-11-28 17:34:01 -0800 | [diff] [blame] | 195 | 	pctx.VariableFunc("ClangVersion", func(config android.Config) (string, error) { | 
 | 196 | 		if override := config.Getenv("LLVM_PREBUILTS_VERSION"); override != "" { | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 197 | 			return override, nil | 
 | 198 | 		} | 
| Leo Li | 8756b37 | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 199 | 		return ClangDefaultVersion, nil | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 200 | 	}) | 
| Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 201 | 	pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}") | 
 | 202 | 	pctx.StaticVariable("ClangBin", "${ClangPath}/bin") | 
 | 203 |  | 
| Colin Cross | 0875c52 | 2017-11-28 17:34:01 -0800 | [diff] [blame] | 204 | 	pctx.VariableFunc("ClangShortVersion", func(config android.Config) (string, error) { | 
 | 205 | 		if override := config.Getenv("LLVM_RELEASE_VERSION"); override != "" { | 
| Stephen Hines | e55a4cc | 2016-11-18 17:12:38 -0800 | [diff] [blame] | 206 | 			return override, nil | 
 | 207 | 		} | 
| Leo Li | 8756b37 | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 208 | 		return ClangDefaultShortVersion, nil | 
| Stephen Hines | e55a4cc | 2016-11-18 17:12:38 -0800 | [diff] [blame] | 209 | 	}) | 
 | 210 | 	pctx.StaticVariable("ClangAsanLibDir", "${ClangPath}/lib64/clang/${ClangShortVersion}/lib/linux") | 
| Stephen Crane | ba090d1 | 2017-05-09 15:44:35 -0700 | [diff] [blame] | 211 | 	if runtime.GOOS == "darwin" { | 
 | 212 | 		pctx.StaticVariable("LLVMGoldPlugin", "${ClangPath}/lib64/LLVMgold.dylib") | 
 | 213 | 	} else { | 
 | 214 | 		pctx.StaticVariable("LLVMGoldPlugin", "${ClangPath}/lib64/LLVMgold.so") | 
 | 215 | 	} | 
| Alistair Strachan | 777475c | 2016-08-26 12:55:49 -0700 | [diff] [blame] | 216 |  | 
| Jayant Chowdhary | e622d20 | 2017-02-01 19:19:52 -0800 | [diff] [blame] | 217 | 	// These are tied to the version of LLVM directly in external/llvm, so they might trail the host prebuilts | 
 | 218 | 	// being used for the rest of the build process. | 
 | 219 | 	pctx.SourcePathVariable("RSClangBase", "prebuilts/clang/host") | 
 | 220 | 	pctx.SourcePathVariable("RSClangVersion", "clang-3289846") | 
 | 221 | 	pctx.SourcePathVariable("RSReleaseVersion", "3.8") | 
 | 222 | 	pctx.StaticVariable("RSLLVMPrebuiltsPath", "${RSClangBase}/${HostPrebuiltTag}/${RSClangVersion}/bin") | 
 | 223 | 	pctx.StaticVariable("RSIncludePath", "${RSLLVMPrebuiltsPath}/../lib64/clang/${RSReleaseVersion}/include") | 
 | 224 |  | 
| Jeff Gaston | 734e380 | 2017-04-10 15:47:24 -0700 | [diff] [blame] | 225 | 	pctx.PrefixedExistentPathsForSourcesVariable("RsGlobalIncludes", "-I", | 
| Colin Cross | 2a252be | 2017-05-01 17:37:24 -0700 | [diff] [blame] | 226 | 		[]string{ | 
 | 227 | 			"external/clang/lib/Headers", | 
 | 228 | 			"frameworks/rs/script_api/include", | 
 | 229 | 		}) | 
 | 230 |  | 
| Colin Cross | 0875c52 | 2017-11-28 17:34:01 -0800 | [diff] [blame] | 231 | 	pctx.VariableFunc("CcWrapper", func(config android.Config) (string, error) { | 
 | 232 | 		if override := config.Getenv("CC_WRAPPER"); override != "" { | 
| Alistair Strachan | 777475c | 2016-08-26 12:55:49 -0700 | [diff] [blame] | 233 | 			return override + " ", nil | 
 | 234 | 		} | 
 | 235 | 		return "", nil | 
 | 236 | 	}) | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 237 | } | 
 | 238 |  | 
 | 239 | var HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", android.Config.PrebuiltOS) | 
 | 240 |  | 
| Elliott Hughes | de28deb | 2017-10-12 09:07:53 -0700 | [diff] [blame] | 241 | func bionicHeaders(kernelArch string) string { | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 242 | 	return strings.Join([]string{ | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 243 | 		"-isystem bionic/libc/include", | 
 | 244 | 		"-isystem bionic/libc/kernel/uapi", | 
 | 245 | 		"-isystem bionic/libc/kernel/uapi/asm-" + kernelArch, | 
| Elliott Hughes | 98418a0 | 2017-05-25 17:16:10 -0700 | [diff] [blame] | 246 | 		"-isystem bionic/libc/kernel/android/scsi", | 
| Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 247 | 		"-isystem bionic/libc/kernel/android/uapi", | 
 | 248 | 	}, " ") | 
 | 249 | } | 
| Dan Willemsen | d2ede87 | 2016-11-18 14:54:24 -0800 | [diff] [blame] | 250 |  | 
| Alex Naidis | 5df73d0 | 2017-04-05 20:08:41 +0200 | [diff] [blame] | 251 | func replaceFirst(slice []string, from, to string) { | 
 | 252 | 	if slice[0] != from { | 
 | 253 | 		panic(fmt.Errorf("Expected %q, found %q", from, to)) | 
 | 254 | 	} | 
 | 255 | 	slice[0] = to | 
 | 256 | } |