Makefile.in: Export $MAKE to be used by other scripts#9164
Makefile.in: Export $MAKE to be used by other scripts#9164dumbbell wants to merge 2 commits intoerlang:maintfrom
$MAKE to be used by other scripts#9164Conversation
[Why] GNU make is sometimes installed as `gmake` and `make` points to another implementation that does not support GNU make extensions. The name of the make command is stored in `$(MAKE)` and sub-make processes automatically inherit and use this variable. However other executed commands and scripts do not get this variable by default. Therefore of a script tries to call make(1) again, it will either not find this value or, more likely, will hard-code `make`. [How] The top-level Makefile now exports the value of `$(MAKE)` into the environment of all executed sub-shells. This way, scripts can use the correct make command name if they need to run make(1) again.
... instead of always using the hard-coded `make` command name. [Why] This is useful if GNU make is installed under another name (e.g. `gmake`). [How] The correct name is passed through the `$MAKE` environment variable by the parent make instance: use it. The script defaults to `make` if the variable is unset.
CT Test Results 3 files 143 suites 48m 58s ⏱️ Results for commit 6463837. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
$MAKE to be used by other scripts
garazdawi
left a comment
There was a problem hiding this comment.
Hello!
This looks good, though I don't think the export in Makefile.in is needed as we pass MAKE=${MAKE) to test_target when we call it. Or have you found someplace where we do not?
|
I didn’t give an example in the commit message: GNU make is installed as |
I admit, I didn’t try to run the tests without the whole change, @garazdawi. Let me try with just the patch to Edit: If So the following command should set |
|
Here is another proposal: diff --git a/Makefile.in b/Makefile.in
index aaad4ba93e..f2948aa4ad 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -477,11 +473,11 @@ PROFILE_EMU_DEPS=
endif
emulator_test: emulator
- $(make_verbose)cd erts/emulator && ERL_TOP=$(ERL_TOP) TYPE=$(TYPE) $(MAKE) test
+ $(make_verbose)cd erts/emulator && ERL_TOP=$(ERL_TOP) TYPE=$(TYPE) $(MAKE) MAKE=$(MAKE) test
epmd_test:
- $(make_verbose)cd erts/epmd && ERL_TOP=$(ERL_TOP) TYPE=$(TYPE) $(MAKE) test
+ $(make_verbose)cd erts/epmd && ERL_TOP=$(ERL_TOP) TYPE=$(TYPE) $(MAKE) MAKE=$(MAKE) test
system_test:
- $(make_verbose)cd erts && ERL_TOP=$(ERL_TOP) TYPE=$(TYPE) $(MAKE) test
+ $(make_verbose)cd erts && ERL_TOP=$(ERL_TOP) TYPE=$(TYPE) $(MAKE) MAKE=$(MAKE) test
emulator: $(PROFILE_EMU_DEPS)
$(make_verbose)cd erts && ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
@@ -992,4 +988,4 @@ APPS_TEST=$(patsubst %, %_test,$(APPS))
.SECONDEXPANSION:
$(NO_DIALYZER_APPS): $$(patsubst %,%_build,$$@)
$(APPS_TEST): $$(patsubst %_test,%_build,$$@)
- ERL_TOP=$(ERL_TOP) TYPE=$(TYPE) $(MAKE) -C lib/$(patsubst %_test,%,$@) test
+ ERL_TOP=$(ERL_TOP) TYPE=$(TYPE) $(MAKE) -C lib/$(patsubst %_test,%,$@) MAKE=$(MAKE) test |
|
You need #8888 for it to work I think. Did you run with that? |
|
Oh, I already submitted a patch against I apologize for wasting your time. |
Why
GNU make is sometimes installed as
gmakeandmakepoints to another implementation that does not support GNU make extensions.The name of the make command is stored in
$(MAKE)and sub-make processes automatically inherit and use this variable. However other executed commands and scripts do not get this variable by default. Therefore if a script tries to call make(1) again, it will either not find this value or, more likely, will hard-codemake.How
The top-level Makefile now exports the value of
$(MAKE)into the environment of all executed sub-shells. This way, scripts can use the correct make command name if they need to run make(1) again.An example fixed in this patch is
make/test_target_script.sh. It used to hard-codemakeand now uses$MAKEpassed from the parent make instance.