File 1094-Take-make-1-executable-name-from-MAKE-environment-va.patch of Package erlang

From 1e40fa89943a1a3b0ac8fb765ad70178429cb0b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?=
 <jean-sebastien.pedron@dumbbell.fr>
Date: Wed, 2 Oct 2024 12:52:18 +0200
Subject: [PATCH] Take make(1) executable name from `$MAKE` environment
 variable

[Why]
A few places have the executable name hard-coded to `make`. However, the
Makefiles require GNU make, which is might be available as another name.
For instance, on *BSD where make(1) is another implementation, GNU make
is available ase `gmake`.

This was not a problem when building Erlang/OTP. But it was when running
the tests.

[How]
The make variable `$(MAKE)` which always contain the name of (or path
to) the make executable being used, is passed to the shell scripts. The
shell scripts then use this variable, defaulting to `make` if necessary.

In `lib/common_test/test_server/configure.ac`, the order in which the
make executable is detected is swapped: `gmake` is tried first, then
`make`.
---
 Makefile.in                              | 3 ++-
 lib/common_test/test_server/configure    | 2 +-
 lib/common_test/test_server/configure.ac | 2 +-
 make/app_targets.mk                      | 2 +-
 make/test_target_script.sh               | 8 ++++----
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index ec5988348c..79c605a9c7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -976,7 +976,8 @@ bootstrap_clean:
 .PHONY: test dialyzer
 
 test: all release release_tests
-	$(ERL_TOP)/make/test_target_script.sh $(ERL_TOP)
+	MAKE="$(MAKE)" \
+	  $(ERL_TOP)/make/test_target_script.sh $(ERL_TOP)
 
 dialyzer: all
 	$(ERL_TOP)/scripts/run-dialyzer
diff --git a/lib/common_test/test_server/configure b/lib/common_test/test_server/configure
index c2cde61897..b3a8b2e698 100755
--- a/lib/common_test/test_server/configure
+++ b/lib/common_test/test_server/configure
@@ -4745,7 +4745,7 @@ if test -n "$JAVAC"; then
   :
 fi
 
-for ac_prog in make gmake
+for ac_prog in gmake make
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
diff --git a/lib/common_test/test_server/configure.in b/lib/common_test/test_server/configure.in
index 9012987e19..af2687f049 100644
--- a/lib/common_test/test_server/configure.in
+++ b/lib/common_test/test_server/configure.in
@@ -498,7 +498,7 @@ if test -n "$JAVAC"; then
   :
 fi
 
-AC_CHECK_PROGS([make_command], [make gmake], [false])
+AC_CHECK_PROGS([make_command], [gmake make], [false])
 AC_SUBST(make_command)
 
 if test "$GCC" = yes; then
diff --git a/make/app_targets.mk b/make/app_targets.mk
index 6461d5bfa5..52b52d6456 100644
--- a/make/app_targets.mk
+++ b/make/app_targets.mk
@@ -23,7 +23,8 @@ APPLICATION ?= $(basename $(notdir $(PWD)))
 .PHONY: test info gclean dialyzer dialyzer_plt dclean
 
 test:
-	$(ERL_TOP)/make/test_target_script.sh $(ERL_TOP)
+	MAKE="$(MAKE)" \
+	  $(ERL_TOP)/make/test_target_script.sh $(ERL_TOP)
 
 info:
 	@echo "$(APPLICATION)_VSN:   $(VSN)"
diff --git a/make/test_target_script.sh b/make/test_target_script.sh
index 83e614135a..868436a3c5 100755
--- a/make/test_target_script.sh
+++ b/make/test_target_script.sh
@@ -204,7 +204,7 @@ fi
 mkdir -p "$MAKE_TEST_DIR"
 mkdir -p "$MAKE_TEST_REL_DIR"
 mkdir -p "$MAKE_TEST_CT_LOGS"
-make RELSYSDIR=$MAKE_TEST_REL_DIR release_tests_spec > $RELEASE_TEST_SPEC_LOG 2>&1
+${MAKE:-make} RELSYSDIR=$MAKE_TEST_REL_DIR release_tests_spec > $RELEASE_TEST_SPEC_LOG 2>&1
 
 if [ $? != 0 ]
 then
@@ -225,7 +225,7 @@ then
     ARGS="$SPEC_FLAG $SPEC_FILE"
 fi
 # Compile test server
-(cd "$ERL_TOP/lib/common_test/test_server" && make)
+(cd "$ERL_TOP/lib/common_test/test_server" && ${MAKE:-make})
 # Run ct_run
 cd $MAKE_TEST_REL_DIR
 
-- 
2.43.0

openSUSE Build Service is sponsored by