Remove global include paths for modules built against NDK
Modules built against the NDK shouldn't get the global or arch-specific
include paths, all headers will be provided by depenendencies or the
NDK.
Change-Id: I13b9530a365e11e9cf6bd2b99b756b36944e0a9e
diff --git a/cc/cc.go b/cc/cc.go
index 18e499d..594ae25 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -451,7 +451,7 @@
common.ModuleGenDir(ctx),
}...)
- if c.properties.Sdk_version == "" {
+ if c.properties.Sdk_version == "" || ctx.Host() {
flags.IncludeDirs = append(flags.IncludeDirs, "${SrcDir}/libnativehelper/include/nativehelper")
}
@@ -459,26 +459,26 @@
flags.LdFlags = append(flags.LdFlags, "-Wl,--no-undefined")
}
+ if ctx.Host() || c.properties.Sdk_version == "" {
+ flags.GlobalFlags = append(flags.GlobalFlags,
+ "${commonGlobalIncludes}",
+ toolchain.IncludeFlags())
+ }
+
+ flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
+
if flags.Clang {
flags.CppFlags = append(flags.CppFlags, "${commonClangGlobalCppflags}")
- flags.GlobalFlags = []string{
- "${commonGlobalIncludes}",
- toolchain.IncludeFlags(),
- instructionSetFlags,
+ flags.GlobalFlags = append(flags.GlobalFlags,
toolchain.ClangCflags(),
"${commonClangGlobalCflags}",
- fmt.Sprintf("${%sClangGlobalCflags}", ctx.Arch().HostOrDevice),
- }
+ fmt.Sprintf("${%sClangGlobalCflags}", ctx.Arch().HostOrDevice))
} else {
flags.CppFlags = append(flags.CppFlags, "${commonGlobalCppflags}")
- flags.GlobalFlags = []string{
- "${commonGlobalIncludes}",
- toolchain.IncludeFlags(),
- instructionSetFlags,
+ flags.GlobalFlags = append(flags.GlobalFlags,
toolchain.Cflags(),
"${commonGlobalCflags}",
- fmt.Sprintf("${%sGlobalCflags}", ctx.Arch().HostOrDevice),
- }
+ fmt.Sprintf("${%sGlobalCflags}", ctx.Arch().HostOrDevice))
}
if ctx.Host() {