Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mbake/core/rules/recipe_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def _is_missing_recipe_tab(
"ifneq",
"ifdef",
"ifndef",
"if ",
"else",
"endif",
"endef",
Expand Down
24 changes: 24 additions & 0 deletions tests/test_comprehensive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,3 +1639,27 @@ def test_noexport_special_target(self):

assert not errors
assert formatted_lines == input_lines


class TestAutomakeConditionals:
"""Test automake-style conditional handling."""

def test_automake_if_not_converted_to_recipe(self):
"""Test that automake 'if VARIABLE' is not treated as a recipe line."""
config = create_conservative_config()
formatter = MakefileFormatter(config)

input_lines = [
".DELETE_ON_ERROR:",
"",
"if STRICT",
" WERROR = -Werror",
"else",
" WERROR =",
"endif",
]

formatted_lines, errors, warnings = formatter.format_lines(input_lines)

assert "if STRICT" in formatted_lines
assert "\tif STRICT" not in formatted_lines
Loading