From: Masahiro Yamada Date: Tue, 22 Jul 2014 02:19:07 +0000 (+0900) Subject: scripts: add scripts/show-gnu-make to get GNU Make command name X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b68a4062635cdb21e0904b385fb53fd49ae13432;p=project%2Fbcm63xx%2Fu-boot.git scripts: add scripts/show-gnu-make to get GNU Make command name U-Boot is expected to be built on various platforms. We should keep in mind that the command 'make' is not always GNU Make, while all the makefiles are written for GNU Make. For example, on Linux, people generally do: make _config; make But FreeBSD folks do gmake _config; gmake (The command 'make' on FreeBSD is BSD Make, not GNU Make) It is not a good idea to hard-code the command name 'make' in MAKEALL or buildman. They should call this helper script and get the command name for GNU Make. Signed-off-by: Masahiro Yamada --- diff --git a/scripts/show-gnu-make b/scripts/show-gnu-make new file mode 100755 index 0000000000..26271b59b9 --- /dev/null +++ b/scripts/show-gnu-make @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Show the command name for GNU Make +# +# U-Boot is supposed to be built on various platforms. +# One problem is that the command 'make' is not always GNU Make. +# (For ex. the command name for GNU Make on FreeBSD is usually 'gmake'.) +# It is not a good idea to hard-code the command name in scripts +# where where GNU Make is expected. +# Call this helper script to get the command name for GNU Make. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +gnu_make= + +for m in make gmake +do + if $m --version 2>/dev/null | grep -q GNU; then + echo $m + exit 0 + fi +done + +exit 1