use makemake::prelude::*; fn main() { let mut makefile = Makefile::new(); makefile.comment("Generated by makemake!"); makefile.newline(); let src = makefile.assign("SRC", Function::wildcard([expr!("src/*.c")])); let obj = makefile.assign("OBJ", Substitution::new(src, ".c", ".o")); let cc = makefile.assign_without_overwrite( "CC", Function::shell("which gcc || which clang") ); let cflags = makefile.append("CFLAGS", "-std=c99 -Wall -Wextra"); let target = makefile.assign("TARGET", "main"); makefile.newline(); makefile .rule(target) .phony() .dep("main.c") .dep(obj) .cmd(expr!( cc; cflags; "-o"; makefile.target_var(); makefile.deps_var() )); makefile .rule("clean") .phony() .dep(target) .dep(obj) .cmd(expr!("rm -rf", makefile.deps_var())); print!("{}", makefile.build()); }