Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19ea53de authored by Yu Liu's avatar Yu Liu
Browse files

Support env based compiler flags.

Bug: 187086342
Test: Manual and unit tests.
Change-Id: Ic8e5f09dd6552e1121174bb00f0aae647661cf7b
parent 295cdfc7
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -344,16 +344,7 @@ func init() {
	exportedVars.ExportStringListStaticVariable("HostGlobalLldflags", hostGlobalLldflags)

	// Export the static default CommonGlobalCflags to Bazel.
	// TODO(187086342): handle cflags that are set in VariableFuncs.
	bazelCommonGlobalCflags := append(
		commonGlobalCflags,
		[]string{
			// Default to zero initialization.
			"-ftrivial-auto-var-init=zero",
			"-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang",
			"-Wno-unused-command-line-argument",
		}...)
	exportedVars.ExportStringList("CommonGlobalCflags", bazelCommonGlobalCflags)
	exportedVars.ExportStringList("CommonGlobalCflags", commonGlobalCflags)

	pctx.VariableFunc("CommonGlobalCflags", func(ctx android.PackageVarContext) string {
		flags := commonGlobalCflags