From: Prarit Bhargava <[email protected]>

One of the nice things about the RHEL and ARK trees is that commands like
'make dist-configs' and 'make dist-help' can be executed from the
top-level linux directory.

In the existing code, the makefile includes the top-level linux Makefile
if the targets are not dist-* or distg-*.  Otherwise the commands are
executed with the redhat/Makefile* files.  This is clunky and requires the
inclusion of the makefile in .gitignore which causes problems when
upstream modifies .gitignore.

A better approach is to include the code in a top-level Makefile.dist.
This change can then be moved upstream for inclusion with a oneline patch
to include Makefile.dist.  Makefile.dist would not be included in the
gitignore file because we want to track changes for the file in our
own tree.

Move the makefile and Makefile.rhelver code into Makefile.dist, and
include Makefile.dist from the top-level Makefile.

Signed-off-by: Prarit Bhargava <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
 Makefile                          |  6 ++----
 Makefile.rhelver => Makefile.dist | 19 ++++++++++++++++++-
 makefile                          | 16 ----------------
 redhat/Makefile                   |  4 ++--
 redhat/Makefile.common            |  2 +-
 redhat/genspec.sh                 |  2 +-
 redhat/kernel.spec.template       |  2 +-
 redhat/scripts/new_release.sh     | 12 ++++++------
 8 files changed, 31 insertions(+), 32 deletions(-)
 rename Makefile.rhelver => Makefile.dist (77%)
 delete mode 100644 makefile

