[OS-BUILD PATCH 2/3] redhat/Makefile: Add new dist-help functionality

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

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat/Makefile: Add new dist-help functionality

The description of a Makefile target and the target itself are separated
in some cases by 100s of lines of code.  This is because the target
description is in the dist-full-help target, which is close to the bottom
of the Makefile.  This makes it difficult to remember to update a target's
help description when changing the functionality of a target, and it also
makes it difficult to remember to update the help targets when adding new
targets.

There is also too much text in the current output scheme for the
dist-full-help target.  It is just a wall of difficult to parse white
text, and it can't be easily subdivided into, for example, build vs kabi
targets.

The descriptions of each target listed in help have been moved to the
declaration of the target, with a "##<type>" style comment.  Functionality
for the dist-help and dist-full-help remain in place, albeit with a
cyan/light blue coloring for the target names which makes it easier to
read.

Additional targets for dist-help-HELPTYPE where HELPTYPE is one of
{cleaning build kabi configuration misc} have also been introduced.

Note: Some of the target descriptions are incorrect and may have other
issues (grammar, punctuation, etc.).  I have NOT changed these but will do
so in a follow up changeset.

Note: I chose '26' characters because it looks nice on both 80 and 100
column output.

Additional fix: Don't output the LOCALVERSION message when executing
dist-help commands.

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
@@ -103,7 +103,7 @@ ifndef RHJOBS
 	  fi)
 endif
 
-ifeq ($(filter dist-full-help dist-help-% ,$(MAKECMDGOALS)),)
+ifeq ($(filter dist-full-help dist-help dist-help-% dist-helper-%,$(MAKECMDGOALS)),)
 LOCVERFILE:=../localversion
 # create an empty localversion file if you don't want a local buildid
 ifneq ($(wildcard $(LOCVERFILE)),)
@@ -368,6 +368,9 @@ endif
 
 include Makefile.cross
 
+# different types of help targets (for example, dist-help-misc or dist-help-build)
+HELP_TYPES=cleaning build kabi configuration misc
+
 #
 # Targets
 #
@@ -384,7 +387,7 @@ dist-python-check:
 		exit 1; \
 	fi
 
-dist-kabi: dist-python-check
+dist-kabi: dist-python-check ##kabi Create kABI stablelist files in redhat/kabi/kabi-rhel*/ and merge kABI checksums into redhat/kabi/Module.kabi_*.
 	@for KABIARCH in $(ARCH_LIST); do \
 		$(REDHAT)/kabi/show-kabi -k $(REDHAT)/kabi/kabi-module/ -m \
 			-a $$KABIARCH -r $(RHEL_MAJOR).$(RHEL_MINOR) > $(REDHAT)/kabi/Module.kabi_$$KABIARCH;\
@@ -396,7 +399,7 @@ dist-kabi: dist-python-check
 	done;
 	@(cd $(REDHAT)/kabi/ && ln -Tsf kabi-rhel$(RHEL_MAJOR)$(RHEL_MINOR) kabi-current)
 
-dist-kabi-dup: dist-python-check
+dist-kabi-dup: dist-python-check ##kabi Merge kABI checksums for Driver Update Program (DUP) into redhat/kabi/Module.kabi_dup_*.
 	@for KABIARCH in $(ARCH_LIST); do \
 		touch $(REDHAT)/kabi/Module.kabi_dup_$$KABIARCH;\
 		if [ -d $(REDHAT)/kabi/kabi-dup-module/kabi_$$KABIARCH ]; then \
@@ -476,11 +479,11 @@ dist-kabi-preimage-%: dist-kabi-index
 		done; \
 	fi
 
-dist-symtype-diff: KABI_TOOL = $(REDHAT)/kabi/diff-kabi
+dist-symtype-diff: KABI_TOOL = $(REDHAT)/kabi/diff-kabi ##kabi Diff kabi stablelist and current kernel.
 dist-symtype-diff: dist-assert-cross-tools dist-assert-tree-clean dist-configs dist-symtype-shared
 
 dist-kabi-update: KABI_TOOL = $(REDHAT)/kabi/update-kabi
-dist-kabi-update: dist-assert-cross-tools dist-assert-tree-clean dist-configs dist-symtype-shared
+dist-kabi-update: dist-assert-cross-tools dist-assert-tree-clean dist-configs dist-symtype-shared ##kabi Update kabi stablelist checksums.
 
 dist-symtype-shared:
 	@declare -a _ARGS; \
