aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yapymake/makefile/__init__.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/yapymake/makefile/__init__.py b/yapymake/makefile/__init__.py
index 09dcb93..cb6fe85 100644
--- a/yapymake/makefile/__init__.py
+++ b/yapymake/makefile/__init__.py
@@ -5,7 +5,7 @@ from pathlib import Path as ImpurePath, PurePath
import re
import subprocess
import sys
-from typing import Dict, List, Optional, Set, TextIO, Tuple, Any, Union
+from typing import Dict, List, Optional, Set, TextIO, Tuple, Union
from .token import *
from ..args import Args
@@ -81,6 +81,11 @@ class Makefile:
while line.endswith('\\\n'):
line = line[:-2] + next(lines_iter, '').lstrip()
+ # > The trailing <newline>, any <blank> characters immediately preceding a comment, and any comment
+ # > shall be discarded.
+ # (that's only specified that way for includes but apparently needs to apply to everything)
+ line = re.sub(r'(\s*#.*)?\n', '', line)
+
# POSIX:
# > If the word include appears at the beginning of a line and is followed by one or more <blank>
# > characters...
@@ -89,10 +94,6 @@ class Makefile:
line = line[len('include '):].lstrip()
# > shall be processed as follows to produce a pathname:
- # > The trailing <newline>, any <blank> characters immediately preceding a comment, and any comment
- # > shall be discarded.
- line = re.sub(r'(\s+#.*)?\n', '', line)
-
# > The resulting string shall be processed for macro expansion.
line = self.expand_macros(tokenize(line))