summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alessandro Astone <ales.astone@gmail.com> 2020-10-01 12:59:27 +0200
committer Tim Zimmermann <tim@linux4.de> 2025-10-03 11:55:39 +0200
commitdcac5d7c2169943692754e6594610247b2e9487c (patch)
tree6f5304f863c17b97e33348661ca4c826a665642b
parent533c3c2c9166b49caa556518bb547d8f9acf9594 (diff)
soong: Add equivalent for LOCAL_EXPORT_CFLAGSbanksia-dev
Co-authored-by: Michael Bestas <mkbestas@lineageos.org> Change-Id: I1802648b3a624aacf699beccb710fbee40425f16
-rw-r--r--androidmk/androidmk/android.go7
-rw-r--r--cc/library.go8
2 files changed, 15 insertions, 0 deletions
diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go
index 6485cc51d..1cc437d66 100644
--- a/androidmk/androidmk/android.go
+++ b/androidmk/androidmk/android.go
@@ -760,6 +760,13 @@ func cflags(ctx variableAssignmentContext) error {
return includeVariableNow(bpVariable{"cflags", bpparser.ListType}, ctx)
}
+func exportCflags(ctx variableAssignmentContext) error {
+ // The Soong replacement for EXPORT_CFLAGS doesn't need the same extra escaped quotes that were present in Make
+ ctx.mkvalue = ctx.mkvalue.Clone()
+ ctx.mkvalue.ReplaceLiteral(`\"`, `"`)
+ return includeVariableNow(bpVariable{"export_cflags", bpparser.ListType}, ctx)
+}
+
func protoOutputParams(ctx variableAssignmentContext) error {
// The Soong replacement for LOCAL_PROTO_JAVA_OUTPUT_PARAMS doesn't need ","
ctx.mkvalue = ctx.mkvalue.Clone()
diff --git a/cc/library.go b/cc/library.go
index 5299771ca..7b854864f 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -203,6 +203,9 @@ type FlagExporterProperties struct {
// using -isystem for this module and any module that links against this module.
Export_system_include_dirs []string `android:"arch_variant,variant_prepend"`
+ // list of plain cc flags to be used for any module that links against this module.
+ Export_cflags proptools.Configurable[[]string] `android:"arch_variant"`
+
Target struct {
Vendor, Product struct {
// list of exported include directories, like
@@ -327,6 +330,10 @@ func (f *flagExporter) exportIncludes(ctx ModuleContext) {
f.systemDirs = append(f.systemDirs, android.PathsForModuleSrc(ctx, f.Properties.Export_system_include_dirs)...)
}
+func (f *flagExporter) exportExtraFlags(ctx ModuleContext) {
+ f.flags = append(f.flags, f.Properties.Export_cflags.GetOrDefault(ctx, nil)...)
+}
+
// exportIncludesAsSystem registers the include directories and system include directories to be
// exported transitively both as system include directories to modules depending on this module.
func (f *flagExporter) exportIncludesAsSystem(ctx ModuleContext) {
@@ -1757,6 +1764,7 @@ func (library *libraryDecorator) link(ctx ModuleContext,
// Export include paths and flags to be propagated up the tree.
library.exportIncludes(ctx)
+ library.exportExtraFlags(ctx)
library.reexportDirs(deps.ReexportedDirs...)
library.reexportSystemDirs(deps.ReexportedSystemDirs...)
library.reexportFlags(deps.ReexportedFlags...)