On 2 Sep 2021, at 20:42, Mike Pagano <mpagano@gentoo.org> wrote:
Support the possibility that the Makefile could be
one of the following and should be checked in
the order described here:
https://www.gnu.org/software/make/manual/make.html
Order of checking and valid Makefiles names:
GNUMakefile, makefile, Makefile
Bug: https://bugs.gentoo.org/663368
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
---
eclass/linux-info.eclass | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 0b6df1bf5..2dfc8979f 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
# There are also a couple of variables which are set by this, and shouldn't be
# set by hand. These are as follows:
+# @ECLASS-VARIABLE: KERNEL_MAKEFILE
+# @INTERNAL
+# @DESCRIPTION:
+# According to upstream documentation, by default, when make looks for the makefile, it tries
+# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
+# proper Makefile name or the eclass will search in this order for it.
+# See https://www.gnu.org/software/make/manual/make.html
+: ${KERNEL_MAKEFILE:=""}
+
# @ECLASS-VARIABLE: KV_FULL
# @OUTPUT_VARIABLE
# @DESCRIPTION:
@@ -510,7 +519,9 @@ get_version() {
qeinfo " ${KV_DIR}"
fi
- if [ ! -s "${KV_DIR}/Makefile" ]
+ get_makefile
+
+ if [ ! -s "${KERNEL_MAKEFILE}" ]
then
Support the possibility that the Makefile could be
one of the following and should be checked in the order described here:
https://www.gnu.org/software/make/manual/make.html
Order of checking and valid Makefiles names:
GNUMakefile, makefile, Makefile
Bug: https://bugs.gentoo.org/663368
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
---
eclass/linux-info.eclass | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 0b6df1bf5..a6159eac2 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
# There are also a couple of variables which are set by this, and shouldn't be
# set by hand. These are as follows:
+# @ECLASS-VARIABLE: KERNEL_MAKEFILE
+# @INTERNAL
+# @DESCRIPTION:
+# According to upstream documentation, by default, when make looks for the makefile, it tries
+# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
+# proper Makefile name or the eclass will search in this order for it.
+# See https://www.gnu.org/software/make/manual/make.html
+: ${KERNEL_MAKEFILE:=""}
+
# @ECLASS-VARIABLE: KV_FULL
# @OUTPUT_VARIABLE
# @DESCRIPTION:
@@ -510,7 +519,9 @@ get_version() {
qeinfo " ${KV_DIR}"
fi
- if [ ! -s "${KV_DIR}/Makefile" ]
+ get_makefile
+
+ if [[ ! -s "${KERNEL_MAKEFILE}" ]]
then
if [ -z "${get_version_warning_done}" ]; then
get_version_warning_done=1
@@ -526,9 +537,6 @@ get_version() {
# do we pass KBUILD_OUTPUT on the CLI?
local OUTPUT_DIR=${KBUILD_OUTPUT}
- # keep track of it
- KERNEL_MAKEFILE="${KV_DIR}/Makefile"
-
if [[ -z ${OUTPUT_DIR} ]]; then
# Decide the function used to extract makefile variables.
local mkfunc=$(get_makefile_extract_function "${KERNEL_MAKEFILE}")
@@ -971,3 +979,17 @@ linux-info_pkg_setup() {
[ -n "${CONFIG_CHECK}" ] && check_extra_config;
}
+
+# @FUNCTION: get_makefile
+# @DESCRIPTION:
+# Support the possibility that the Makefile could be one of the following and should
+# be checked in the order described here:
+# https://www.gnu.org/software/make/manual/make.html
+# Order of checking and valid Makefiles names: GNUMakefile, makefile, Makefile
+get_makefile() {
+
+ [[ -s "${KV_DIR}"/GNUMakefile ]] && KERNEL_MAKEFILE="${KV_DIR}/GNUMakefile"
+ [[ -s "${KV_DIR}"/makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/makefile"
+ [[ -s "${KV_DIR}"/Makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/Makefile"
+
+}
On Fri, 03 Sep 2021, Mike wrote:
- if [ ! -s "${KV_DIR}/Makefile" ]
+ get_makefile
+
+ if [[ ! -s "${KERNEL_MAKEFILE}" ]]
+ [[ -s "${KV_DIR}"/GNUMakefile ]] && KERNEL_MAKEFILE="${KV_DIR}/GNUMakefile"
+ [[ -s "${KV_DIR}"/makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/makefile"
+ [[ -s "${KV_DIR}"/Makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/Makefile"
Thanks to Sam, mgorny and Ulm for the review.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 475 |
Nodes: | 16 (2 / 14) |
Uptime: | 18:09:37 |
Calls: | 9,487 |
Calls today: | 6 |
Files: | 13,617 |
Messages: | 6,121,091 |