Simplify flags in c compiling, fix NDK build warnings
Reduce the number of flags variables when compiling C by getting
rid of the separately-tracked IncludeDirs variables, and putting
them directly in GlobalFlags. Also changes exportedIncludeDirs
to exportedFlags, which will allow exporting flags besides -I.
Also fixes a bug when building a module with the NDK and -Werror
by passing NDK exported include directories with -isystem instead
of -I, which will ignore warnings from those includes.
Also fixes a bug where the default includes were being inserted
into all cflags by the arm and arm64 toolchain modules.
Change-Id: Ice97f84e637b21d20c38c85b881afa315f9f92ae
diff --git a/cc/builder.go b/cc/builder.go
index ccf04f2..721d478 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -40,20 +40,20 @@
blueprint.RuleParams{
Depfile: "${out}.d",
Deps: blueprint.DepsGCC,
- Command: "$ccCmd $incFlags -c $cFlags -MD -MF ${out}.d -o $out $in",
+ Command: "$ccCmd -c $cFlags -MD -MF ${out}.d -o $out $in",
Description: "cc $out",
},
- "ccCmd", "incFlags", "cFlags")
+ "ccCmd", "cFlags")
ld = pctx.StaticRule("ld",
blueprint.RuleParams{
Command: "$ldCmd ${ldDirFlags} ${crtBegin} @${out}.rsp " +
- "${libFlags} ${crtEnd} -o ${out} ${ldFlags} ${ldLibs}",
+ "${libFlags} ${crtEnd} -o ${out} ${ldFlags}",
Description: "ld $out",
Rspfile: "${out}.rsp",
RspfileContent: "${in}",
},
- "ldCmd", "ldDirFlags", "crtBegin", "libFlags", "crtEnd", "ldFlags", "ldLibs")
+ "ldCmd", "ldDirFlags", "crtBegin", "libFlags", "crtEnd", "ldFlags")
partialLd = pctx.StaticRule("partialLd",
blueprint.RuleParams{
@@ -97,8 +97,6 @@
conlyFlags string
cppFlags string
ldFlags string
- ldLibs string
- incFlags string
yaccFlags string
nocrt bool
toolchain Toolchain
@@ -180,9 +178,8 @@
Inputs: []string{srcFile},
Implicits: deps,
Args: map[string]string{
- "cFlags": moduleCflags,
- "incFlags": flags.incFlags,
- "ccCmd": ccCmd,
+ "cFlags": moduleCflags,
+ "ccCmd": ccCmd,
},
})
}
@@ -275,7 +272,6 @@
"libFlags": strings.Join(libFlagsList, " "),
"ldFlags": flags.ldFlags,
"crtEnd": crtEnd,
- "ldLibs": flags.ldLibs,
},
})
}