From: Ben Crocker <bcrocker@xxxxxxxxxx> [redhat] Makefile: consolidate rpmbuild cmds into one target Consolidate rpmbuild commands into a new target, do-rpmbuild, and invoke it from dist-all-rpms, dist-srpm, etc. via, e.g., dist-srpm: RPMBUILDOPTS=--nodeps -bs dist-srpm: dist-sources do-rpmbuild This works for all the targets that invoke rpmbuild EXCEPT dist-kernel-%, which we rewrite: dist-kernel-%: dist-sources RPMBUILDOPTS="--target $(MACH) --with $* --without vdso_install --without perf --without tools -bb" make do-rpmbuild i.e., setting RPMBUILDOPTS and then invoking make again, and dist-srpm-gcov, which already had an extra 'make' in its recipe. The cost of the dist-kernel-% rewrite is an extra trip through the Makefile, and the extra prologue (4 lines) and epilogue (1 line) output that goes with it. The newly rewritten dist-* targets require some ordering constraints, which are not a bad idea even in the absence of these modifications, and which can be accomplished by moving setup-source, dist-configs-check FROM dist-sources TO sources-rh, thus making sure that setup-source and dist-configs-check get made strictly before sources-rh. With these ordering constraints in place, commands like the following work as expected: % make -j 64 dist-rpms Signed-off-by: Ben Crocker <bcrocker@xxxxxxxxxx> diff a/redhat/Makefile b/redhat/Makefile --- a/redhat/Makefile +++ b/redhat/Makefile @@ -228,7 +228,7 @@ generate-testpatch-tmp: ":(exclude,top)Makefile.rhelver" \ ":(exclude,top)redhat" > $(TESTPATCH).tmp -sources-rh: $(TARBALL) generate-testpatch-tmp +sources-rh: $(TARBALL) generate-testpatch-tmp setup-source dist-configs-check @cp -l $(TARBALL) $(SOURCES)/ || cp $(TARBALL) $(SOURCES)/ @touch $(TESTPATCH) @diff $(TESTPATCH).tmp $(TESTPATCH) > /dev/null || \ @@ -270,36 +270,38 @@ sources-rh: $(TARBALL) generate-testpatch-tmp fi @(cd kabi-dwarf && tar cjf $(SOURCES)/$(KABIDW_TARFILE) base run_kabi-dw.sh) -dist-sources: setup-source dist-configs-check dist-kabi dist-kabi-dup sources-rh +dist-sources: dist-kabi dist-kabi-dup sources-rh dist-test-patch: generate-testpatch-tmp @mv $(TESTPATCH).tmp $(TESTPATCH); -dist-all-rpms: 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)" --target $(MACH) -ba $(RPM)/SOURCES/$(PACKAGE_NAME).spec +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/$(PACKAGE_NAME).spec -dist-srpm: 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)" --nodeps -bs $(RPM)/SOURCES/$(PACKAGE_NAME).spec +dist-all-rpms: RPMBUILDOPTS=--target $(MACH) -ba +dist-all-rpms: dist-sources do-rpmbuild + +dist-srpm: RPMBUILDOPTS=--nodeps -bs +dist-srpm: dist-sources do-rpmbuild dist-srpm-gcov: make dist-sources BUILDID=".gcov" BUILDOPTS="+gcov" - $(RPMBUILD) --define "_sourcedir $(SOURCES)" --define "_builddir $(RPM)/BUILD" --define "_srcrpmdir $(RPM)/SRPMS" --define "_rpmdir $(RPM)/RPMS" --define "_specdir $(RPM)/SPECS" --define "dist $(DIST)" --nodeps -bs $(RPM)/SOURCES/$(PACKAGE_NAME).spec + RPMBUILDOPTS="--nodeps -bs" make do-rpmbuild -dist-rpms: 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)" --target $(MACH) -bb $(RPM)/SOURCES/$(PACKAGE_NAME).spec +dist-rpms: RPMBUILDOPTS=--target $(MACH) -bb +dist-rpms: dist-sources do-rpmbuild dist-kernel-%: 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)" --target $(MACH) --with $* --without vdso_install --without perf --without tools -bb $(RPM)/SOURCES/$(PACKAGE_NAME).spec - -dist-prep: 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)" --nodeps --target noarch -bp $(RPM)/SOURCES/$(PACKAGE_NAME).spec + RPMBUILDOPTS="--target $(MACH) --with $* --without vdso_install --without perf --without tools -bb" make do-rpmbuild -dist-perf: 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)" --without up --without smp --without zfcpdump --without debug --without doc --without headers --without --without doc --without debuginfo --target $(MACH) -bb $(RPM)/SOURCES/$(PACKAGE_NAME).spec +dist-prep: RPMBUILDOPTS=--nodeps --target noarch -bp +dist-prep: dist-sources do-rpmbuild -dist-rpm-baseonly: 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)" --target $(MACH) --without debug --without debuginfo --without vdso_install --without bpftool --without perf --without tools -bb $(RPM)/SOURCES/$(PACKAGE_NAME).spec +dist-perf: RPMBUILDOPTS=--without up --without smp --without zfcpdump --without debug --without doc --without headers --without --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 # unless you know what you're doing, you don't want to use the next four ones dist-release-finish: setup-source -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/869 _______________________________________________ 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