@@ -501,7 +504,7 @@ dist-symtype-shared:
 		done; \
 	fi
 
-dist-check-kabi: dist-kabi
+dist-check-kabi: dist-kabi ##kabi Check for changes in kABI stablelisted symbols. Requires a pre-compiled tree: run `make dist-configs`, copy the relevant config file from redhat/configs/ to .config, and run `make`.
 	@if [ ! -e $(_OUTPUT)/Module.symvers ]; then \
 		echo "ERROR: You must compile the kernel and modules first";\
 		exit 1;\
@@ -509,7 +512,7 @@ dist-check-kabi: dist-kabi
 	@$(REDHAT)/kabi/check-kabi -k $(REDHAT)/kabi/Module.kabi_$(MACH) \
 	 -s $(_OUTPUT)/Module.symvers
 
-dist-check-kabi-dup: dist-kabi-dup
+dist-check-kabi-dup: dist-kabi-dup ##kabi Like dist-check-kabi but uses a DUP kABI stablelist.
 	@if [ ! -e $(_OUTPUT)/Module.symvers ]; then \
 		echo "ERROR: You must compile the kernel and modules first";\
 		exit 1;\
@@ -517,14 +520,14 @@ dist-check-kabi-dup: dist-kabi-dup
 	@$(REDHAT)/kabi/check-kabi -k $(REDHAT)/kabi/Module.kabi_dup_$(MACH) \
 	-s $(_OUTPUT)/Module.symvers
 
-dist-kabi-dw-base: dist-kabi
+dist-kabi-dw-base: dist-kabi ##kabi Generate the base dataset for kABI DWARF-based check.
 	@echo "Generating baseline dataset for KABI DWARF-based comparison..."
 	@echo "**** GENERATING DWARF-based kABI baseline dataset ****"
 	@$(KABIDW)/run_kabi-dw.sh generate \
 		$(REDHAT)/kabi/kabi-current/kabi_stablelist_$(CURARCH) \
 		$(_OUTPUT) $(KABIDW)/base/$(CURARCH)/
 
-dist-kabi-dw-check: dist-kabi
+dist-kabi-dw-check: dist-kabi ##kabi Run DWARF-based kABI comparison of current binaries with the base dataset.
 	@if [ ! -d $(KABIDW)/base/$(CURARCH) ]; then \
 		echo "**** ERROR: ****"; \
 		echo "Comparison base not found in $(KABIDW)/base/$(CURARCH)."; \
@@ -545,16 +548,16 @@ dist-configs-commit: dist-configs-prep
 	+@cd $(REDHAT)/configs; ./generate_all_configs.sh 1;\
 	./process_configs.sh -z "$(SPECRPMVERSION)" "$(FLAVOR)"
 
-dist-configs: dist-configs-prep
+dist-configs: dist-configs-prep ##configuration Create RHEL config files in redhat/config/.
 	+@cd $(REDHAT)/configs; ./generate_all_configs.sh 1;\
 	./process_configs.sh $(PROCESS_CONFIGS_OPTS) "$(SPECRPMVERSION)" ""
 
 dist-fedora-configs: FLAVOR = fedora
-dist-fedora-configs: dist-configs
+dist-fedora-configs: dist-configs ##build build Fedora configs.
 fedora-configs: dist-fedora-configs
 
 dist-rhel-configs: FLAVOR = rhel
-dist-rhel-configs: dist-configs
+dist-rhel-configs: dist-configs ##build build ELN configs.
 rh-configs: dist-rhel-configs
 
 dist-configs-check: dist-configs-prep
@@ -565,29 +568,29 @@ dist-configs-prep: dist-clean-configs
 	+cd $(REDHAT)/configs; ./build_configs.sh "$(SPECPACKAGE_NAME)" "$(FLAVOR)"
 
 dist-configs-arch: ARCH_MACH = $(MACH)
-dist-configs-arch: dist-configs
+dist-configs-arch: dist-configs ##configuration Same as dist-configs but for single architecture only.
 
-dist-clean-configs:
+dist-clean-configs:  ##cleaning Clean the redhat/configs/ directory.
 	@cd $(REDHAT)/configs; rm -f kernel-*.config kernel-*.config.orig kernel-*.config.tmp partial-*-snip.config
 
