Add -MP option.
This commit is contained in:
parent
1bfed06c2a
commit
7a53029e4d
3 changed files with 22 additions and 0 deletions
5
libtcc.c
5
libtcc.c
|
@ -1613,6 +1613,7 @@ enum {
|
|||
TCC_OPTION_MF,
|
||||
TCC_OPTION_MM,
|
||||
TCC_OPTION_MMD,
|
||||
TCC_OPTION_MP,
|
||||
TCC_OPTION_x,
|
||||
TCC_OPTION_ar,
|
||||
TCC_OPTION_impdef,
|
||||
|
@ -1693,6 +1694,7 @@ static const TCCOption tcc_options[] = {
|
|||
{ "MF", TCC_OPTION_MF, TCC_OPTION_HAS_ARG },
|
||||
{ "MM", TCC_OPTION_MM, 0},
|
||||
{ "MMD", TCC_OPTION_MMD, 0},
|
||||
{ "MP", TCC_OPTION_MP, 0},
|
||||
{ "x", TCC_OPTION_x, TCC_OPTION_HAS_ARG },
|
||||
{ "ar", TCC_OPTION_ar, 0},
|
||||
#ifdef TCC_TARGET_PE
|
||||
|
@ -2133,6 +2135,9 @@ dorun:
|
|||
case TCC_OPTION_MF:
|
||||
s->deps_outfile = tcc_strdup(optarg);
|
||||
break;
|
||||
case TCC_OPTION_MP:
|
||||
s->gen_phony_deps = 1;
|
||||
break;
|
||||
case TCC_OPTION_dumpversion:
|
||||
printf ("%s\n", TCC_VERSION);
|
||||
exit(0);
|
||||
|
|
1
tcc.h
1
tcc.h
|
@ -796,6 +796,7 @@ struct TCCState {
|
|||
unsigned char just_deps; /* option -M */
|
||||
unsigned char gen_deps; /* option -MD */
|
||||
unsigned char include_sys_deps; /* option -MD */
|
||||
unsigned char gen_phony_deps; /* option -MP */
|
||||
|
||||
/* compile with debug symbol (and use them if error during execution) */
|
||||
unsigned char do_debug;
|
||||
|
|
16
tcctools.c
16
tcctools.c
|
@ -624,6 +624,22 @@ ST_FUNC int gen_makedeps(TCCState *s1, const char *target, const char *filename)
|
|||
next:;
|
||||
}
|
||||
fprintf(depout, "\n");
|
||||
if (s1->gen_phony_deps) {
|
||||
/* Skip first file, which is the c file.
|
||||
* This will still print any additional c files specified
|
||||
* on command-line, but e.g. clang produces broken dependency
|
||||
* files in this case as well, printing only dependencies for last
|
||||
* file in command line. So ignore this case. */
|
||||
for (i = 1; i<s1->nb_target_deps; ++i) {
|
||||
for (k = 0; k < i; ++k)
|
||||
if (0 == strcmp(s1->target_deps[i], s1->target_deps[k]))
|
||||
goto next2;
|
||||
escaped_target = escape_target_dep(s1->target_deps[i]);
|
||||
fprintf(depout, "%s:\n", escaped_target);
|
||||
tcc_free(escaped_target);
|
||||
next2:;
|
||||
}
|
||||
}
|
||||
fclose(depout);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue