diff --git a/androidmk/parser/parser.go b/androidmk/parser/parser.go index 86dabf975..e61241b2d 100644 --- a/androidmk/parser/parser.go +++ b/androidmk/parser/parser.go @@ -212,8 +212,21 @@ func (p *parser) parseDirective() bool { expression := SimpleMakeString("", pos) switch d { - case "endif", "endef", "else": + case "endif", "endef": // Nothing + case "else": + p.ignoreSpaces() + if p.tok != '\n' { + d = p.scanner.TokenText() + p.accept(scanner.Ident) + if d == "ifdef" || d == "ifndef" || d == "ifeq" || d == "ifneq" { + d = "el" + d + p.ignoreSpaces() + expression = p.parseExpression() + } else { + p.errorf("expected ifdef/ifndef/ifeq/ifneq, found %s", d) + } + } case "define": expression, endPos = p.parseDefine() default: