-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makefile echo
portability across Linux distributions
#316
Comments
This would work: BASH_FLAG=""
ifeq ($(shell basename $(shell realpath $(SHELL))), bash):
ECHO_FLAGS="-e"
endif
# ...
help:
@echo $(BASH_FLAG) "..." This would prevent requiring one particular shell. This works on my distro (openSUSE TW). It correctly sets One annoying thing is you now need to write |
Is there a reason why we shouldn't pivot to |
@SecondSkoll I'm not an expert, but online sentiment (e.g., on above stackexchange pages) seems to be that printf is more portable. This could be a solution. |
I think moving to |
From canonical/kernel-docs#38, it appears that different distros use different symlinks for
sh
, which can affect the wayecho
behaves.More information about non-portable
echo
behavior can be found here: https://unix.stackexchange.com/questions/700675/why-is-echo-e-behaving-weird-in-a-makefileWe should try to make this portion of the makefile more portable, although I'm not sure how.
One potential way we could solve this is by adding
SHELL = bash
in the Makefile, which forces it to use bash'secho
(technically requires bash, but nearly all distros ship with bash these days). This would require us to add-e
to each instance of echo where newlines may be printed.What should we do?
The text was updated successfully, but these errors were encountered: