Hi Sam and Tom! On 2024-12-06T09:13:40+0000, Sam James <s...@gentoo.org> wrote: > Providing parameters to `.` when sourcing is a bashism and not supported > by POSIX shell which causes a build failure when compiling a toolchain > for nvptx-none with dash as /bin/sh.
Hmm, something must be wrong in that statement, as I'm regularly building GCC/nvptx on a system with '/bin/sh -> dash'. > gen-copyright.sh takes a parameter for the format of copyright notice > required. Switch that to using an environment variable `NVPTX_GEN_COPYRIGHT`, > although this could be changed to a function if desired (just more churn > in gen-copyright.sh then). > > gcc/ChangeLog: > PR target/117854 > > * config/nvptx/gen-copyright.sh: Read NVPTX_GEN_COPYRIGHT envvar. > * config/nvptx/gen-h.sh: Set NVPTX_GEN_COPYRIGHT. > * config/nvptx/gen-opt.sh: Ditto. > --- > Testing it now with a build for nvptx-none. Is this approach OK or > would you prefer the function approach (which will make the diff larger > because of reformatting)? First: Tom, what was your original intention why we'd keep the generated files in the sources? (..., instead of just generating them at build time, like 'gcc/config/nvptx/t-omp-device' does for 'omp-device-properties-nvptx', for example. In that case, we could just skip adding these copyright/licensing headers.) Second: why not just invoke 'gen-copyright.sh' instead of sourcing it? Grüße Thomas > gcc/config/nvptx/gen-copyright.sh | 2 +- > gcc/config/nvptx/gen-h.sh | 2 +- > gcc/config/nvptx/gen-opt.sh | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gcc/config/nvptx/gen-copyright.sh > b/gcc/config/nvptx/gen-copyright.sh > index d0a86acb832c..b140de0eb76d 100644 > --- a/gcc/config/nvptx/gen-copyright.sh > +++ b/gcc/config/nvptx/gen-copyright.sh > @@ -18,7 +18,7 @@ > # along with GCC; see the file COPYING3. If not see > # <http://www.gnu.org/licenses/>. > > -style="$1" > +style="${1:-${NVPTX_GEN_COPYRIGHT}}" > case $style in > opt) > ;; > diff --git a/gcc/config/nvptx/gen-h.sh b/gcc/config/nvptx/gen-h.sh > index ea75e127cdeb..beafd5a9d2c4 100644 > --- a/gcc/config/nvptx/gen-h.sh > +++ b/gcc/config/nvptx/gen-h.sh > @@ -32,7 +32,7 @@ EOF > # Separator. > echo > > -. $gen_copyright_sh c > +NVPTX_GEN_COPYRIGHT=c . $gen_copyright_sh > > # Separator. > echo > diff --git a/gcc/config/nvptx/gen-opt.sh b/gcc/config/nvptx/gen-opt.sh > index 6022f51f8975..267a5005f66b 100644 > --- a/gcc/config/nvptx/gen-opt.sh > +++ b/gcc/config/nvptx/gen-opt.sh > @@ -36,7 +36,7 @@ EOF > # Separator. > echo > > -. $gen_copyright_sh opt > +NVPTX_GEN_COPYRIGHT=opt . $gen_copyright_sh > > # Not emitting the following here (in addition to having it in 'nvptx.opt'), > as > # we'll otherwise run into: > -- > 2.47.1