From: Clark Williams <willi...@redhat.com>

redhat: version two of Makefile.rhelver tweaks

The upstream commit 67d7c3023a6 introduced a failure to include
the file Makefile.rhelver when using the O= mechanism to place
object files and compiler output in a different directory from
the source tree.  The commit removes the behavior where anything
pulled in from a makefile 'include' directive is searched for in
multiple places (among other things).

The first attempt at fixing this was to move the include to a point
where the variable 'abs_srctree' is defined and then use that to
include $(abs_srctree)/Makefile.rhelver. This worked for some of
the Makefile components but caused problems when building things
in the scripts directory (specifically scripts/mod/modpost.c) due
to the RHEL_MAJOR and RHEL_MINOR variables not being defined.

This commit moves the include back to it's original position in
Makefile, but detects if the object file directory is different
from the source directory and includes from the appropriate path.

Signed-off-by: Clark Williams <willi...@redhat.com>

diff --git a/Makefile b/Makefile
index blahblah..blahblah 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,14 @@ $(if $(filter __%, $(MAKECMDGOALS)), \
 PHONY := __all
 __all:
 
+ifneq ($(realpath source),)
+include $(realpath source)/Makefile.rhelver
+else
+ifneq ($(realpath Makefile.rhelver),)
+include Makefile.rhelver
+endif
+endif
+
 # We are using a recursive build, so we need to do a little thinking
 # to get the ordering right.
 #
@@ -199,9 +207,6 @@ endif
 this-makefile := $(lastword $(MAKEFILE_LIST))
 abs_srctree := $(realpath $(dir $(this-makefile)))
 
-# Set RHEL variables
-include $(abs_srctree)/Makefile.rhelver
-
 ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
 $(error source directory cannot contain spaces or colons)
 endif

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2350
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to