What we currently pass in as '$1' is simply 'dirname "$0"'.
gcc/
* config/nvptx/gen-h.sh: Don't pass in '$1'; compute it locally.
* config/nvptx/gen-multilib-matches.sh: Likewise.
* config/nvptx/gen-omp-device-properties.sh: Likewise.
* config/nvptx/gen-opt.sh: Likewise.
* config/nvptx/t-nvptx (s-nvptx-gen-h:, s-nvptx-gen-opt:)
(t-nvptx-gen-multilib-matches:): Adjust.
* config/nvptx/t-omp-device (omp-device-properties-nvptx):
Likewise.
---
gcc/config/nvptx/gen-h.sh | 8 ++++++--
gcc/config/nvptx/gen-multilib-matches.sh | 8 ++++++--
gcc/config/nvptx/gen-omp-device-properties.sh | 6 +++++-
gcc/config/nvptx/gen-opt.sh | 8 ++++++--
gcc/config/nvptx/t-nvptx | 5 ++---
gcc/config/nvptx/t-omp-device | 2 +-
6 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/gcc/config/nvptx/gen-h.sh b/gcc/config/nvptx/gen-h.sh
index ea75e127cdeb..bc4ce9af1e2a 100644
--- a/gcc/config/nvptx/gen-h.sh
+++ b/gcc/config/nvptx/gen-h.sh
@@ -18,8 +18,12 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-nvptx_sm_def="$1/nvptx-sm.def"
-gen_copyright_sh="$1/gen-copyright.sh"
+
+nvptx_dir=$(dirname "$0")
+
+
+nvptx_sm_def="$nvptx_dir/nvptx-sm.def"
+gen_copyright_sh="$nvptx_dir/gen-copyright.sh"
sms=$(grep ^NVPTX_SM $nvptx_sm_def | sed 's/.*(//;s/,.*//')
diff --git a/gcc/config/nvptx/gen-multilib-matches.sh
b/gcc/config/nvptx/gen-multilib-matches.sh
index e52d57130476..09761a9e6907 100755
--- a/gcc/config/nvptx/gen-multilib-matches.sh
+++ b/gcc/config/nvptx/gen-multilib-matches.sh
@@ -22,11 +22,15 @@
set -e
-nvptx_sm_def="$1/nvptx-sm.def"
-shift
+
+nvptx_dir=$(dirname "$0")
+
+
+nvptx_sm_def="$nvptx_dir/nvptx-sm.def"
sms=$(grep ^NVPTX_SM $nvptx_sm_def | sed 's/.*(//;s/,.*//')
+
# Every variant in 'sms' has to either be remapped to the default variant
# ('.', which is always built), or does get built as non-default variant
# ('misa=sm_SM'; thus not remapped), or has to be remapped to the "next lower"
diff --git a/gcc/config/nvptx/gen-omp-device-properties.sh
b/gcc/config/nvptx/gen-omp-device-properties.sh
index 3666f9746d1a..5995d49ed72c 100644
--- a/gcc/config/nvptx/gen-omp-device-properties.sh
+++ b/gcc/config/nvptx/gen-omp-device-properties.sh
@@ -18,7 +18,11 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-nvptx_sm_def="$1/nvptx-sm.def"
+
+nvptx_dir=$(dirname "$0")
+
+
+nvptx_sm_def="$nvptx_dir/nvptx-sm.def"
sms=$(grep ^NVPTX_SM $nvptx_sm_def | sed 's/.*(//;s/,.*//')
diff --git a/gcc/config/nvptx/gen-opt.sh b/gcc/config/nvptx/gen-opt.sh
index 6022f51f8975..103bcddc02b5 100644
--- a/gcc/config/nvptx/gen-opt.sh
+++ b/gcc/config/nvptx/gen-opt.sh
@@ -18,8 +18,12 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-nvptx_sm_def="$1/nvptx-sm.def"
-gen_copyright_sh="$1/gen-copyright.sh"
+
+nvptx_dir=$(dirname "$0")
+
+
+nvptx_sm_def="$nvptx_dir/nvptx-sm.def"
+gen_copyright_sh="$nvptx_dir/gen-copyright.sh"
sms=$(grep ^NVPTX_SM $nvptx_sm_def | sed 's/.*(//;s/,.*//')
diff --git a/gcc/config/nvptx/t-nvptx b/gcc/config/nvptx/t-nvptx
index 6c6a6329f0f8..00a7b15496e0 100644
--- a/gcc/config/nvptx/t-nvptx
+++ b/gcc/config/nvptx/t-nvptx
@@ -16,7 +16,7 @@ mkoffload$(exeext): mkoffload.o collect-utils.o
libcommon-target.a $(LIBIBERTY)
$(srcdir)/config/nvptx/nvptx.h: $(srcdir)/config/nvptx/nvptx-gen.h
$(srcdir)/config/nvptx/nvptx-gen.h: s-nvptx-gen-h; @true
s-nvptx-gen-h: $(srcdir)/config/nvptx/nvptx-sm.def
- $(SHELL) $(srcdir)/config/nvptx/gen-h.sh "$(srcdir)/config/nvptx" \
+ $(SHELL) $(srcdir)/config/nvptx/gen-h.sh \
> tmp-nvptx-gen.h
$(SHELL) $(srcdir)/../move-if-change \
tmp-nvptx-gen.h $(srcdir)/config/nvptx/nvptx-gen.h
@@ -25,7 +25,7 @@ s-nvptx-gen-h: $(srcdir)/config/nvptx/nvptx-sm.def
$(srcdir)/config/nvptx/nvptx-gen.opt: s-nvptx-gen-opt; @true
s-nvptx-gen-opt: $(srcdir)/config/nvptx/nvptx-sm.def \
$(srcdir)/config/nvptx/gen-opt.sh
- $(SHELL) $(srcdir)/config/nvptx/gen-opt.sh "$(srcdir)/config/nvptx" \
+ $(SHELL) $(srcdir)/config/nvptx/gen-opt.sh \
> tmp-nvptx-gen.opt
$(SHELL) $(srcdir)/../move-if-change \
tmp-nvptx-gen.opt $(srcdir)/config/nvptx/nvptx-gen.opt
@@ -49,7 +49,6 @@ t-nvptx-gen-multilib-matches:
$(srcdir)/config/nvptx/gen-multilib-matches.sh \
Makefile \
$(srcdir)/config/nvptx/nvptx-sm.def
$(SHELL) $< \
- $(dir $<) \
$(multilib_options_isa_default) \
'$(multilib_options_isa_list)' \
> $@
diff --git a/gcc/config/nvptx/t-omp-device b/gcc/config/nvptx/t-omp-device
index c2b28a41ee41..6785dddd2f4b 100644
--- a/gcc/config/nvptx/t-omp-device
+++ b/gcc/config/nvptx/t-omp-device
@@ -1,3 +1,3 @@
omp-device-properties-nvptx: $(srcdir)/config/nvptx/nvptx-sm.def
$(SHELL) $(srcdir)/config/nvptx/gen-omp-device-properties.sh \
- "$(srcdir)/config/nvptx" > $@
+ > $@
--
2.34.1