1 ###############################################################################
2 # Copyright (C) 2007-2013 Lawrence Livermore National Security, LLC.
3 # Copyright (C) 2007 The Regents of the University of California.
4 # Written by Brian Behlendorf <behlendorf1@llnl.gov>.
5 ###############################################################################
6 # Build targets for RPM packages.
7 ###############################################################################
9 PHONY += srpm srpms srpm-kmod srpm-dkms srpm-utils
10 PHONY += rpm rpms rpm-kmod rpm-dkms rpm-utils rpm-utils-initramfs
11 PHONY += srpm-common rpm-common rpm-local
13 srpm-kmod srpm-dkms srpm-utils: dist
16 $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-kmod" \
17 def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_KMOD}' srpm-common
20 $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-dkms" \
21 def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_DKMS}' srpm-common
24 $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \
25 def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_UTIL}' srpm-common
27 srpm: srpm-kmod srpm-dkms srpm-utils
28 srpms: srpm-kmod srpm-dkms srpm-utils
31 $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-kmod" \
32 def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_KMOD}' rpm-common
35 $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-dkms" \
36 def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_DKMS}' rpm-common
38 # The rpm-utils and rpm-utils-initramfs targets are identical except for the
39 # zfs-initramfs package: rpm-utils never includes it, rpm-utils-initramfs
40 # includes it if detected at configure time. The zfs-initramfs package does
41 # not work on any known RPM-based distribution and the resulting RPM is only
42 # used to create a Debian package. The rpm-utils-initramfs target is not
43 # intended to be specified by the user directly, it is provided as a
44 # dependency of the deb-utils target.
47 $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \
48 def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_UTIL}' rpm-common
50 rpm-utils-initramfs: srpm-utils
51 $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \
52 def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_UTIL} ${RPM_DEFINE_INITRAMFS}' rpm-common
54 rpm: rpm-kmod rpm-dkms rpm-utils
55 rpms: rpm-kmod rpm-dkms rpm-utils
58 @(if test "${HAVE_RPMBUILD}" = "no"; then \
60 "*** Required util ${RPMBUILD} missing. Please install the\n" \
61 "*** package for your distribution which provides ${RPMBUILD},\n" \
62 "*** re-run configure, and try again.\n"; \
65 mkdir -p $(rpmbuild)/TMP && \
66 mkdir -p $(rpmbuild)/BUILD && \
67 mkdir -p $(rpmbuild)/RPMS && \
68 mkdir -p $(rpmbuild)/SRPMS && \
69 mkdir -p $(rpmbuild)/SPECS && \
70 cp ${RPM_SPEC_DIR}/$(rpmspec) $(rpmbuild)/SPECS && \
71 mkdir -p $(rpmbuild)/SOURCES && \
72 cp $(top_srcdir)/scripts/kmodtool $(rpmbuild)/SOURCES && \
73 cp $(distdir).tar.gz $(rpmbuild)/SOURCES)
76 @(dist=`$(RPM) --eval %{?dist}`; \
77 rpmpkg=$(pkg)-$(VERSION)-$(RELEASE)$$dist*src.rpm; \
78 rpmspec=$(pkg).spec; \
79 rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
80 $(MAKE) $(AM_MAKEFLAGS) \
81 rpmbuild="$$rpmbuild" \
83 rpm-local || exit 1; \
85 --define "_tmppath $$rpmbuild/TMP" \
86 --define "_builddir $$rpmbuild/BUILD" \
87 --define "_rpmdir $$rpmbuild/RPMS" \
88 --define "_srcrpmdir $$rpmbuild/SRPMS" \
89 --define "_specdir $$rpmbuild/SPECS" \
90 --define "_sourcedir $$rpmbuild/SOURCES" \
91 --define "_topdir $$rpmbuild" \
92 $(def) -bs $$rpmbuild/SPECS/$$rpmspec || exit 1; \
93 cp $$rpmbuild/SRPMS/$$rpmpkg . || exit 1; \
97 @(dist=`$(RPM) --eval %{?dist}`; \
98 rpmpkg=$(pkg)-$(VERSION)-$(RELEASE)$$dist*src.rpm; \
99 rpmspec=$(pkg).spec; \
100 rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
101 $(MAKE) $(AM_MAKEFLAGS) \
102 rpmbuild="$$rpmbuild" \
103 rpmspec="$$rpmspec" \
104 rpm-local || exit 1; \
106 --define "_tmppath $$rpmbuild/TMP" \
107 --define "_builddir $$rpmbuild/BUILD" \
108 --define "_rpmdir $$rpmbuild/RPMS" \
109 --define "_srcrpmdir $$rpmbuild/SRPMS" \
110 --define "_specdir $$rpmbuild/SPECS" \
111 --define "_sourcedir $$rpmbuild/SOURCES" \
112 --define "_topdir $$rpmbuild" \
113 $(def) --rebuild $$rpmpkg || exit 1; \
114 cp $$rpmbuild/RPMS/*/* . || exit 1; \