Skip to content

Commit

Permalink
Fix parallel make srpm
Browse files Browse the repository at this point in the history
When building srpm using make -j, each of the recursive makes invoked to
build srpm-{dkms,kmod,utils} will build the dist target. This is both
unnecessary, and also has a very good chance of breaking when they race
trying to build gitrev.

Fix this by make dist a prerequisite of srpm-{dkms,kmod,utils} instead
of srpm-common, so that it will be done once before invoking the
recursive makes.

Also, gitrev is not really required for make dist, so instead of adding
it to BUILT_SOURCES, just add it as a prerequisite of the all target.

Mark the individual package targets as PHONY.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Arvind Sankar <[email protected]>
Closes openzfs#10564
  • Loading branch information
nivedita76 authored and behlendorf committed Jul 15, 2020
1 parent 1743c73 commit e6c093d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
14 changes: 6 additions & 8 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
ACLOCAL_AMFLAGS = -I config

include config/rpm.am
include config/deb.am
include config/tgz.am

SUBDIRS = include
if BUILD_LINUX
SUBDIRS += rpm
Expand Down Expand Up @@ -54,6 +50,7 @@ EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip
@CODE_COVERAGE_RULES@

GITREV = include/zfs_gitrev.h
CLEANFILES = $(GITREV)

PHONY = gitrev
gitrev:
Expand All @@ -68,10 +65,7 @@ gitrev:
mv -f $(GITREV)~ $(GITREV); \
fi

$(GITREV): gitrev

BUILT_SOURCES = $(GITREV)
CLEANFILES = $(GITREV)
all: gitrev

# Double-colon rules are allowed; there are multiple independent definitions.
distclean-local::
Expand Down Expand Up @@ -252,4 +246,8 @@ pkg-dkms: @DEFAULT_PACKAGE@-dkms
pkg-kmod: @DEFAULT_PACKAGE@-kmod
pkg-utils: @DEFAULT_PACKAGE@-utils

include config/rpm.am
include config/deb.am
include config/tgz.am

.PHONY: $(PHONY)
2 changes: 2 additions & 0 deletions config/deb.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
PHONY += deb-kmod deb-dkms deb-utils deb deb-local

deb-local:
@(if test "${HAVE_DPKGBUILD}" = "no"; then \
echo -e "\n" \
Expand Down
8 changes: 7 additions & 1 deletion config/rpm.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
# Build targets for RPM packages.
###############################################################################

PHONY += srpm srpms srpm-kmod srpm-dkms srpm-utils
PHONY += rpm rpms rpm-kmod rpm-dkms rpm-utils
PHONY += srpm-common rpm-common rpm-local

srpm-kmod srpm-dkms srpm-utils: dist

srpm-kmod:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-kmod" \
def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_KMOD}' srpm-common
Expand Down Expand Up @@ -54,7 +60,7 @@ rpm-local:
cp $(top_srcdir)/scripts/kmodtool $(rpmbuild)/SOURCES && \
cp $(distdir).tar.gz $(rpmbuild)/SOURCES)

srpm-common: dist
srpm-common:
@(dist=`$(RPM) --eval %{?dist}`; \
rpmpkg=$(pkg)-$(VERSION)-$(RELEASE)$$dist*src.rpm; \
rpmspec=$(pkg).spec; \
Expand Down
2 changes: 2 additions & 0 deletions config/tgz.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
PHONY += tgz tgz-kmod tgz-utils tgz-local

tgz-local:
@(if test "${HAVE_ALIEN}" = "no"; then \
echo -e "\n" \
Expand Down

0 comments on commit e6c093d

Please sign in to comment.