-dist-clean-sources:
+dist-clean-sources: ##cleaning Clean the redhat/rpm/SOURCES/ directory.
 # Do not cleanup when creating self-test data
 ifndef RHSELFTESTDATA
 	@rm -f $(RPM)/SPECS/*
 	@rm -f $(SOURCES)/*
 endif
 
-dist-clean-rpmdirs:
+dist-clean-rpmdirs: ##cleaning Clean the redhat/rpm/{BUILD,SRPMS,RPMS,SPECS}/ directories.
 	@for i in $(RPM)/{BUILD,SRPMS,RPMS,SPECS}/*; do \
 		rm -rf $$i; \
 	done;
 
-dist-clean: dist-clean-sources dist-clean-configs dist-clean-rpmdirs
+dist-clean: dist-clean-sources dist-clean-configs dist-clean-rpmdirs ##cleaning Clean redhat/configs/ and redhat/rpm/ directories.
 	@rm -f $(REDHAT)/linux-*.tar.xz
 	@rm -f $(REDHAT)/kernel-abi-stablelists-*.tar.xz
 	@rm -f $(REDHAT)/kernel-kabi-dw-*.tar.xz
 
-dist-stub-key:
+dist-stub-key: ##build Use pre generated keys to speed local test builds.
 	@echo "Copying pre-generated keys";
 	@echo "*** THIS IS NOT RECOMMENDED ***";
 	@echo "To be safe, keys should be created once for every build";
@@ -621,7 +624,7 @@ dist-git-version-check:
 		exit 1; \
 	fi
 
-dist-get-buildreqs: setup-source
+dist-get-buildreqs: setup-source ##misc returns list of packages listed as build requirements for this kernel.
 	@PKGLIST="rpm-build $$(rpmspec -q --buildrequires $(SOURCES)/$(SPECFILE) | cut -d ' ' -f 1)"; \
 	MISSING=""; \
 	for pkg in $$PKGLIST; do \
@@ -719,36 +722,38 @@ sources-rh: $(TARBALL) $(KABI_TARBALL) $(KABIDW_TARBALL) generate-testpatch-tmp
 
 dist-sources: dist-kabi dist-kabi-dup sources-rh
 
-dist-test-patch: generate-testpatch-tmp
+dist-test-patch: generate-testpatch-tmp ##build Create a diff against HEAD and put it in linux-kernel-test.patch.  This patch will be added to the kernel build.
 	@mv $(TESTPATCH).tmp $(TESTPATCH);
 
 do-rpmbuild: dist-sources
 	$(RPMBUILD) --define "_sourcedir $(SOURCES)" --define "_builddir $(RPM)/BUILD" --define "_srcrpmdir $(RPM)/SRPMS" --define "_rpmdir $(RPM)/RPMS" --define "_specdir $(RPM)/SPECS" --define "dist $(DIST)" $(RPMBUILDOPTS) $(RPM)/SOURCES/$(SPECFILE)
 
 dist-all-rpms: RPMBUILDOPTS=--target $(MACH) -ba
-dist-all-rpms: dist-sources do-rpmbuild
+dist-all-rpms: dist-sources do-rpmbuild ##build Create the binary RPMS and the SRPM for the kernel.  See the dist-brew target for available options.
 
 dist-srpm: RPMBUILDOPTS=--nodeps -bs
-dist-srpm: dist-sources do-rpmbuild
+dist-srpm: dist-sources do-rpmbuild ##build Create a source RPM and put it into the redhat/rpm/SRPMS/ directory.  See the dist-brew target for available options.
 
 dist-srpm-gcov: DISTLOCALVERSION=.gcov
 dist-srpm-gcov: BUILDOPTS+=+gcov
-dist-srpm-gcov: dist-srpm
+dist-srpm-gcov: dist-srpm ##build Create a source RPM with gcov enabled and put it into the redhat/rpm/SRPMS/ directory.
 
 dist-rpms: RPMBUILDOPTS=--target $(MACH) -bb
-dist-rpms: dist-sources do-rpmbuild
+dist-rpms: dist-sources do-rpmbuild ##build Create the binary RPMS for the kernel. See the dist-brew target for available options.
 
+# this is a dummy entry to define help for the dist-kernel-* targets
+dist-kernel-type: ##build Create binary RPMS for a particular kernel type.  Available <type>s:
 dist-kernel-%: dist-sources
 	RPMBUILDOPTS="--target $(MACH) --with $* -bb" make do-rpmbuild
 
 dist-prep: RPMBUILDOPTS=--nodeps --target noarch -bp
-dist-prep: dist-sources do-rpmbuild
+dist-prep: dist-sources do-rpmbuild ##build Setup the redhat/rpm/BUILD/ directory with the kernel source.  See the dist-brew target for available options.
 
 dist-perf: RPMBUILDOPTS=--without up --without smp --without zfcpdump --without debug --without doc --without headers --without doc --without debuginfo --target $(MACH) -bb
 dist-perf: dist-sources do-rpmbuild
 
 dist-rpm-baseonly: RPMBUILDOPTS=--target $(MACH) --without debug --without debuginfo --without vdso_install --without bpftool --without perf --without tools -bb
-dist-rpm-baseonly: dist-sources do-rpmbuild
+dist-rpm-baseonly: dist-sources do-rpmbuild ##build Create the binary RPMS for the kernel and modules (no userspace tools or debuginfo).
 
 # unless you know what you're doing, you don't want to use the next four ones
 dist-release-finish: setup-source
@@ -777,7 +782,7 @@ dist-release-changed:
 dist-release: dist-clean-sources
 	@$(MAKE) dist-release-changed
 
-dist-get-tag:
+dist-get-tag: ##misc Returns the latest release tag.
 	$(info $(DISTRELEASETAG))
 
 dist-release-tag:
@@ -818,6 +823,10 @@ dist-vr-check:
 # This is because target-specific variables only apply inside the recipe, but we
 # need to recalculate some values such as BUILD_TARGET that depends on them.
 # However, do not override any value directly defined by the user.
+dist-brew: ##build Create a kernel SRPM and then call brew to build the created SRPM.  Add BUILDOPTS="+<opt> -<opt> [...]" to enable/disable build options.
+dist-koji: ##build Create a kernel SRPM and then call koji to build the created SRPM.  See the dist-brew target for available options.
+distg-brew: ##build Pass HEAD of the current git branch to brew to build an RPM set.  Do not forget to push to the remote repository first.  Preceed make command by RHGITCOMMIT=<commitID> specify commit ID to use.  To set the remote repo, invoke 'git config rhg.url git://<repo_path>'.
+distg-koji: ##build Pass HEAD of the current git branch to koji to build an RPM set.  Do not forget to push to the remote repository first.  See the distg-brew target for options and configuration.
 dist-brew distg-brew: DISTRO=$(if $(DISTRO_USERDEF),$(DISTRO_USERDEF),rhel)
 dist-brew distg-brew: DIST=$(if $(DIST_USERDEF),$(DIST_USERDEF),.el$(RHEL_MAJOR))
 dist-brew distg-brew: BUILD_PROFILE=$(if $(BUILD_PROFILE_USERDEF),$(BUILD_PROFILE_USERDEF))
@@ -862,18 +871,18 @@ dist-rtg: dist-release
 
 # RH_LATEST returns the value of the latest "known good" kernel from brew.
 # This should not be confused with the latest top-of-tree development tag.
-dist-get-latest:
+dist-get-latest: ##misc Returns the latest "known good" kernel from brew. This should not be confused with the latest top-of-tree development tag.
 	$(eval RH_LATEST:=$(shell brew latest-pkg --quiet rhel-${RHEL_MAJOR}.${RHEL_MINOR}.0-candidate kernel | awk ' { print $$1 } '))
 	@echo "The latest kernel package tag is ${RH_LATEST}."
 
-dist-os-version:
+dist-os-version: ##misc Displays the current Red Hat Enterprise Linux version target used by the current branch/tree.
 	@echo "OSVERSION: $(RHEL_MAJOR).$(RHEL_MINOR)"
 
 dist-dump-variables:
 	$(eval VARS:=$(sort $(shell cat Makefile.variables | sed '/^#/d; /^$$/d; s/[ ]*[?:]=.*//')))
 	@$(foreach V,$(sort $(.VARIABLES)), $(if $(filter-out environment default automatic, $(origin $V)),$(info $V=$($V)),$(if $(filter $(VARS),$(V)),$(info $V=$($V)))))
 
