Pass depfiles through temp defines file.

This commit is contained in:
steve 2006-07-26 00:11:40 +00:00
parent 61f3a84557
commit 2037650080
2 changed files with 19 additions and 17 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: main.c,v 1.68 2006/07/26 00:02:48 steve Exp $" #ident "$Id: main.c,v 1.69 2006/07/26 00:11:40 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -668,10 +668,7 @@ int main(int argc, char **argv)
strcpy(cmd, tmp); strcpy(cmd, tmp);
if (depfile) { if (depfile) {
cmd = realloc(cmd, ncmd + strlen(depfile) + 5); fprintf(defines_file, "M:%s\n", depfile);
strcat(cmd, " -M ");
strcat(cmd, depfile);
ncmd += strlen(depfile) + 4;
} }
/* If the -E flag was given on the command line, then all we /* If the -E flag was given on the command line, then all we
@ -724,6 +721,9 @@ int main(int argc, char **argv)
/* /*
* $Log: main.c,v $ * $Log: main.c,v $
* Revision 1.69 2006/07/26 00:11:40 steve
* Pass depfiles through temp defines file.
*
* Revision 1.68 2006/07/26 00:02:48 steve * Revision 1.68 2006/07/26 00:02:48 steve
* Pass defines and includes through temp file. * Pass defines and includes through temp file.
* *

View File

@ -17,7 +17,7 @@ const char COPYRIGHT[] =
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: main.c,v 1.21 2006/07/26 00:02:48 steve Exp $" #ident "$Id: main.c,v 1.22 2006/07/26 00:11:40 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -58,6 +58,8 @@ extern int getopt(int argc, char*argv[], const char*fmt);
extern int optind; extern int optind;
extern const char*optarg; extern const char*optarg;
#endif #endif
/* Path to the dependency file, if there is one. */
char *dep_path = NULL;
/* /*
* Keep in source_list an array of pointers to file names. The array * Keep in source_list an array of pointers to file names. The array
@ -143,6 +145,13 @@ static int flist_read_flags(const char*path)
define_macro(optarg, buf, 1); define_macro(optarg, buf, 1);
free(buf); free(buf);
} else if (strcmp(cp,"M") == 0) {
if (dep_path) {
fprintf(stderr, "duplicate -M flag.\n");
} else {
dep_path = arg;
}
} else { } else {
fprintf(stderr, "%s: Invalid keyword %s\n", path, cp); fprintf(stderr, "%s: Invalid keyword %s\n", path, cp);
} }
@ -190,7 +199,6 @@ int main(int argc, char*argv[])
const char*flist_path = 0; const char*flist_path = 0;
unsigned flag_errors = 0; unsigned flag_errors = 0;
char*out_path = 0; char*out_path = 0;
char *dep_path = NULL;
FILE*out; FILE*out;
/* Define preprocessor keywords that I plan to just pass. */ /* Define preprocessor keywords that I plan to just pass. */
@ -216,7 +224,7 @@ int main(int argc, char*argv[])
include_dir[0] = strdup("."); include_dir[0] = strdup(".");
include_cnt = 1; include_cnt = 1;
while ((opt=getopt(argc, argv, "F:f:K:LM:o:v")) != EOF) switch (opt) { while ((opt=getopt(argc, argv, "F:f:K:Lo:v")) != EOF) switch (opt) {
case 'F': case 'F':
flist_read_flags(optarg); flist_read_flags(optarg);
@ -243,14 +251,6 @@ int main(int argc, char*argv[])
line_direct_flag = 1; line_direct_flag = 1;
break; break;
case 'M':
if (dep_path) {
fprintf(stderr, "duplicate -M flag.\n");
} else {
dep_path = optarg;
}
break;
case 'o': case 'o':
if (out_path) { if (out_path) {
fprintf(stderr, "duplicate -o flag.\n"); fprintf(stderr, "duplicate -o flag.\n");
@ -277,7 +277,6 @@ int main(int argc, char*argv[])
" -f<fil> - Read the sources listed in the file\n" " -f<fil> - Read the sources listed in the file\n"
" -K<def> - Define a keyword macro that I just pass\n" " -K<def> - Define a keyword macro that I just pass\n"
" -L - Emit line number directives\n" " -L - Emit line number directives\n"
" -M<fil> - Write dependencies to <fil>\n"
" -o<fil> - Send the output to <fil>\n" " -o<fil> - Send the output to <fil>\n"
" -v - Print version information\n", " -v - Print version information\n",
argv[0]); argv[0]);
@ -336,6 +335,9 @@ int main(int argc, char*argv[])
/* /*
* $Log: main.c,v $ * $Log: main.c,v $
* Revision 1.22 2006/07/26 00:11:40 steve
* Pass depfiles through temp defines file.
*
* Revision 1.21 2006/07/26 00:02:48 steve * Revision 1.21 2006/07/26 00:02:48 steve
* Pass defines and includes through temp file. * Pass defines and includes through temp file.
* *