On Wed, 30 Nov 2022 at 15:59, Michael Matz wrote:
> If you're looking at the C frontends for inspiration, then:
>
> c-family/c.opt defines which options are recognized and several specifics
> about them, e.g. for -I it has:
>
> ----
> I
> C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs)
> -I <dir>        Add <dir> to the end of the main include path.
> ----
>
> (look at some other examples therein, also in common.opt to get a feel).

There is also https://gcc.gnu.org/onlinedocs/gccint/Options.html
describing these files.


> If you're also using the model of a compiler driver (i.e. the gcc program,
> source in gcc.cc) that actually calls compiler (cc1), assembler and
> linker, then you also need to arrange for that program to pass all -I
> options to the compiler proper.  That is done with the spec language, by
> somewhere having '{I*}' in the specs for invoking the cobol compiler.
> E.g. look in gcc.cc for '@c' (matching the file extension) how that entry
> uses '%(cpp_unique_options)', and how cpp_unique_options is defined for
> the specs language:
>
>   INIT_STATIC_SPEC ("cpp_unique_options",       &cpp_unique_options),
>
> and
>
> static const char *cpp_unique_options =
>   "%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %@{I*&F*} %{P} %I\
>
> (the specs language used here is documented in a lengthy comment early in
> gcc.cc, "The Specs Language")


Also documented at https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html

Reply via email to