-dist-self-test:
+dist-self-test: ##misc Runs self-tests from the redhat/self-test directory.
 	@if test -x /usr/bin/bats; then \
 		bats $(REDHAT)/self-test/*.bats ; \
 	else \
@@ -883,141 +892,109 @@ dist-self-test:
 dist-self-test-data:
 	./self-test/data/create-data.sh
 
-dist-check-licenses:
+dist-check-licenses: ##misc Runs license selftest checking SPDX-License-Identifier: tags in all source files against `License:` field in the specfile template.
 	@if test -x /usr/bin/bats; then \
 		bats $(REDHAT)/self-test/1007-spdx-licenses.bats ; \
 	else \
 		echo "dist-check-licenses: The bats package is not installed" ; \
 	fi
 
-dist-help:
-	@echo  'Cleaning targets:'
-	@echo  '  dist-clean          - Clean redhat/configs/ and redhat/rpm/ directories.'
-	@echo  ''
-	@echo  'Building targets:'
-	@echo  '  dist-srpm           - Create a source RPM.'
-	@echo  '  dist-all-rpms       - Create a source RPM and build binary RPMs locally.'
-	@echo  '  dist-brew           - Create a source RPM and call brew to build binary RPMs.'
-	@echo  '  distg-brew          - Build RPMs using a remote git repo.'
-	@echo  '                        [Configuration needed.]'
-	@echo  '  dist-cross-all-rpms - Build RPMs for all supported archs using a cross'
-	@echo  '                        compiler.'
-	@echo  ''
-	@echo  'Configuration targets:'
-	@echo  '  dist-configs        - Create RHEL config files in redhat/config/.'
-	@echo  ''
-	@echo  'For detailed description and full list of targets, run `make dist-full-help`.'
-	@echo  ''
+#
+# Help output
+#
+
+# There's no reason for there to be a 26 (plus three spaces = 29) gap between
+# the target and description output.  It was pulled out of the air because it looked
+# nice on both 80 and 100 column terminals.  So nyah if you don't like it.
+dist-helper-output: COLUMNS=$(shell expr $(shell tput cols) - 29)
+dist-helper-output:
+	@awk -v cols=${COLUMNS} -v distbrew="${HELP_DIST_BREW_OUTPUT}" \
+		-v distkerneltype="${HELP_DIST_KERNEL_TYPE}" -v arches="${ARCH_LIST}" \
+		-v onetarget=${HELP_ONE_TARGET} \
+	'BEGIN {FS = ":.*##${HELP_TYPE}";} \
+		/^[a-zA-Z_0-9-]+:.*?##${HELP_TYPE}/ { \
+			target=$$1; \
+			desc=$$2; \
+			if ( onetarget != "" && onetarget != target) \
+				next; \
+			if ( target == "dist-brew" ) \
+				desc = desc" Available <opt>s and their default values: "distbrew; \
+			if ( target == "dist-kernel-type" ) { \
+				target = "dist-kernel-<type>"; \
+				desc = desc" Available <type>s: "distkerneltype; \
+			} \
+			if ( target == "dist-cross-arch-build" ) { \
+				target = "dist-cross-<arch>-build"; \
+				desc = desc" "arches; \
+			} \
+			desclength = length(desc); \
+			if (desclength <= cols) { \
+				printf ("  \033[36m%-26s\033[0m %s\n", target, desc); \
+				if ( onetarget != "" && onetarget != target) \
+					exit; \
+			} else {\
+				substrloc = 0; \
+				first = 1; \
+				while ( substrloc + cols < desclength ) { \
+					substrlength = cols; \
+					while ( substr(desc, substrloc + substrlength, 1) != " " ) { \
+						substrlength = substrlength - 1; \
+					} \
+					if ( first == 1 ) { \
+						printf("  \033[36m%-26s\033[0m %s\n", target, substr(desc, substrloc, substrlength)); \
+						first = 0; \
+					} else \
+						printf("  %-26s %s\n", " ", substr(desc, substrloc, substrlength)); \
+					substrloc = substrloc + substrlength; \
+				} \
+				printf("  %-26s %s\n", " ", substr(desc, substrloc, cols)); \
+				if ( onetarget != "" && onetarget != target) \
+					exit; \
+			} \
+		} \
+	' $(MAKEFILE_LIST)
+
+dist-help-%: HELP_TYPE=$(patsubst dist-help-%,%,$@)
+dist-help-%:
+	@if ! echo "${HELP_TYPES}" | grep -q ${HELP_TYPE}; then \
+		echo "No help for ${HELP_TYPE}.  Valid types are {${HELP_TYPES}}"; \
+		exit 1; \
+	fi
+	@if [ "${HELP_TYPE}" == "build" ]; then \
+		HELP_DIST_BREW_OUTPUT="$(shell sed -n -e 's/^%define with_\([^ \t]*\).*\?_without_.*/+\1/p' -e 's/^%define with_\([^ \t]*\).*\?_with_.*/-\1/p' kernel.spec.template | grep -v 'only$$')" HELP_DIST_KERNEL_TYPE="$(shell sed -n 's/^%define with_\([^ ]*only\).*/\1/p' kernel.spec.template)" make -s dist-helper-output; \
+	else \
+		echo "${HELP_TYPE} targets:"; \
+		make -s dist-helper-output; \
+		echo " "; \
+	fi
 
 dist-full-help:
