Split local and global cflags
Native compiler flags are currently applied in approximately:
global cflags
local cflags
local include dirs
global include dirs
global conlyflags
local conlyflags
global cppflags
local cppflags
This means that a flag that is enabled in the global cppflags
cannot be disabled in the local cflags, and an Android.bp author
must know to disable it in the local cppflags. A better order
would be:
global cflags
global conlyflags
global cppflags
local cflags
local conlyflags
local cppflags
local include dirs
global include dirs
We are mixing both the global and local cflags into a single
variable, and similar for conlyflags and cppflags, which
prevents reordering them. This CL prepares to reorder them
by splitting the global and local cflags into separate variables.
Bug: 143713277
Test: m native
Change-Id: Ic55a8c3516c331dc5f2af9d00e59ceca9d3e6c15
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 3747b41..b75c4c8 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -257,7 +257,7 @@
}
func addStubLibraryCompilerFlags(flags Flags) Flags {
- flags.CFlags = append(flags.CFlags,
+ flags.Global.CFlags = append(flags.Global.CFlags,
// We're knowingly doing some otherwise unsightly things with builtin
// functions here. We're just generating stub libraries, so ignore it.
"-Wno-incompatible-library-redeclaration",
@@ -337,7 +337,7 @@
if useVersionScript {
linkerScriptFlag := "-Wl,--version-script," + stub.versionScriptPath.String()
- flags.LdFlags = append(flags.LdFlags, linkerScriptFlag)
+ flags.Local.LdFlags = append(flags.Local.LdFlags, linkerScriptFlag)
flags.LdFlagsDeps = append(flags.LdFlagsDeps, stub.versionScriptPath)
}