aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-25 21:21:25 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-25 21:21:25 -0600
commitfeb30c3cd6365d7a80a870a13a8bee60d17f2a7a (patch)
tree3bd475827edc38298546068fc98dc1b51f897f31
parent383c904c0f2667e8afabc76568a5e8376e617696 (diff)
downloadyapymake-feb30c3cd6365d7a80a870a13a8bee60d17f2a7a.tar.gz
yapymake-feb30c3cd6365d7a80a870a13a8bee60d17f2a7a.zip
expand undefined macros to the empty string
-rw-r--r--yapymake/makefile/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/yapymake/makefile/__init__.py b/yapymake/makefile/__init__.py
index b5f96f1..483b071 100644
--- a/yapymake/makefile/__init__.py
+++ b/yapymake/makefile/__init__.py
@@ -279,7 +279,11 @@ class Makefile:
macro_tokens = TokenString.text(' '.join(macro_pieces))
else:
- _, macro_tokens = self._macros[this_token.name]
+ if this_token.name in self._macros:
+ _, macro_tokens = self._macros[this_token.name]
+ else:
+ self._warn(f'warning: undefined macro {this_token.name}')
+ macro_tokens = TokenString.text('')
macro_value = self.expand_macros(macro_tokens, current_target)
if this_token.replacement is not None:
replaced, replacement = (self.expand_macros(t, current_target) for t in this_token.replacement)