[OS-BUILD PATCHv3 24/24] redhat/Makefile: Reorganize variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat/Makefile: Reorganize variables

Reorganize the variables from simple variables to complex variables.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -35,8 +35,83 @@ RPMKSUBLEVEL:=$(shell $(GIT) show $(HEAD):Makefile | sed -ne '/^SUBLEVEL\ =\ /{s
 RPMKEXTRAVERSION:=$(shell $(GIT) show $(HEAD):Makefile | sed -ne '/^EXTRAVERSION\ =\ /{s///;p;q}')
 KVERSION:=$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
 GITID:= $(shell $(GIT) log --max-count=1 --pretty=format:%H $(HEAD))
-# marker is git tag which we base off of for exporting patches
-# Make sure marker uses RPMKPATCHLEVEL and RPMKEXTRAVERSION from the kernel
+ifndef BUILD
+  BUILD:=$(RHEL_RELEASE)
+endif
+FLAVOR=
+CURARCH := $(shell uname -m)
+ARCHCONFIG := $(shell uname -m | sed -e s/x86_64/X86_64/ \
+				     -e s/s390x/S390/ -e s/ppc.*/PPC/ )
+
+# rpm information
+SPECFILE:=$(PACKAGE_NAME).spec
+RPM:=$(REDHAT)/rpm
+SRPMS:=$(RPM)/SRPMS
+SOURCES:=$(RPM)/SOURCES
+TESTPATCH:=$(REDHAT)/linux-kernel-test.patch
+CHANGELOG:=$(PACKAGE_NAME).changelog-$(RHEL_MAJOR).$(RHEL_MINOR)
+CHANGELOG_PREV:=$(PACKAGE_NAME).changelog-$(RHEL_MAJOR).$(shell expr $(RHEL_MINOR) - 1)
+ARCH_LIST=aarch64 ppc64le s390x x86_64
+
+ifndef DISTRO
+  ifneq ($(findstring .fc,$(DIST)),)
+    DISTRO := fedora
+  else
+    DISTRO := rhel
+  endif
+endif
+
+ifndef BUILD_FLAGS
+  ifeq ($(filter $(MAKECMDGOALS),dist-brew distg-brew),)
+	BUILD_FLAGS := $(BREW_FLAGS)
+  endif
+  ifeq ($(filter $(MAKECMDGOALS),dist-koji distg-koji),)
+	BUILD_FLAGS := $(KOJI_FLAGS)
+  endif
+  BUILD_FLAGS += $(TEST_FLAGS)
+endif
+
+ifndef RHJOBS
+  RHJOBS=$(shell j=$$(echo $(MAKEFLAGS) | grep -Eo "\ -j[0-9]*" | xargs ); \
+	  if [ -z "$${j}" ]; then \
+	  	echo "1"; \
+	  else \
+	  	j=$$(echo "$${j}" | tr -d "\-j"); \
+	  	[ -z "$${j}" ] && nproc --all || echo $${j}; \
+	  fi)
+endif
+
+LOCVERFILE:=../localversion
+# create an empty localversion file if you don't want a local buildid
+ifneq ($(wildcard $(LOCVERFILE)),)
+  BUILDID:=$(shell cat $(LOCVERFILE))
+  $(info BUILDID is "$(BUILDID)". Update '$(shell dirname $(REDHAT))/localversion' to change.)
+else
+  ifeq ($(BUILDID),)
+    BUILDID:=.test
+  endif
+  $(info BUILDID is "$(BUILDID)".)
+endif
+
+# options for process_configs.sh script
+ifdef NO_CONFIGCHECKS
+   PROCESS_CONFIGS_OPTS=
+   PROCESS_CONFIGS_CHECK_OPTS=
+   BUILDOPTS += -configchecks
+else
+   PROCESS_CONFIGS_CHECK_OPTS=-n -t -c
+   PROCESS_CONFIGS_OPTS=-n -w -c
+endif
+
+# this section is needed in order to make O= to work
+_OUTPUT := ..
+ifeq ("$(origin O)", "command line")
+  _OUTPUT := $(O)
+  _EXTRA_ARGS := O=$(_OUTPUT)
+endif
+
+# MARKER is the git tag which we base off of for exporting patches
+# Make sure MARKER uses RPMKPATCHLEVEL and RPMKEXTRAVERSION from the kernel
 # makefile as opposed to any adjusted version for snapshotting.
 ifneq ($(RPMKEXTRAVERSION),)
   MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL)$(RPMKEXTRAVERSION)
@@ -55,14 +130,6 @@ else
   PREBUILD:=
 endif
 
