Add cpu-variant properties
Add nested properties that can vary based on the specific cpu type,
for example cortex-a9 or cortex-a15.
Change-Id: I107d6e30527c11d0bdd9bf17fb29513ffb07f9cc
diff --git a/androidbp/cmd/androidbp.go b/androidbp/cmd/androidbp.go
index 5ab7788..b1e364c 100644
--- a/androidbp/cmd/androidbp.go
+++ b/androidbp/cmd/androidbp.go
@@ -175,6 +175,8 @@
return
}
+var secondTargetReplacer = strings.NewReplacer("TARGET_", "TARGET_2ND_")
+
func translateSuffixProperties(suffixProps []*bpparser.Property,
suffixMap map[string]string) (computedProps []string, err error) {
for _, suffixProp := range suffixProps {
@@ -188,6 +190,33 @@
return nil, fmt.Errorf("Unsupported property %q", stdProp.Name.Name)
}
}
+ } else if variant, ok := cpuVariantConditionals[suffixProp.Name.Name]; ok {
+ var conditionalProps []propAssignment
+ for _, stdProp := range suffixProp.Value.MapValue {
+ if assignment, ok, err := translateSingleProperty(stdProp); err != nil {
+ return nil, err
+ } else if ok {
+ conditionalProps = append(conditionalProps, assignment)
+ } else {
+ return nil, fmt.Errorf("Unsupported property %q", stdProp.Name.Name)
+ }
+ }
+
+ appendComputedProps := func() {
+ computedProps = append(computedProps, variant.conditional)
+ for _, prop := range conditionalProps {
+ prop.assigner = "+="
+ computedProps = append(computedProps, prop.assignmentWithSuffix(variant.suffix))
+ }
+ computedProps = append(computedProps, "endif")
+ }
+
+ appendComputedProps()
+ if variant.secondArch {
+ variant.conditional = secondTargetReplacer.Replace(variant.conditional)
+ variant.suffix = secondTargetReplacer.Replace(variant.suffix)
+ appendComputedProps()
+ }
} else {
return nil, fmt.Errorf("Unsupported suffix property %q", suffixProp.Name.Name)
}