From 4086aeb61b73edb580edf16d50e77422f0bbcfa1 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 20 Apr 2024 00:30:44 +0200 Subject: Add the ‘gen’ subcommand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- make.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/make.c b/make.c index 05e7189..cb1a54d 100644 --- a/make.c +++ b/make.c @@ -63,13 +63,15 @@ main(int argc, char **argv) argv += optind; if (argc >= 1) { - if (!streq(*argv, "clean")) { - diex("invalid subcommand — ‘%s’", *argv); - exit(EXIT_FAILURE); - } cmd_t c = {}; - cmdadd(&c, "find", ".", "(", "-name", "*.[ao]", "-or", "-name", "*.so", - ")", "-delete"); + if (streq(*argv, "clean")) { + cmdadd(&c, "find", ".", "(", "-name", "*.[ao]", "-or", "-name", + "*.so", ")", "-delete"); + } else if (streq(*argv, "gen")) { + cmdadd(&c, "find", "gen", "-mindepth", "2", "-type", "f", + "-executable", "-not", "-name", "scale", "-exec", "{}", ";"); + } else + diex("invalid subcommand — ‘%s’", *argv); cmdput(c); CMDRC(c); } else { -- cgit v1.2.3