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
Show summary of options.
.TP
.B \-I, \-\-include DIR
.B \-I DIR
Add DIR to the list of directories for the preprocessor to search when looking
for include files.
.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
Add DIR to the search path used for -l.
.TP

View file

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