diff --git a/Makefile b/Makefile
index f3d1dd649d9b..c9a0d4f20808 100644
--- a/Makefile
+++ b/Makefile
@@ -18,10 +18,6 @@ $(if $(filter __%, $(MAKECMDGOALS)), \
 PHONY := __all
 __all:
 
-# Set RHEL variables
-# Use this spot to avoid future merge conflicts
-include Makefile.rhelver
-
 # We are using a recursive build, so we need to do a little thinking
 # to get the ordering right.
 #
@@ -273,6 +269,8 @@ no-sync-config-targets := $(no-dot-config-targets) install 
%install \
                           kernelrelease
 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
 
+-include Makefile.dist
+
 config-build   :=
 mixed-build    :=
 need-config    := 1
diff --git a/Makefile.rhelver b/Makefile.dist
similarity index 77%
rename from Makefile.rhelver
rename to Makefile.dist
index 8fceabade7c8..0b4f2d28e7b8 100644
--- a/Makefile.rhelver
+++ b/Makefile.dist
@@ -12,7 +12,7 @@ RHEL_MINOR = 99
 #
 # Use this spot to avoid future merge conflicts.
 # Do not trim this comment.
-RHEL_RELEASE = 0
+RHEL_RELEASE = 1
 
 #
 # Early y+1 numbering
@@ -43,3 +43,20 @@ ifneq ("$(ZSTREAM)", "yes")
     RHEL_RELEASE:=$(RHEL_RELEASE).$(EARLY_YRELEASE)
   endif
 endif
+
+no-dot-config-targets += dist-% distg-%
+
+ifneq ($(filter dist-% distg-%,$(MAKECMDGOALS)),)
+_OUTPUT := "."
+# this section is needed in order to make O= to work
+ifeq ("$(origin O)", "command line")
+  _OUTPUT := "$(abspath $(O))"
+  _EXTRA_ARGS := O=$(_OUTPUT)
+endif
+endif
+
+dist-%::
+       $(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
+
+distg-%::
+       $(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
diff --git a/makefile b/makefile
deleted file mode 100644
index 819ac9a5cd60..000000000000
--- a/makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-ifeq ($(filter dist-% distg-%,$(MAKECMDGOALS)),)
-       include Makefile
-endif
-
-_OUTPUT := "."
-# this section is needed in order to make O= to work
-ifeq ("$(origin O)", "command line")
-  _OUTPUT := "$(abspath $(O))"
-  _EXTRA_ARGS := O=$(_OUTPUT)
-endif
-dist-%::
-       $(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
-
-distg-%::
-       $(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
-
diff --git a/redhat/Makefile b/redhat/Makefile
index 61dcc522fbc6..8c6a3a510768 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -256,7 +256,7 @@ sources-rh: $(TARBALL)
                configs/process_configs.sh \
                parallel_xz.sh \
                generate_bls_conf.sh \
-               ../Makefile.rhelver \
+               ../Makefile.dist \
                README.rst \
                $(SOURCES)/
        @for KABIARCH in $(ARCH_LIST); do \
@@ -308,7 +308,7 @@ dist-release-finish: setup-source
        @git add $(REDHAT)/$(CHANGELOG)
        @echo $(MARKER) > $(REDHAT)/marker
        @git add $(REDHAT)/marker
-       @git commit -s ../Makefile.rhelver $(REDHAT)/marker 
$(REDHAT)/$(CHANGELOG) $(PACKAGE_NAME).spec.template -m "[redhat] 
$(PACKAGE_NAME)-$(STAMP_VERSION)-$(PREBUILD)$(BUILD)$(BUILDID)"
+       @git commit -s ../Makefile.dist $(REDHAT)/marker $(REDHAT)/$(CHANGELOG) 
$(PACKAGE_NAME).spec.template -m "[redhat] 
$(PACKAGE_NAME)-$(STAMP_VERSION)-$(PREBUILD)$(BUILD)$(BUILDID)"
        @$(MAKE) dist-configs
        @$(MAKE) dist-kabi
        @$(MAKE) dist-kabi-dup
diff --git a/redhat/Makefile.common b/redhat/Makefile.common
index 6d048415ba6d..d4e68369fb05 100644
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -1,6 +1,6 @@
 TOPDIR:=$(shell git rev-parse --show-toplevel)
 REDHAT:=$(TOPDIR)/redhat
-include $(TOPDIR)/Makefile.rhelver
+include $(TOPDIR)/Makefile.dist
 
 RPMBUILD := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
                    else echo rpm; fi)
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index b72dffe14729..1cd9095a69ea 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -253,7 +253,7 @@ if [ "$SINGLE_TARBALL" = 0 ]; then
                ":(exclude,top).gitignore" \
                ":(exclude,top).gitlab-ci.yml" \
                ":(exclude,top)makefile" \
-               ":(exclude,top)Makefile.rhelver" \
+               ":(exclude,top)Makefile.dist" \
                ":(exclude,top)redhat")
        for c in $COMMITS; do
                patch=$(git format-patch --zero-commit -1 "$c")
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index d47c9cce8a0e..93fa8c2985b1 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -569,7 +569,7 @@ BuildRequires: asciidoc
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
 Source0: linux-%%TARBALL_VERSION%%.tar.xz
 
-Source1: Makefile.rhelver
+Source1: Makefile.dist
 
 
 # Name of the packaged file containing signing key
diff --git a/redhat/scripts/new_release.sh b/redhat/scripts/new_release.sh
index 1e4c7bb1dc86..f1025f458d04 100755
--- a/redhat/scripts/new_release.sh
+++ b/redhat/scripts/new_release.sh
@@ -13,7 +13,7 @@ if [ -s "$RHPATH/linux-kernel-test.patch" ]; then
        exit 1;
 fi
 
-RELEASE=$(sed -n -e 's/^RHEL_RELEASE\ =\ \(.*\)/\1/p' 
$RHPATH/../Makefile.rhelver)
+RELEASE=$(sed -n -e 's/^RHEL_RELEASE\ =\ \(.*\)/\1/p' $RHPATH/../Makefile.dist)
 
 YVER=$(echo $RELEASE | cut -d "." -f 1)
 YVER=${YVER:=$RELEASE}
@@ -26,15 +26,15 @@ if [ "$ZSTREAM_FLAG" == "no" ]; then
        if [ "$YSTREAM_FLAG" == "yes" ]; then
                NEW_RELEASE="$[RELEASE + 1]";
        else
-               EARLY_YBUILD=$(sed -n -e 's/^EARLY_YBUILD:=\(.*\)/\1/p' 
$RHPATH/../Makefile.rhelver);
-               EARLY_YRELEASE=$(sed -n -e 's/^EARLY_YRELEASE:=\(.*\)/\1/p' 
$RHPATH/../Makefile.rhelver);
+               EARLY_YBUILD=$(sed -n -e 's/^EARLY_YBUILD:=\(.*\)/\1/p' 
$RHPATH/../Makefile.dist);
+               EARLY_YRELEASE=$(sed -n -e 's/^EARLY_YRELEASE:=\(.*\)/\1/p' 
$RHPATH/../Makefile.dist);
                if [ "$EARLY_YBUILD" != "$RELEASE" ]; then
                        NEW_EARLY_YRELEASE=1;
                else
                        NEW_EARLY_YRELEASE="$[EARLY_YRELEASE + 1]";
                fi
-               sed -i -e 
"s/^EARLY_YBUILD:=$EARLY_YBUILD/EARLY_YBUILD:=$RELEASE/" 
$RHPATH/../Makefile.rhelver;
-               sed -i -e 
"s/^EARLY_YRELEASE:=$EARLY_YRELEASE/EARLY_YRELEASE:=$NEW_EARLY_YRELEASE/" 
$RHPATH/../Makefile.rhelver;
+               sed -i -e 
"s/^EARLY_YBUILD:=$EARLY_YBUILD/EARLY_YBUILD:=$RELEASE/" 
$RHPATH/../Makefile.dist;
+               sed -i -e 
"s/^EARLY_YRELEASE:=$EARLY_YRELEASE/EARLY_YRELEASE:=$NEW_EARLY_YRELEASE/" 
$RHPATH/../Makefile.dist;
                NEW_RELEASE=$RELEASE;
        fi
 elif [ "$ZSTREAM_FLAG" == "yes" ]; then
@@ -46,5 +46,5 @@ else
        exit 1;
 fi
 
-sed -i -e "s/RHEL_RELEASE\ =.*/RHEL_RELEASE\ =\ $NEW_RELEASE/" 
$RHPATH/../Makefile.rhelver;
+sed -i -e "s/RHEL_RELEASE\ =.*/RHEL_RELEASE\ =\ $NEW_RELEASE/" 
$RHPATH/../Makefile.dist;
 
-- 
GitLab
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
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/[email protected]

Reply via email to