Gentoo Archives: gentoo-dev

From: Mike <mpagano@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH v3] linux-info.eclass : Support valid Make files
Date: Thu, 02 Sep 2021 23:28:20
Message-Id: 5a6879a1-957d-3961-ddc6-db78340b6cd9@gentoo.org
In Reply to: [gentoo-dev] [PATCH v2] linux-info.eclass : Support valid Make files by Mike
1 Support the possibility that the Makefile could be
2 one of the following and should be checked in the order described here:
3
4 https://www.gnu.org/software/make/manual/make.html
5
6 Order of checking and valid Makefiles names:
7 GNUMakefile, makefile, Makefile
8
9 Bug: https://bugs.gentoo.org/663368
10
11 Signed-off-by: Mike Pagano <mpagano@g.o>
12 ---
13 eclass/linux-info.eclass | 30 ++++++++++++++++++++++++++----
14 1 file changed, 26 insertions(+), 4 deletions(-)
15
16 diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
17 index 0b6df1bf5..a6159eac2 100644
18 --- a/eclass/linux-info.eclass
19 +++ b/eclass/linux-info.eclass
20 @@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
21 # There are also a couple of variables which are set by this, and shouldn't be
22 # set by hand. These are as follows:
23
24 +# @ECLASS-VARIABLE: KERNEL_MAKEFILE
25 +# @INTERNAL
26 +# @DESCRIPTION:
27 +# According to upstream documentation, by default, when make looks for the makefile, it tries
28 +# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
29 +# proper Makefile name or the eclass will search in this order for it.
30 +# See https://www.gnu.org/software/make/manual/make.html
31 +: ${KERNEL_MAKEFILE:=""}
32 +
33 # @ECLASS-VARIABLE: KV_FULL
34 # @OUTPUT_VARIABLE
35 # @DESCRIPTION:
36 @@ -510,7 +519,9 @@ get_version() {
37 qeinfo " ${KV_DIR}"
38 fi
39
40 - if [ ! -s "${KV_DIR}/Makefile" ]
41 + get_makefile
42 +
43 + if [[ ! -s "${KERNEL_MAKEFILE}" ]]
44 then
45 if [ -z "${get_version_warning_done}" ]; then
46 get_version_warning_done=1
47 @@ -526,9 +537,6 @@ get_version() {
48 # do we pass KBUILD_OUTPUT on the CLI?
49 local OUTPUT_DIR=${KBUILD_OUTPUT}
50
51 - # keep track of it
52 - KERNEL_MAKEFILE="${KV_DIR}/Makefile"
53 -
54 if [[ -z ${OUTPUT_DIR} ]]; then
55 # Decide the function used to extract makefile variables.
56 local mkfunc=$(get_makefile_extract_function "${KERNEL_MAKEFILE}")
57 @@ -971,3 +979,17 @@ linux-info_pkg_setup() {
58
59 [ -n "${CONFIG_CHECK}" ] && check_extra_config;
60 }
61 +
62 +# @FUNCTION: get_makefile
63 +# @DESCRIPTION:
64 +# Support the possibility that the Makefile could be one of the following and should
65 +# be checked in the order described here:
66 +# https://www.gnu.org/software/make/manual/make.html
67 +# Order of checking and valid Makefiles names: GNUMakefile, makefile, Makefile
68 +get_makefile() {
69 +
70 + [[ -s "${KV_DIR}"/GNUMakefile ]] && KERNEL_MAKEFILE="${KV_DIR}/GNUMakefile"
71 + [[ -s "${KV_DIR}"/makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/makefile"
72 + [[ -s "${KV_DIR}"/Makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/Makefile"
73 +
74 +}
75 --
76 2.32.0

Replies