From feb30c3cd6365d7a80a870a13a8bee60d17f2a7a Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Thu, 25 Mar 2021 21:21:25 -0600 Subject: expand undefined macros to the empty string --- yapymake/makefile/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3