aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cli.c
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-31 00:28:00 +0900
committernsfisis <nsfisis@gmail.com>2025-08-31 12:04:19 +0900
commitda65f1e21a24f0a173ee5ae08f00db91cba5ffda (patch)
tree3ec802f40d7cd0bd9e162ea5b3e50b76f319a884 /src/cli.c
parenta5ee9d944edf665c814bbfeded2849f2bb980ed8 (diff)
downloadducc-da65f1e21a24f0a173ee5ae08f00db91cba5ffda.tar.gz
ducc-da65f1e21a24f0a173ee5ae08f00db91cba5ffda.tar.zst
ducc-da65f1e21a24f0a173ee5ae08f00db91cba5ffda.zip
feat: support -MMD flag
Diffstat (limited to 'src/cli.c')
-rw-r--r--src/cli.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cli.c b/src/cli.c
index ccc64b9..d4297aa 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -5,6 +5,7 @@ CliArgs* parse_cli_args(int argc, char** argv) {
const char* output_filename = NULL;
int positional_arguments_start = -1;
BOOL only_compile = FALSE;
+ BOOL generate_deps = FALSE;
for (int i = 1; i < argc; ++i) {
if (argv[i][0] != '-') {
@@ -16,8 +17,8 @@ CliArgs* parse_cli_args(int argc, char** argv) {
// ignore
} else if (c == 'O') {
// ignore
- } else if (c == 'M') {
- // ignore
+ } else if (c == 'M' && argv[i][2] == '\0') {
+ // ignore -M
} else if (c == 'o') {
if (argc <= i + 1) {
fatal_error("-o requires filename");
@@ -26,6 +27,8 @@ CliArgs* parse_cli_args(int argc, char** argv) {
++i;
} else if (c == 'c') {
only_compile = TRUE;
+ } else if (strcmp(argv[i], "-MMD") == 0) {
+ generate_deps = TRUE;
} else {
fatal_error("unknown option: %s", argv[i]);
}
@@ -41,6 +44,7 @@ CliArgs* parse_cli_args(int argc, char** argv) {
a->only_compile = only_compile;
a->totally_deligate_to_gcc = FALSE;
a->gcc_command = NULL;
+ a->generate_deps = generate_deps;
if (!a->only_compile && str_ends_with(a->input_filename, ".o")) {
a->totally_deligate_to_gcc = TRUE;