build: Replace seq for portability with GNU Make variant

Some hosts like AIX don't have seq command, this patch replaces it
with something that uses just GNU make features we've been using
for this already before for the parallel make check.

2023-05-06  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.in (check_p_numbers): Rename to one_to_9999, move
	earlier with helper variables also renamed.
	(MATCH_SPLUT_SEQ): Use $(wordlist 1,$(NUM_MATCH_SPLITS),$(one_to_9999))
	instead of $(shell seq 1 $(NUM_MATCH_SPLITS)).
	(check_p_subdirs): Use $(one_to_9999) instead of $(check_p_numbers).
This commit is contained in:
Jakub Jelinek 2023-05-06 02:32:17 +02:00
parent 2ab31cde21
commit 319aef8d2f

View file

@ -214,9 +214,19 @@ rtl-ssa-warn = $(STRICT_WARN)
GCC_WARN_CFLAGS = $(LOOSE_WARN) $(C_LOOSE_WARN) $($(@D)-warn) $(if $(filter-out $(STRICT_WARN),$($(@D)-warn)),,$(C_STRICT_WARN)) $(NOCOMMON_FLAG) $($@-warn)
GCC_WARN_CXXFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) $($@-warn)
# 1 2 3 ... 9999
one_to_9999_0:=1 2 3 4 5 6 7 8 9
one_to_9999_1:=0 $(one_to_9999_0)
one_to_9999_2:=$(foreach i,$(one_to_9999_0),$(addprefix $(i),$(one_to_9999_1)))
one_to_9999_3:=$(addprefix 0,$(one_to_9999_1)) $(one_to_9999_2)
one_to_9999_4:=$(foreach i,$(one_to_9999_0),$(addprefix $(i),$(one_to_9999_3)))
one_to_9999_5:=$(addprefix 0,$(one_to_9999_3)) $(one_to_9999_4)
one_to_9999_6:=$(foreach i,$(one_to_9999_0),$(addprefix $(i),$(one_to_9999_5)))
one_to_9999:=$(one_to_9999_0) $(one_to_9999_2) $(one_to_9999_4) $(one_to_9999_6)
# The number of splits to be made for the match.pd files.
NUM_MATCH_SPLITS = @DEFAULT_MATCHPD_PARTITIONS@
MATCH_SPLITS_SEQ = $(shell seq 1 $(NUM_MATCH_SPLITS))
MATCH_SPLITS_SEQ = $(wordlist 1,$(NUM_MATCH_SPLITS),$(one_to_9999))
GIMPLE_MATCH_PD_SEQ_SRC = $(patsubst %, gimple-match-%.cc, $(MATCH_SPLITS_SEQ))
GIMPLE_MATCH_PD_SEQ_O = $(patsubst %, gimple-match-%.o, $(MATCH_SPLITS_SEQ))
GENERIC_MATCH_PD_SEQ_SRC = $(patsubst %, generic-match-%.cc, $(MATCH_SPLITS_SEQ))
@ -4234,18 +4244,10 @@ $(patsubst %,%-subtargets,$(lang_checks)): check-%-subtargets:
check_p_tool=$(firstword $(subst _, ,$*))
check_p_count=$(check_$(check_p_tool)_parallelize)
check_p_subno=$(word 2,$(subst _, ,$*))
check_p_numbers0:=1 2 3 4 5 6 7 8 9
check_p_numbers1:=0 $(check_p_numbers0)
check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
check_p_subdir=$(subst _,,$*)
check_p_subdirs=$(wordlist 1,$(check_p_count),$(wordlist 1, \
$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128), \
$(check_p_numbers)))
$(one_to_9999)))
# For parallelized check-% targets, this decides whether parallelization
# is desirable (if -jN is used). If desirable, recursive make is run with