Refactor bionic includes into a single place
Bionic includes are the same on all architectures, modulo architecture-specific includes. Use a single function to populate the list, passing in bionic's and the kernel's names for the architecture. Also get rid of the ${LibcRoot} variable, it is not providing any value and makes grepping harder. Change-Id: I39e7907d312f52dd1378a3937ab1bcba12c4e97f
This commit is contained in:
parent
1a0c76fd1e
commit
f59b69ccaa
8 changed files with 18 additions and 50 deletions
|
@ -99,14 +99,7 @@ func init() {
|
|||
pctx.StaticVariable("arm64Cflags", strings.Join(arm64Cflags, " "))
|
||||
pctx.StaticVariable("arm64Ldflags", strings.Join(arm64Ldflags, " "))
|
||||
pctx.StaticVariable("arm64Cppflags", strings.Join(arm64Cppflags, " "))
|
||||
pctx.StaticVariable("arm64IncludeFlags", strings.Join([]string{
|
||||
"-isystem ${LibcRoot}/arch-arm64/include",
|
||||
"-isystem ${LibcRoot}/include",
|
||||
"-isystem ${LibcRoot}/kernel/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/android/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/common",
|
||||
"-isystem ${LibcRoot}/kernel/uapi/asm-arm64",
|
||||
}, " "))
|
||||
pctx.StaticVariable("arm64IncludeFlags", bionicHeaders("arm64", "arm64"))
|
||||
|
||||
pctx.StaticVariable("arm64ClangCflags", strings.Join(clangFilterUnknownCflags(arm64Cflags), " "))
|
||||
pctx.StaticVariable("arm64ClangLdflags", strings.Join(clangFilterUnknownCflags(arm64Ldflags), " "))
|
||||
|
|
|
@ -168,14 +168,7 @@ func init() {
|
|||
pctx.StaticVariable("armCflags", strings.Join(armCflags, " "))
|
||||
pctx.StaticVariable("armLdflags", strings.Join(armLdflags, " "))
|
||||
pctx.StaticVariable("armCppflags", strings.Join(armCppflags, " "))
|
||||
pctx.StaticVariable("armIncludeFlags", strings.Join([]string{
|
||||
"-isystem ${LibcRoot}/arch-arm/include",
|
||||
"-isystem ${LibcRoot}/include",
|
||||
"-isystem ${LibcRoot}/kernel/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/android/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/common",
|
||||
"-isystem ${LibcRoot}/kernel/uapi/asm-arm",
|
||||
}, " "))
|
||||
pctx.StaticVariable("armIncludeFlags", bionicHeaders("arm", "arm"))
|
||||
|
||||
// Extended cflags
|
||||
|
||||
|
|
2
cc/cc.go
2
cc/cc.go
|
@ -70,8 +70,6 @@ func init() {
|
|||
|
||||
var (
|
||||
HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", android.Config.PrebuiltOS)
|
||||
|
||||
LibcRoot = pctx.SourcePathVariable("LibcRoot", "bionic/libc")
|
||||
)
|
||||
|
||||
// Flags used by lots of devices. Putting them in package static variables will save bytes in
|
||||
|
|
|
@ -100,14 +100,7 @@ func init() {
|
|||
pctx.StaticVariable("mips64Cflags", strings.Join(mips64Cflags, " "))
|
||||
pctx.StaticVariable("mips64Ldflags", strings.Join(mips64Ldflags, " "))
|
||||
pctx.StaticVariable("mips64Cppflags", strings.Join(mips64Cppflags, " "))
|
||||
pctx.StaticVariable("mips64IncludeFlags", strings.Join([]string{
|
||||
"-isystem ${LibcRoot}/arch-mips64/include",
|
||||
"-isystem ${LibcRoot}/include",
|
||||
"-isystem ${LibcRoot}/kernel/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/android/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/common",
|
||||
"-isystem ${LibcRoot}/kernel/uapi/asm-mips",
|
||||
}, " "))
|
||||
pctx.StaticVariable("mips64IncludeFlags", bionicHeaders("mips64", "mips"))
|
||||
|
||||
// Clang cflags
|
||||
pctx.StaticVariable("mips64ClangTriple", "mips64el-linux-android")
|
||||
|
|
|
@ -137,14 +137,7 @@ func init() {
|
|||
pctx.StaticVariable("mipsCflags", strings.Join(mipsCflags, " "))
|
||||
pctx.StaticVariable("mipsLdflags", strings.Join(mipsLdflags, " "))
|
||||
pctx.StaticVariable("mipsCppflags", strings.Join(mipsCppflags, " "))
|
||||
pctx.StaticVariable("mipsIncludeFlags", strings.Join([]string{
|
||||
"-isystem ${LibcRoot}/arch-mips/include",
|
||||
"-isystem ${LibcRoot}/include",
|
||||
"-isystem ${LibcRoot}/kernel/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/android/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/common",
|
||||
"-isystem ${LibcRoot}/kernel/uapi/asm-mips",
|
||||
}, " "))
|
||||
pctx.StaticVariable("mipsIncludeFlags", bionicHeaders("mips", "mips"))
|
||||
|
||||
// Clang cflags
|
||||
pctx.StaticVariable("mipsClangTriple", "mipsel-linux-android")
|
||||
|
|
|
@ -16,6 +16,7 @@ package cc
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"android/soong/android"
|
||||
)
|
||||
|
@ -139,3 +140,14 @@ type toolchain32Bit struct {
|
|||
func (toolchain32Bit) Is64Bit() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func bionicHeaders(bionicArch, kernelArch string) string {
|
||||
return strings.Join([]string{
|
||||
"-isystem bionic/libc/arch-" + bionicArch + "/include",
|
||||
"-isystem bionic/libc/include",
|
||||
"-isystem bionic/libc/kernel/uapi",
|
||||
"-isystem bionic/libc/kernel/android/uapi",
|
||||
"-isystem bionic/libc/kernel/common",
|
||||
"-isystem bionic/libc/kernel/uapi/asm-" + kernelArch,
|
||||
}, " ")
|
||||
}
|
||||
|
|
|
@ -148,14 +148,7 @@ func init() {
|
|||
pctx.StaticVariable("x86_64Cflags", strings.Join(x86_64Cflags, " "))
|
||||
pctx.StaticVariable("x86_64Ldflags", strings.Join(x86_64Ldflags, " "))
|
||||
pctx.StaticVariable("x86_64Cppflags", strings.Join(x86_64Cppflags, " "))
|
||||
pctx.StaticVariable("x86_64IncludeFlags", strings.Join([]string{
|
||||
"-isystem ${LibcRoot}/arch-x86_64/include",
|
||||
"-isystem ${LibcRoot}/include",
|
||||
"-isystem ${LibcRoot}/kernel/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/android/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/common",
|
||||
"-isystem ${LibcRoot}/kernel/uapi/asm-x86",
|
||||
}, " "))
|
||||
pctx.StaticVariable("x86_64IncludeFlags", bionicHeaders("x86_64", "x86"))
|
||||
|
||||
// Clang cflags
|
||||
pctx.StaticVariable("x86_64ClangCflags", strings.Join(clangFilterUnknownCflags(x86_64Cflags), " "))
|
||||
|
|
|
@ -167,14 +167,7 @@ func init() {
|
|||
pctx.StaticVariable("x86Cflags", strings.Join(x86Cflags, " "))
|
||||
pctx.StaticVariable("x86Ldflags", strings.Join(x86Ldflags, " "))
|
||||
pctx.StaticVariable("x86Cppflags", strings.Join(x86Cppflags, " "))
|
||||
pctx.StaticVariable("x86IncludeFlags", strings.Join([]string{
|
||||
"-isystem ${LibcRoot}/arch-x86/include",
|
||||
"-isystem ${LibcRoot}/include",
|
||||
"-isystem ${LibcRoot}/kernel/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/android/uapi",
|
||||
"-isystem ${LibcRoot}/kernel/common",
|
||||
"-isystem ${LibcRoot}/kernel/uapi/asm-x86",
|
||||
}, " "))
|
||||
pctx.StaticVariable("x86IncludeFlags", bionicHeaders("x86", "x86"))
|
||||
|
||||
// Clang cflags
|
||||
pctx.StaticVariable("x86ClangCflags", strings.Join(clangFilterUnknownCflags(x86ClangCflags), " "))
|
||||
|
|
Loading…
Reference in a new issue