]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
'gcc/config/nvptx/t-nvptx': Don't use the 'shell' function of 'make'
authorThomas Schwinge <tschwinge@baylibre.com>
Mon, 2 Dec 2024 14:06:58 +0000 (15:06 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Fri, 6 Dec 2024 08:57:49 +0000 (09:57 +0100)
The exit status of the command invoked in a 'Makefile' via '$(shell [...])'
effectively gets discarded (unless explicitly checking the GNU Make 4.2+
'.SHELLSTATUS' variable or jumping through other hoops).  In order to be able
to catch errors in what the 'shell' function invokes, let's make things
explicit: similar to how 'gcc/config/avr/t-avr' is doing with 't-multilib-avr',
for example.

gcc/
* config/nvptx/t-nvptx (multilib_matches): Don't use the 'shell'
function of 'make'.
* config/nvptx/gen-multilib-matches.sh: Adjust.

gcc/config/nvptx/gen-multilib-matches.sh
gcc/config/nvptx/t-nvptx

index 44c758c3b1bf6210a7471acef5056b8126c5b3f9..a39baee5cd2426c525e3886f99a47a8062445096 100755 (executable)
@@ -33,6 +33,8 @@ sms=$(grep ^NVPTX_SM $nvptx_sm_def | sed 's/.*(//;s/,.*//')
 # ('misa=sm_SM'; thus not remapped), or has to be remapped to the "next lower"
 # variant that does get built.
 
+multilib_matches=
+
 # The "lowest" variant has to be built.
 sm_next_lower=INVALID
 
@@ -50,11 +52,14 @@ for sm in $sms; do
     else
        # Output format as required for 'MULTILIB_MATCHES'.
        if [ x"$sm_map" = x. ]; then
-           echo ".=misa?sm_$sm"
+           multilib_matches_sm=".=misa?sm_$sm"
        else
-           echo "misa?sm_$sm_map=misa?sm_$sm"
+           multilib_matches_sm="misa?sm_$sm_map=misa?sm_$sm"
        fi
+       multilib_matches="$multilib_matches $multilib_matches_sm"
 
        sm_next_lower=$sm_map
     fi
 done
+
+echo "multilib_matches := $multilib_matches"
index 9c5cbda0070749fe47b79d245aca664e37f94fc8..6c6a6329f0f8d85d085e6f419fccdcf484cfde90 100644 (file)
@@ -43,12 +43,24 @@ MULTILIB_OPTIONS += mgomp
 multilib_options_isa_list := $(TM_MULTILIB_CONFIG)
 multilib_options_isa_default := $(word 1,$(multilib_options_isa_list))
 multilib_options_misa_list := $(addprefix misa=,$(multilib_options_isa_list))
+
+t-nvptx-gen-multilib-matches: $(srcdir)/config/nvptx/gen-multilib-matches.sh \
+  $(srcdir)/config/nvptx/t-nvptx \
+  Makefile \
+  $(srcdir)/config/nvptx/nvptx-sm.def
+       $(SHELL) $< \
+         $(dir $<) \
+         $(multilib_options_isa_default) \
+         '$(multilib_options_isa_list)' \
+         > $@
+
+include t-nvptx-gen-multilib-matches
+
 # Add the requested '-misa' variants as a multilib option ('misa=VAR1/misa=VAR2/misa=VAR3' etc.):
 empty :=
 space := $(empty) $(empty)
 MULTILIB_OPTIONS += $(subst $(space),/,$(multilib_options_misa_list))
 # ..., and remap '-misa' variants as appropriate:
-multilib_matches := $(shell $(srcdir)/config/nvptx/gen-multilib-matches.sh $(srcdir)/config/nvptx $(multilib_options_isa_default) "$(multilib_options_isa_list)")
 MULTILIB_MATCHES += $(multilib_matches)
 # ..., and don't actually build what's the default '-misa':
 MULTILIB_EXCEPTIONS += *misa=$(multilib_options_isa_default)*