aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/input.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-06 15:23:21 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-06 15:23:21 -0600
commit64ba56eda176e22351331c76d78a7238c6e7189f (patch)
treed92acd788621543488efba1649e532b01052b9a7 /src/makefile/input.rs
parentec5fbe5227edc53bb02ac0896ac62e9e21f8e92a (diff)
downloadmakers-64ba56eda176e22351331c76d78a7238c6e7189f.tar.gz
makers-64ba56eda176e22351331c76d78a7238c6e7189f.zip
handle else ifs correctly
Diffstat (limited to 'src/makefile/input.rs')
-rw-r--r--src/makefile/input.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs
index 700bf4b..601a159 100644
--- a/src/makefile/input.rs
+++ b/src/makefile/input.rs
@@ -766,6 +766,25 @@ endef
Ok(())
}
+ #[cfg(feature = "full")]
+ #[test]
+ fn elseif() -> R {
+ let file = "
+ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
+ KBUILD_CFLAGS += -O2
+else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
+ KBUILD_CFLAGS += -O3
+else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+ KBUILD_CFLAGS += -Os
+endif
+FOO = bar
+";
+ let args = Args::empty();
+ let makefile = MakefileReader::read(&args, MacroSet::new(), Cursor::new(file))?;
+ assert_eq!(makefile.expand_macros(&TokenString::r#macro("FOO"))?, "bar",);
+ Ok(())
+ }
+
#[test]
#[cfg(feature = "full")]
fn eval() -> R {