change --include FILE to pre-include a file rather than add a directory search

path. Maps to -include FILE on the cpp command line.
This commit is contained in:
Bill Currie 2004-02-13 04:46:50 +00:00
parent ac577232db
commit b6c2320d5d
2 changed files with 23 additions and 45 deletions

View file

@ -70,10 +70,14 @@ Generate debugging info. Synonym for \fB\-\-code debug\fP.
.B \-h, \-\-help .B \-h, \-\-help
Show summary of options. Show summary of options.
.TP .TP
.B \-I, \-\-include DIR .B \-I DIR
Add DIR to the list of directories for the preprocessor to search when looking Add DIR to the list of directories for the preprocessor to search when looking
for include files. for include files.
.TP .TP
.B \-\-include FILE
Process FILE as if \fB#include "FILE"\fP appeared as the first line of
the primary source file. See the cpp man page (\fB\-include\fP) for details.
.TP
.B \-L DIR .B \-L DIR
Add DIR to the search path used for -l. Add DIR to the search path used for -l.
.TP .TP

View file

@ -74,7 +74,7 @@ static struct option const long_options[] = {
{"advanced", no_argument, 0, 258}, {"advanced", no_argument, 0, 258},
{"strip-path", required_argument, 0, 'p'}, {"strip-path", required_argument, 0, 'p'},
{"define", required_argument, 0, 'D'}, {"define", required_argument, 0, 'D'},
{"include", required_argument, 0, 'I'}, {"include", required_argument, 0, 259},
{"undefine", required_argument, 0, 'U'}, {"undefine", required_argument, 0, 'U'},
{"cpp", required_argument, 0, 256}, {"cpp", required_argument, 0, 256},
{"notice", required_argument, 0, 'N'}, {"notice", required_argument, 0, 'N'},
@ -134,10 +134,13 @@ usage (int status)
" -h, --help Display this help and exit\n" " -h, --help Display this help and exit\n"
" -V, --version Output version information and exit\n\n" " -V, --version Output version information and exit\n\n"
" -S, --save-temps Do not delete temporary files\n" " -S, --save-temps Do not delete temporary files\n"
" -D, --define SYMBOL[=VAL],... Define symbols for the preprocessor\n" " -D, --define SYMBOL[=VAL] Define symbols for the preprocessor\n"
" -I, --include DIR,... Set directories for the preprocessor\n" " -I DIR Set directories for the preprocessor\n"
" to search for #includes\n" " to search for #includes\n"
" -U, --undefine SYMBOL,... Undefine preprocessor symbols\n" " --include FILE Process file as if `#include \"file\"'\n"
" appeared as the first line of the primary\n"
" source file.\n"
" -U, --undefine SYMBOL Undefine preprocessor symbols\n"
" --cpp CPPSPEC cpp execution command line\n" " --cpp CPPSPEC cpp execution command line\n"
" -L DIR Add linker library search path\n" " -L DIR Add linker library search path\n"
" -l LIB Link with libLIB.a\n" " -l LIB Link with libLIB.a\n"
@ -349,47 +352,18 @@ DecodeArgs (int argc, char **argv)
case 'S': // save temps case 'S': // save temps
options.save_temps = true; options.save_temps = true;
break; break;
case 'D':{ // defines for cpp case 'D': // defines for cpp
add_cpp_def (nva ("%s%s", "-D", optarg)); add_cpp_def (nva ("%s%s", "-D", optarg));
#if 0
char *opts = strdup (optarg);
char *temp = strtok (opts, ",");
while (temp) {
add_cpp_def (nva ("%s%s", "-D", temp));
temp = strtok (NULL, ",");
}
free (opts);
#endif
}
break; break;
case 'I':{ // includes case 259: // include-file
add_cpp_def (nva ("%s", "-include"));
add_cpp_def (nva ("%s", optarg));
break;
case 'I': // includes
add_cpp_def (nva ("%s%s", "-I", optarg)); add_cpp_def (nva ("%s%s", "-I", optarg));
#if 0
char *opts = strdup (optarg);
char *temp = strtok (opts, ",");
while (temp) {
add_cpp_def (nva ("%s%s", "-I", temp));
temp = strtok (NULL, ",");
}
free (opts);
#endif
}
break; break;
case 'U':{ // undefines case 'U': // undefines
add_cpp_def (nva ("%s%s", "-U", optarg)); add_cpp_def (nva ("%s%s", "-U", optarg));
#if 0
char *opts = strdup (optarg);
char *temp = strtok (opts, ",");
while (temp) {
add_cpp_def (nva ("%s%s", "-U", temp));
temp = strtok (NULL, ",");
}
free (opts);
#endif
}
break; break;
case 'M': case 'M':
if (optarg) { if (optarg) {