diff --git a/Tools/scripts/extract_features.py b/Tools/scripts/extract_features.py index ae90ffe15562c..8671e4eae0bb9 100755 --- a/Tools/scripts/extract_features.py +++ b/Tools/scripts/extract_features.py @@ -378,11 +378,20 @@ def create_string(self): ret = "" - for compiled_in_feature_define in sorted(compiled_in_feature_defines): - ret += compiled_in_feature_define + "\n" - for remaining in sorted(not_compiled_in_feature_defines): - ret += "!" + remaining + "\n" - + combined = {} + for define in sorted(compiled_in_feature_defines): + combined[define] = True + for define in sorted(not_compiled_in_feature_defines): + combined[define] = False + + def squash_hal_to_ap(a): + return re.sub("^HAL_", "AP_", a) + + for define in sorted(combined.keys(), key=squash_hal_to_ap): + bang = "" + if not combined[define]: + bang = "!" + ret += bang + define + "\n" return ret def run(self):