Hi all, I know I can just push to mob, but am I missing anything here?
From 3bb399f181f3a8e9afb9a4a26835bbd8982b513e Mon Sep 17 00:00:00 2001 From: Thomas Ulmer <[email protected]> Date: Thu, 5 Mar 2026 08:50:15 -0800 Subject: [PATCH] add -MT exposing generated rule target --- libtcc.c | 7 +++++++ tcc-doc.texi | 3 +++ tcc.c | 5 ++++- tcc.h | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/libtcc.c b/libtcc.c index 171e3622..d3dde914 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1569,6 +1569,7 @@ enum { TCC_OPTION_MM, TCC_OPTION_MMD, TCC_OPTION_MP, + TCC_OPTION_MT, TCC_OPTION_x, TCC_OPTION_ar, TCC_OPTION_impdef, @@ -1676,6 +1677,7 @@ static const TCCOption tcc_options[] = { { "MMD", TCC_OPTION_MMD, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, { "MF", TCC_OPTION_MF, TCC_OPTION_HAS_ARG }, { "MP", TCC_OPTION_MP, 0}, + { "MT", TCC_OPTION_MT, TCC_OPTION_HAS_ARG }, { "x", TCC_OPTION_x, TCC_OPTION_HAS_ARG }, /* tcctools */ { "ar", TCC_OPTION_ar, 0}, @@ -2137,6 +2139,11 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv) case TCC_OPTION_MP: s->gen_phony_deps = 1; break; + case TCC_OPTION_MT: + if (s->target_name) + tcc_warning("multiple -MT option, using last"); + tcc_set_str(&s->target_name, optarg); + break; case TCC_OPTION_dumpmachine: printf("%s\n", dumpmachine_str); diff --git a/tcc-doc.texi b/tcc-doc.texi index 9a9695f7..c6e05822 100644 --- a/tcc-doc.texi +++ b/tcc-doc.texi @@ -452,6 +452,9 @@ Like -MD except mention only user header files, not system header files. @item -MF depfile Use @file{depfile} as output for -MD. +@item -MT target +Use @option{target} as target for -MD generated rule. + @item -MP Mention all dependencies as targets too. diff --git a/tcc.c b/tcc.c index e1819239..83133621 100644 --- a/tcc.c +++ b/tcc.c @@ -403,7 +403,10 @@ redo: if (!s->just_deps) ret = tcc_output_file(s, s->outfile); if (!ret && s->gen_deps) - gen_makedeps(s, s->outfile, s->deps_outfile); + if (s->target_name) + gen_makedeps(s, s->target_name, s->deps_outfile); + else + gen_makedeps(s, s->outfile, s->deps_outfile); } } diff --git a/tcc.h b/tcc.h index e7a2f1e2..dbe9dda7 100644 --- a/tcc.h +++ b/tcc.h @@ -864,6 +864,7 @@ struct TCCState { /* for -MD/-MF: collected dependencies for this compilation */ char **target_deps; int nb_target_deps; + char *target_name; /* if -MT supplied */ /* compilation */ BufferedFile *include_stack[INCLUDE_STACK_SIZE]; -- 2.53.0 _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