-	@echo  'Cleaning targets:'
-	@echo  '  dist-clean            - Do dist-clean-sources, dist-clean-configs, &'
-	@echo  '                          dist-clean-rpmdirs.'
-	@echo  '  dist-clean-sources    - Clean the redhat/rpm/SOURCES/ directory.'
-	@echo  '  dist-clean-configs    - Clean the redhat/configs/ directory.'
-	@echo  '  dist-clean-rpmdirs    - Clean the redhat/rpm/{BUILD,SRPMS,RPMS,SPECS}/'
-	@echo  '                          directories.'
+	@for helptype in ${HELP_TYPES}; \
+	do \
+		make -s dist-help-$${helptype}; \
+	done
+
+dist-help:
+	@echo  'cleaning targets:'
+	@make -s HELP_TYPE=cleaning HELP_ONE_TARGET=dist-clean dist-helper-output
 	@echo  ''
-	@echo  'Building targets:'
-	@echo  ' All RPM/SRPM files will be put under the redhat/rpm/ directory.'
+	@echo  'building targets:'
+	@make -s HELP_TYPE=build HELP_ONE_TARGET=dist-srpm dist-helper-output
+	@make -s HELP_TYPE=build HELP_ONE_TARGET=dist-all-rpms dist-helper-output
+	@make -s HELP_TYPE=build HELP_ONE_TARGET=dist-brew dist-helper-output
+	@make -s HELP_TYPE=build HELP_ONE_TARGET=distg-brew dist-helper-output
+	@make -s HELP_TYPE=build HELP_ONE_TARGET=dist-cross-all-rpms dist-helper-output
 	@echo  ''
