diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/makefile/input.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs index d6cffdf..d90378d 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -158,9 +158,27 @@ pub struct MakefileReader<'a, 'parent, R: BufRead> { impl<'a, 'parent> MakefileReader<'a, 'parent, BufReader<File>> { pub fn read_file( args: &'a Args, - macros: MacroSet<'parent, 'static>, + mut macros: MacroSet<'parent, 'static>, path: impl AsRef<Path>, ) -> Result<Self> { + #[cfg(feature = "full")] + if let Some((_, mut old_makefile_list)) = macros.pop("MAKEFILE_LIST") { + old_makefile_list.extend(TokenString::text(format!( + " {}", + path.as_ref().to_string_lossy() + ))); + macros.set( + "MAKEFILE_LIST".to_owned(), + MacroSource::Builtin, + old_makefile_list, + ); + } else { + macros.set( + "MAKEFILE_LIST".to_owned(), + MacroSource::Builtin, + TokenString::text(path.as_ref().to_string_lossy()), + ); + } let file = File::open(path); // TODO handle errors let file = file.context("couldn't open makefile!")?; |