diff options
author | Melody Horn <melody@boringcactus.com> | 2021-03-25 21:21:25 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-03-25 21:21:25 -0600 |
commit | feb30c3cd6365d7a80a870a13a8bee60d17f2a7a (patch) | |
tree | 3bd475827edc38298546068fc98dc1b51f897f31 | |
parent | 383c904c0f2667e8afabc76568a5e8376e617696 (diff) | |
download | yapymake-feb30c3cd6365d7a80a870a13a8bee60d17f2a7a.tar.gz yapymake-feb30c3cd6365d7a80a870a13a8bee60d17f2a7a.zip |
expand undefined macros to the empty string
-rw-r--r-- | yapymake/makefile/__init__.py | 6 |
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) |