-	@echo  '  dist-srpm       - Create a source RPM and put it into the redhat/rpm/SRPMS/'
-	@echo  '                    directory.  See the dist-brew target for available options.'
-	@echo  '  dist-srpm-gcov  - Create a source RPM with gcov enabled and put it into the'
-	@echo  '                    redhat/rpm/SRPMS/ directory.'
-	@echo  '  dist-brew       - Create a kernel SRPM and then call brew to build the'
-	@echo  '                    created SRPM.  Add BUILDOPTS="+<opt> -<opt> [...]" to'
-	@echo  '                    enable/disable build options.'
-	@echo  '                    Available <opt>s and their default values:' \
-		$$(sed -n -e 's/^%define with_\([^ \t]*\).*\?_without_.*/+\1/p' \
-		          -e 's/^%define with_\([^ \t]*\).*\?_with_.*/-\1/p' kernel.spec.template | \
-		grep -v 'only$$') | fmt -80
-	@echo  '  dist-koji       - Create a kernel SRPM and then call koji to build the'
-	@echo  '                    created SRPM.  See the dist-brew target for available'
-	@echo  '                    options.'
-	@echo  '  distg-brew      - Pass HEAD of the current git branch to brew to build an'
-	@echo  '                    RPM set.  Do not forget to push to the remote repository'
-	@echo  '                    first.  Preceed make command by RHGITCOMMIT=<commitID>'
-	@echo  '                    specify commit ID to use.'
-	@echo  '                    To set the remote repo, invoke:'
-	@echo  '                         git config rhg.url git://<repo_path>'
-	@echo  '  distg-koji      - Pass HEAD of the current git branch to koji to build an'
-	@echo  '                    RPM set.  Do not forget to push to the remote repository'
-	@echo  '                    first.  See the distg-brew target for options and'
-	@echo  '                    configuration.'
-	@echo  '  dist-rpms       - Create the binary RPMS for the kernel.'
-	@echo  '                    See the dist-brew target for available options.'
-	@echo  '  dist-rpm-baseonly  - Create the binary RPMS for the kernel and modules'
-	@echo  '                       (no userspace tools or debuginfo).'
-	@echo  '  dist-kernel-<type> - Create  binary RPMS for a particular kernel type.'
-	@echo  '                       Available <type>s:'\
-		$$(sed -n 's/^%define with_\([^ ]*only\).*/\1/p' kernel.spec.template)
-
-	@echo  '  dist-all-rpms   - Create the binary RPMS and the SRPM for the kernel.'
-	@echo  '                    See the dist-brew target for available options.'
-	@echo  '  dist-prep       - Setup the redhat/rpm/BUILD/ directory with the kernel'
-	@echo  '                    source.  See the dist-brew target for available options.'
-	@echo  '  dist-test-patch - Create a diff against HEAD and put it in'
-	@echo  '                    linux-kernel-test.patch.  This patch will'
-	@echo  '                    be added to the kernel build.'
-	@echo  '  dist-stub-key   - Use pre generated keys to speed local test builds.'
-	@echo  '  dist-cross-download     - [x86_64 only] download cross compiler rpms.'
-	@echo  '  dist-cross-all-builds   - [x86_64 only] execute "rpmbuild -bc" for all'
-	@echo  '                            supported archs using RHEL cross compiler.'
-	@echo  '  dist-cross-<arch>-build - [x86_64 only] execute "rpmbuild -bc" for specified'
-	@echo  '                            <arch> using RHEL cross compiler.'
-	@echo  '                            Supported <arch>s: x86_64'\
-		$$(sed -n 's/.*--target \([^ ]*\).*/\1/p' Makefile.cross | sort -u)
-	@echo  '  dist-cross-all-rpms     - [x86_64 only] execute rpm builds for all supported'
-	@echo  '                            archs using RHEL cross compiler.'
-	@echo  '  dist-cross-<arch>-rpms  - [x86_64 only] execute rpm builds for specified'
-	@echo  '                            <arch> using RHEL cross compiler.'
-	@echo  '                            See dist-cross-<arch>-build for the supported archs.'
-	@echo  '  dist-rhel-configs       - build ELN configs'
-	@echo  '  dist-fedora-configs     - build Fedora configs'
-
+	@echo  'configuration targets:'
+	@make -s HELP_TYPE=configuration HELP_ONE_TARGET=dist-configs dist-helper-output
 	@echo  ''
