aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-04 11:56:42 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-04 11:56:42 -0600
commitc9cc973f6ea1184b962bc11420f4cd9d9a194c6e (patch)
tree7ad9ce4b3e40bfc4b047d849e05b45204392fdbd
parent8b4e33220d3ca9a929e485388b73630883394fe6 (diff)
downloadmakers-c9cc973f6ea1184b962bc11420f4cd9d9a194c6e.tar.gz
makers-c9cc973f6ea1184b962bc11420f4cd9d9a194c6e.zip
point MAKE builtin macro at full path, not just name
-rw-r--r--README.md2
-rw-r--r--src/makefile/macro.rs9
2 files changed, 7 insertions, 4 deletions
diff --git a/README.md b/README.md
index d0519e1..cb262cd 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Not explicitly aiming for full support for [every GNU make feature](https://www.
- signal handling not implemented
- library handling not implemented
- some POSIX-specified features are pending (search `TODO` for a list)
-- builtin macro `MAKE` is defined as `makers`
+- builtin macro `MAKE` is defined as the path to `makers`
- specifying the `.POSIX` special target doesn't opt out of extensions (but you can install with `--no-default-features` to get only POSIX behavior)
## status
diff --git a/src/makefile/macro.rs b/src/makefile/macro.rs
index 831ec5e..0ab1b4b 100644
--- a/src/makefile/macro.rs
+++ b/src/makefile/macro.rs
@@ -193,20 +193,23 @@ fn builtins() -> Vec<(&'static str, TokenString)> {
// Fuck it, might as well.
macro_rules! handle {
($value:ident) => {
- stringify!($value)
+ stringify!($value).parse().unwrap()
};
($value:literal) => {
+ $value.parse().unwrap()
+ };
+ ($value:expr) => {
$value
};
}
macro_rules! make {
($($name:ident=$value:tt)+) => {vec![$(
- (stringify!($name), handle!($value).parse().unwrap())
+ (stringify!($name), handle!($value))
),+]};
}
make![
- MAKE=makers
+ MAKE=(std::env::current_exe().map_or_else(|_| TokenString::text("makers"), |x| TokenString::text(x.to_string_lossy())))
AR=ar
YACC=yacc
YFLAGS=""