aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-20 00:30:44 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-20 00:30:44 +0200
commit4086aeb61b73edb580edf16d50e77422f0bbcfa1 (patch)
treec2254f3f076c169c5f340b2f1c2fd610d15354e6
parent9a2e702f9d1204e2a807db55b6886cb72578a168 (diff)
Add the ‘gen’ subcommand
-rw-r--r--make.c14
1 files 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 {