-	@echo  'kABI targets:'
-	@echo  '  dist-kabi           - Create kABI stablelist files in redhat/kabi/kabi-rhel*/'
-	@echo  '                        and merge kABI checksums into redhat/kabi/Module.kabi_*.'
-	@echo  '  dist-kabi-dup       - Merge kABI checksums for Driver Update Program (DUP)'
-	@echo  '                        into redhat/kabi/Module.kabi_dup_*.'
-	@echo  '  dist-check-kabi     - Check for changes in kABI stablelisted symbols.'
-	@echo  '                        Requires a pre-compiled tree: run `make dist-configs`,'
-	@echo  '                        copy the relevant config file from redhat/configs/ to'
-	@echo  '                       .config, and run `make`.'
-	@echo  '  dist-check-kabi-dup - Like dist-check-kabi but uses a DUP kABI stablelist.'
-	@echo  '  dist-kabi-dw-base   - Generate the base dataset for kABI DWARF-based check.'
-	@echo  '  dist-kabi-dw-check  - Run DWARF-based kABI comparison of current binaries'
-	@echo  '                        with the base dataset.'
-	@echo  '  dist-kabi-update    - Update kabi stablelist checksums.'
-	@echo  '  dist-symtype-diff   - Diff kabi stablelist and current kernel.'
-
+	@echo  'Longer help for commands can be displayed with'
 	@echo  ''
-	@echo  'Configuration targets:'
-	@echo  '  dist-configs  - Creates config files for RHEL $(RHEL_MAJOR) architectures,'
-	@echo  '                  cleans them by running make nonint_oldconfig, and copies'
-	@echo  '                  them to redhat/configs/ directory. This is the target to use'
-	@echo  '                  for a config!  Copy the config file you want from the'
-	@echo  '                  redhat/configs/ directory to .config'
-	@echo  '  dist-configs-arch  - Same as dist-configs but for single architecture only.'
-
+	@echo  -e '     \033[36mmake dist-help-HELPTYPE\033[0m'
+	@echo  ''
+	@echo  'where HELPTYPE is one of: {${HELP_TYPES}}.'
 	@echo  ''