-ifndef DISTRO
-  ifneq ($(findstring .fc,$(DIST)),)
-    DISTRO := fedora
-  else
-    DISTRO := rhel
-  endif
-endif
-
 # If VERSION_ON_UPSTREAM is set, the versioning of the rpm package is based
 # on a branch tracking upstream. This allows for generating rpms
 # based on untagged releases.
@@ -115,33 +182,14 @@ ifeq ($(VERSION_ON_UPSTREAM),1)
   endif
 endif
 
-KVERSION:=$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
-
-ifndef BUILD
-  BUILD:=$(RHEL_RELEASE)
-endif
-SPECFILE:=$(PACKAGE_NAME).spec
-RPM:=$(REDHAT)/rpm
-SRPMS:=$(RPM)/SRPMS
-SOURCES:=$(RPM)/SOURCES
-TESTPATCH:=$(REDHAT)/linux-kernel-test.patch
-ARCH_LIST=aarch64 ppc64le s390x x86_64
-
-LOCVERFILE:=../localversion
-# create an empty localversion file if you don't want a local buildid
-ifneq ($(wildcard $(LOCVERFILE)),)
-  BUILDID:=$(shell cat $(LOCVERFILE))
-  $(info BUILDID is "$(BUILDID)". Update '$(shell dirname $(REDHAT))/localversion' to change.)
-else
-  ifeq ($(BUILDID),)
-    BUILDID:=.test
-  endif
-  $(info BUILDID is "$(BUILDID)".)
-endif
-
+DISTRO_BUILD:=$(PREBUILD)$(shell echo $(BUILD) | sed -e 's|\(^[0-9]\{1,4\}\)\..*|\1|')
+KABI_TARBALL:=$(SOURCES)/kernel-abi-stablelists-$(KVERSION)-$(DISTRO_BUILD).tar.bz2
+KABIDW := $(REDHAT)/kabi-dwarf
+KABIDW_TARBALL:=$(SOURCES)/kernel-kabi-dw-$(KVERSION)-$(DISTRO_BUILD).tar.bz2
 PKGRELEASE:=$(PREBUILD)$(BUILD)$(BUILDID)
 RPMVERSION:=$(RPMKVERSION).$(RPMKPATCHLEVEL)-$(PKGRELEASE)
 SPECRELEASE:=$(PREBUILD)$(BUILD)%{?buildid}%{?dist}
+SRPM:=$(SRPMS)/$(PACKAGE_NAME)-$(KVERSION)-$(PKGRELEASE)$(DIST).src.rpm
 
 #
 # This conditional statement is where fedora, centos, and other (aka RHEL)
@@ -185,13 +233,6 @@ endif
 
 TARFILE:=linux-$(TARFILE_RELEASE).tar.xz
 TARBALL:=$(REDHAT)/$(TARFILE)
-DISTRO_BUILD:=$(PREBUILD)$(shell echo $(BUILD) | sed -e 's|\(^[0-9]\{1,4\}\)\..*|\1|')
-KABI_TARBALL:=$(SOURCES)/kernel-abi-stablelists-$(KVERSION)-$(DISTRO_BUILD).tar.bz2
-KABIDW := $(REDHAT)/kabi-dwarf
-KABIDW_TARBALL:=$(SOURCES)/kernel-kabi-dw-$(KVERSION)-$(DISTRO_BUILD).tar.bz2
-
-CHANGELOG:=$(PACKAGE_NAME).changelog-$(RHEL_MAJOR).$(RHEL_MINOR)
-CHANGELOG_PREV:=$(PACKAGE_NAME).changelog-$(RHEL_MAJOR).$(shell expr $(RHEL_MINOR) - 1)
 
 include Makefile.rhpkg
 
@@ -236,26 +277,6 @@ ARCHCONFIG := $(shell uname -m | sed -e s/x86_64/X86_64/ \
 
 include Makefile.cross
 
-ifndef RHJOBS
-  RHJOBS=$(shell j=$$(echo $(MAKEFLAGS) | grep -Eo "\ -j[0-9]*" | xargs ); \
-	  if [ -z "$${j}" ]; then \
-	  	echo "1"; \
-	  else \
-	  	j=$$(echo "$${j}" | tr -d "\-j"); \
-	  	[ -z "$${j}" ] && nproc --all || echo $${j}; \
-	  fi)
-endif
-
-ifndef BUILD_FLAGS
-  ifeq ($(filter $(MAKECMDGOALS),dist-brew distg-brew),)
-	BUILD_FLAGS := $(BREW_FLAGS)
-  endif
-  ifeq ($(filter $(MAKECMDGOALS),dist-koji distg-koji),)
-	BUILD_FLAGS := $(KOJI_FLAGS)
-  endif
-  BUILD_FLAGS += $(TEST_FLAGS)
-endif
-
 #
 # Targets
 #

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1641
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux