aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.am
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-03-05 09:08:07 -0800
committerBrian Behlendorf <[email protected]>2009-03-09 15:56:55 -0700
commitc5f704607bbdc5e6a89b4ac088dff16a6c1eeb5e (patch)
tree182cb70d67bde33e9697623ca0b0533985407528 /Makefile.am
parent32f74c5280ca9a753991b97370e7c4c1a4e34ede (diff)
Build system and packaging (RPM support)
An update to the build system to properly support all commonly used Makefile targets these include: make all # Build everything make install # Install everything make clean # Clean up build products make distclean # Clean up everything make dist # Create package tarball make srpm # Create package source RPM make rpm # Create package binary RPMs make tags # Create ctags and etags for everything Extra care was taken to ensure that the source RPMs are fully rebuildable against Fedora/RHEL/Chaos kernels. To build binary RPMs from the source RPM for your system simply run: rpmbuild --rebuild spl-x.y.z-1.src.rpm This will produce two binary RPMs with correct 'requires' dependencies for your kernel. One will contain all spl modules and support utilities, the other is a devel package for compiling additional kernel modules which are dependant on the spl. spl-x.y.z-1_<kernel version>.x86_64.rpm spl-devel-x.y.2-1_<kernel version>.x86_64.rpm
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am56
1 files changed, 50 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index e0c5fe29e..410d9a689 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,10 +1,54 @@
+SUBDIRS = lib cmd module include scripts
+
AUTOMAKE_OPTIONS = foreign dist-zip
+EXTRA_DIST = autogen.sh spl.spec META DISCLAIMER
+include_HEADERS = spl_config.h
-SUBDIRS = lib cmd module include scripts
-CONFIG_CLEAN_FILES = aclocal.m4 config.guess config.sub
-CONFIG_CLEAN_FILES += depcomp install-sh missing mkinstalldirs
-EXTRA_DIST = autogen.sh
+distclean-local::
+ -$(RM) -R autom4te*.cache
+ -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
+ -o -name .pc -o -name .hg -o -name .git \) -prune -o \
+ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
+ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
+ -o -name '.*.rej' -o -name 'aclocal.m4' -o -size 0 \
+ -o -name '*%' -o -name '.*.cmd' -o -name 'core' \
+ -o -name 'Makefile' -o -name 'Module.symvers' \) \
+ -type f -print | xargs $(RM)
+
+install-data-local:
+ $(INSTALL) module/Module.symvers $(DESTDIR)/$(includedir)
+
+ctags:
+ $(RM) $(top_srcdir)/tags
+ find $(top_srcdir) -name .git -prune -o -name '*.[hc]' | xargs ctags
+
+etags:
+ $(RM) $(top_srcdir)/TAGS
+ find $(top_srcdir) -name .pc -prune -o -name '*.[hc]' | xargs etags -a
+
+tags: ctags etags
+
+rpm-local:
+ mkdir -p $(rpmbuild)/TMP && \
+ mkdir -p $(rpmbuild)/BUILD && \
+ mkdir -p $(rpmbuild)/RPMS && \
+ mkdir -p $(rpmbuild)/SRPMS && \
+ mkdir -p $(rpmbuild)/SPECS && cp $(PACKAGE).spec $(rpmbuild)/SPECS && \
+ mkdir -p $(rpmbuild)/SOURCES && cp $(distdir).tar.gz $(rpmbuild)/SOURCES
-rpms: dist Makefile
- rpmbuild -ta $(distdir).tar.gz
+srpm: dist
+ rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
+ $(MAKE) $(AM_MAKEFLAGS) rpmbuild="$$rpmbuild" rpm-local || exit 1; \
+ /usr/bin/rpmbuild --define "_tmppath $$rpmbuild/TMP" --define "_topdir $$rpmbuild" --define "build_src_rpm 1" --define "dist %{nil}" --nodeps -bs $$rpmbuild/SPECS/$(PACKAGE).spec || exit 1; \
+ cp $$rpmbuild/SRPMS/$(distdir)-$(SPL_META_RELEASE).src.rpm . || exit 1;\
+ $(RM) -R $$rpmbuild
+# Use 'make rpm LINUX_VERSION=2.x.y-z' to rebuild the source RPM
+# against any installed kernel-devel-2.x.y-z package. This will
+# override the LINUX_VERSION detected at configure time.
+rpm: srpm
+ rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
+ $(MAKE) $(AM_MAKEFLAGS) rpmbuild="$$rpmbuild" rpm-local || exit 1; \
+ /usr/bin/rpmbuild --define "_tmppath $$rpmbuild/TMP" --define "_topdir $$rpmbuild" --define "dist %{nil}" --define "require_kver $(LINUX_VERSION)" --nodeps --rebuild $(distdir)-$(SPL_META_RELEASE).src.rpm || exit 1; \
+ cp $$rpmbuild/RPMS/*/* . || exit 1; \
+ $(RM) -R $$rpmbuild