-	@echo  'Misc targets:'
-	@echo  '  dist-get-buildreqs - returns list of packages listed as build requirements'
-	@echo  '                       for this kernel'
-	@echo  '  dist-get-latest - Returns the latest "known good" kernel from brew. This'
-	@echo  '                    should not be confused with the latest top-of-tree'
-	@echo  '                    development tag.'
-	@echo  '  dist-get-tag    - Returns the latest release tag'
-	@echo  '  dist-os-version - Displays the current Red Hat Enterprise Linux versioni'
-	@echo  '                    target used by the current branch/tree.'
-	@echo  '  dist-self-test  - Runs self-tests from the redhat/self-test directory'
-	@echo  '  dist-check-licenses - Runs license selftest checking SPDX-License-Identifier:'
-	@echo  '                        tags in all source files against `License:` field in the'
-	@echo  '                        specfile template.'
+	@echo  -e 'For full list of targets, run `\033[36mmake dist-full-help\033[0m`.'
 	@echo  ''
 
-dist-prarit:
-	@echo "hello world"
 export
diff --git a/redhat/Makefile.cross b/redhat/Makefile.cross
index blahblah..blahblah 100644
--- a/redhat/Makefile.cross
+++ b/redhat/Makefile.cross
@@ -52,7 +52,7 @@ dist-cross-riscv64-rpms: dist-cross-setup dist-sources
 		echo "INFO: RISC-V builds are only supported on Fedora."; \
 	fi;
 
-dist-cross-all-rpms: dist-cross-setup dist-sources
+dist-cross-all-rpms: dist-cross-setup dist-sources ##build [x86_64 only] execute rpm builds for all supported archs using RHEL cross compiler
 	$(REDHAT)/scripts/cross-compile/x86_rngd.sh
 	$(CROSS_RPMFLAGS) --target aarch64 --with cross $(CROSS_DISABLED_SUBPACKAGES) -ba $(RPM)/SOURCES/$(SPECFILE)
 	$(CROSS_RPMFLAGS) --target ppc64le --with cross $(CROSS_DISABLED_SUBPACKAGES) -ba $(RPM)/SOURCES/$(SPECFILE)
@@ -85,7 +85,7 @@ dist-cross-riscv64-build: dist-cross-setup dist-sources
 	$(CROSS_RPMFLAGS) --target riscv64 --with cross --without debuginfo $(CROSS_DISABLED_SUBPACKAGES) -bc $(RPM)/SOURCES/$(SPECFILE)
 	$(REDHAT)/scripts/cross-compile/generate-cross-report.sh "riscv64"
 
-dist-cross-all-builds: dist-cross-setup dist-sources
+dist-cross-all-builds: dist-cross-setup dist-sources ##build [x86_64 only] execute "rpmbuild -bc" for all supported archs using RHEL cross compiler
 	$(REDHAT)/scripts/cross-compile/x86_rngd.sh
 	$(CROSS_RPMFLAGS) --target aarch64 --with cross --without debuginfo $(CROSS_DISABLED_SUBPACKAGES) -bc $(RPM)/SOURCES/$(SPECFILE)
 	$(CROSS_RPMFLAGS) --target ppc64le --with cross --without debuginfo $(CROSS_DISABLED_SUBPACKAGES) -bc $(RPM)/SOURCES/$(SPECFILE)
@@ -93,3 +93,6 @@ dist-cross-all-builds: dist-cross-setup dist-sources
 	$(CROSS_RPMFLAGS) --target riscv64 --with cross --without debuginfo $(CROSS_DISABLED_SUBPACKAGES) -bc $(RPM)/SOURCES/$(SPECFILE)
 	$(CROSS_RPMFLAGS) --without debuginfo -bc $(RPM)/SOURCES/$(SPECFILE)
 	$(REDHAT)/scripts/cross-compile/generate-cross-report.sh "aarch64 ppc64le s390x x86_64 riscv64"
+
+# this is a dummy entry to define help for the dist-cross-<arch>-build targets
+dist-cross-arch-build: ##build [x86_64 only] execute "rpmbuild -bc" for specified' <arch> using RHEL cross compiler.  Supported <arch>s:

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3585

-- 
_______________________________________________
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, report it: https://pagure.io/fedora-infrastructure/new_issue




[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