On Thu, 12 Nov 2020 at 15:39, Bill Schmidt via Gcc <gcc@gcc.gnu.org> wrote: > > Hi! I'm working on a project where it's desirable to generate a > target-specific header > file while building GCC, and install it with the rest of the target-specific > headers > (i.e., in lib/gcc/<target>/11.0.0/include). Today it appears that only those > headers > listed in "extra_headers" in config.gcc will be placed there, and those are > assumed to > be found in gcc/config/<target>. In my case, the header file will end up in > my build > directory instead. > > Questions: > > * Has anyone tried something like this before? I didn't find anything. > * If so, can you please point me to an example? > * Otherwise, I'd be interested in advice about providing new infrastructure > to support > this. I'm a relative noob with respect to the configury code, and I'm > sure my > initial instincts will be wrong. :)
I don't know how relevant it is to your requirement, but libstdc++ creates a target-specific $target/bits/c++config.h header for each multilib target, but it installs them alongside the rest of the C++ library headers, not in lib/gcc/<target>/. It's done with a bunch of shell commands that takes the autoconf-generated config.h file, combines it with a template file that's in the source repo (libstdc++-v3/include/bits/c++config) and then modifies it with sed. See the ${host_builddir}/c++config.h target in libstdc++-v3/include/Makefile.am for the gory details. The other make targets below it (for gthr-single.h and gthr-posix.h) are also target-specific. Those headers are listed in the ${allcreated} variable which is a prerequisite of the all-local target, and then in the install target they get copied into place.