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
This commit is contained in:
Colin Cross
2015-04-22 13:07:53 -07:00
parent 56b4d45341
commit 28344528cf
5 changed files with 89 additions and 95 deletions

View File

@@ -40,20 +40,20 @@ var (
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 @@ type builderFlags struct {
conlyFlags string
cppFlags string
ldFlags string
ldLibs string
incFlags string
yaccFlags string
nocrt bool
toolchain Toolchain
@@ -180,9 +178,8 @@ func TransformSourceToObj(ctx common.AndroidModuleContext, subdir string, srcFil
Inputs: []string{srcFile},
Implicits: deps,
Args: map[string]string{
"cFlags": moduleCflags,
"incFlags": flags.incFlags,
"ccCmd": ccCmd,
"cFlags": moduleCflags,
"ccCmd": ccCmd,
},
})
}
@@ -275,7 +272,6 @@ func TransformObjToDynamicBinary(ctx common.AndroidModuleContext,
"libFlags": strings.Join(libFlagsList, " "),
"ldFlags": flags.ldFlags,
"crtEnd": crtEnd,
"ldLibs": flags.ldLibs,
},
})
}