Gentoo Archives: gentoo-dev

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

Replies