2013-02-18 00:10:17 +04:00
|
|
|
###############################################################################
|
|
|
|
# Copyright (C) 2007-2013 Lawrence Livermore National Security, LLC.
|
|
|
|
# Copyright (C) 2007 The Regents of the University of California.
|
|
|
|
# Written by Brian Behlendorf <behlendorf1@llnl.gov>.
|
|
|
|
###############################################################################
|
|
|
|
# Build targets for RPM packages.
|
|
|
|
###############################################################################
|
|
|
|
|
Fix parallel make srpm
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 <behlendorf1@llnl.gov>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Closes #10564
2020-07-14 00:24:07 +03:00
|
|
|
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
|
|
|
|
|
2013-02-18 00:10:17 +04:00
|
|
|
srpm-kmod:
|
|
|
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-kmod" \
|
|
|
|
def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_KMOD}' srpm-common
|
|
|
|
|
|
|
|
srpm-dkms:
|
|
|
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-dkms" \
|
|
|
|
def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_DKMS}' srpm-common
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
srpm-utils:
|
2013-02-18 00:10:17 +04:00
|
|
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \
|
|
|
|
def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_UTIL}' srpm-common
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2013-02-18 00:10:17 +04:00
|
|
|
srpm: srpm-kmod srpm-dkms srpm-utils
|
|
|
|
srpms: srpm-kmod srpm-dkms srpm-utils
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2013-02-18 00:10:17 +04:00
|
|
|
rpm-kmod: srpm-kmod
|
|
|
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-kmod" \
|
|
|
|
def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_KMOD}' rpm-common
|
2012-08-08 00:13:17 +04:00
|
|
|
|
2013-02-18 00:10:17 +04:00
|
|
|
rpm-dkms: srpm-dkms
|
|
|
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-dkms" \
|
|
|
|
def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_DKMS}' rpm-common
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
rpm-utils: srpm-utils
|
2013-02-18 00:10:17 +04:00
|
|
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \
|
|
|
|
def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_UTIL}' rpm-common
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2013-02-18 00:10:17 +04:00
|
|
|
rpm: rpm-kmod rpm-dkms rpm-utils
|
|
|
|
rpms: rpm-kmod rpm-dkms rpm-utils
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
rpm-local:
|
|
|
|
@(if test "${HAVE_RPMBUILD}" = "no"; then \
|
|
|
|
echo -e "\n" \
|
|
|
|
"*** Required util ${RPMBUILD} missing. Please install the\n" \
|
|
|
|
"*** package for your distribution which provides ${RPMBUILD},\n" \
|
|
|
|
"*** re-run configure, and try again.\n"; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
mkdir -p $(rpmbuild)/TMP && \
|
|
|
|
mkdir -p $(rpmbuild)/BUILD && \
|
|
|
|
mkdir -p $(rpmbuild)/RPMS && \
|
|
|
|
mkdir -p $(rpmbuild)/SRPMS && \
|
|
|
|
mkdir -p $(rpmbuild)/SPECS && \
|
2013-02-18 00:10:17 +04:00
|
|
|
cp ${RPM_SPEC_DIR}/$(rpmspec) $(rpmbuild)/SPECS && \
|
2010-08-26 22:22:58 +04:00
|
|
|
mkdir -p $(rpmbuild)/SOURCES && \
|
2014-06-10 01:55:31 +04:00
|
|
|
cp $(top_srcdir)/scripts/kmodtool $(rpmbuild)/SOURCES && \
|
2010-08-26 22:22:58 +04:00
|
|
|
cp $(distdir).tar.gz $(rpmbuild)/SOURCES)
|
|
|
|
|
Fix parallel make srpm
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 <behlendorf1@llnl.gov>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Closes #10564
2020-07-14 00:24:07 +03:00
|
|
|
srpm-common:
|
2013-02-18 00:10:17 +04:00
|
|
|
@(dist=`$(RPM) --eval %{?dist}`; \
|
|
|
|
rpmpkg=$(pkg)-$(VERSION)-$(RELEASE)$$dist*src.rpm; \
|
2010-08-26 22:22:58 +04:00
|
|
|
rpmspec=$(pkg).spec; \
|
|
|
|
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
|
|
|
|
$(MAKE) $(AM_MAKEFLAGS) \
|
|
|
|
rpmbuild="$$rpmbuild" \
|
|
|
|
rpmspec="$$rpmspec" \
|
|
|
|
rpm-local || exit 1; \
|
2014-06-10 01:27:09 +04:00
|
|
|
LANG=C $(RPMBUILD) \
|
2010-08-26 22:22:58 +04:00
|
|
|
--define "_tmppath $$rpmbuild/TMP" \
|
|
|
|
--define "_topdir $$rpmbuild" \
|
2013-02-18 00:10:17 +04:00
|
|
|
$(def) -bs $$rpmbuild/SPECS/$$rpmspec || exit 1; \
|
2010-08-26 22:22:58 +04:00
|
|
|
cp $$rpmbuild/SRPMS/$$rpmpkg . || exit 1; \
|
2013-02-18 00:10:17 +04:00
|
|
|
rm -R $$rpmbuild)
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
rpm-common:
|
2013-02-18 00:10:17 +04:00
|
|
|
@(dist=`$(RPM) --eval %{?dist}`; \
|
|
|
|
rpmpkg=$(pkg)-$(VERSION)-$(RELEASE)$$dist*src.rpm; \
|
2010-08-26 22:22:58 +04:00
|
|
|
rpmspec=$(pkg).spec; \
|
|
|
|
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
|
|
|
|
$(MAKE) $(AM_MAKEFLAGS) \
|
|
|
|
rpmbuild="$$rpmbuild" \
|
|
|
|
rpmspec="$$rpmspec" \
|
|
|
|
rpm-local || exit 1; \
|
2014-06-10 01:27:09 +04:00
|
|
|
LANG=C ${RPMBUILD} \
|
2010-08-26 22:22:58 +04:00
|
|
|
--define "_tmppath $$rpmbuild/TMP" \
|
|
|
|
--define "_topdir $$rpmbuild" \
|
2013-02-18 00:10:17 +04:00
|
|
|
$(def) --rebuild $$rpmpkg || exit 1; \
|
2010-08-26 22:22:58 +04:00
|
|
|
cp $$rpmbuild/RPMS/*/* . || exit 1; \
|
2013-02-18 00:10:17 +04:00
|
|
|
rm -R $$rpmbuild)
|