From 055bdbe7b773e95386c112c643f233c538d853de Mon Sep 17 00:00:00 2001 From: Turbo Fredriksson Date: Mon, 9 Jun 2014 23:55:31 +0200 Subject: [PATCH] 2378: turbo/issue-1082 - Support parallel build trees (VPATH builds) Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: #1082 For VPATH builds (addition for #1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h --- Makefile.am | 11 +++++------ cmd/arcstat/Makefile.am | 2 +- cmd/dbufstat/Makefile.am | 2 +- cmd/fsck_zfs/Makefile.am | 2 +- cmd/vdev_id/Makefile.am | 2 +- config/kernel.m4 | 19 +++++++++---------- dracut/90zfs/Makefile.am | 9 ++++----- etc/modules-load.d/Makefile.am | 4 ++-- etc/systemd/system/Makefile.am | 14 +++++++------- etc/zfs/Makefile.am | 8 ++++---- lib/libspl/asm-generic/Makefile.am | 2 +- lib/libspl/asm-x86_64/Makefile.am | 3 ++- lib/libspl/include/ia32/sys/Makefile.am | 2 +- man/man1/Makefile.am | 9 +++++++-- man/man5/Makefile.am | 6 +++++- man/man8/Makefile.am | 18 +++++++++--------- module/avl/Makefile.in | 5 ++++- module/nvpair/Makefile.in | 11 +++++++---- module/unicode/Makefile.in | 7 +++++-- module/zcommon/Makefile.in | 19 +++++++++++-------- module/zfs/Makefile.in | 3 +++ module/zpios/Makefile.in | 5 ++++- udev/rules.d/Makefile.am | 8 ++++---- 23 files changed, 98 insertions(+), 73 deletions(-) diff --git a/Makefile.am b/Makefile.am index 49b417a81d9e..0d71e4400cb2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,9 +1,8 @@ - ACLOCAL_AMFLAGS = -I config -include $(top_srcdir)/config/rpm.am -include $(top_srcdir)/config/deb.am -include $(top_srcdir)/config/tgz.am +include config/rpm.am +include config/deb.am +include config/tgz.am SUBDIRS = include rpm if CONFIG_USER @@ -45,11 +44,11 @@ checkstyle: ! -name '*.mod.c' -type f -exec scripts/cstyle.pl {} \+ ctags: - $(RM) $(top_srcdir)/tags + $(RM) tags find $(top_srcdir) -name .git -prune -o -name '*.[hc]' | xargs ctags etags: - $(RM) $(top_srcdir)/TAGS + $(RM) TAGS find $(top_srcdir) -name .pc -prune -o -name '*.[hc]' | xargs etags -a tags: ctags etags diff --git a/cmd/arcstat/Makefile.am b/cmd/arcstat/Makefile.am index 802b8e1d9e01..83be209af25e 100644 --- a/cmd/arcstat/Makefile.am +++ b/cmd/arcstat/Makefile.am @@ -1,2 +1,2 @@ -bin_SCRIPTS = arcstat.py +bin_SCRIPTS = $(top_srcdir)/cmd/arcstat/arcstat.py EXTRA_DIST = $(bin_SCRIPTS) diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am index 0548b240c308..659956433cfe 100644 --- a/cmd/dbufstat/Makefile.am +++ b/cmd/dbufstat/Makefile.am @@ -1,2 +1,2 @@ -bin_SCRIPTS = dbufstat.py +bin_SCRIPTS = $(top_srcdir)/cmd/dbufstat/dbufstat.py EXTRA_DIST = $(bin_SCRIPTS) diff --git a/cmd/fsck_zfs/Makefile.am b/cmd/fsck_zfs/Makefile.am index 2380f56fa4d4..ab9a42b407f6 100644 --- a/cmd/fsck_zfs/Makefile.am +++ b/cmd/fsck_zfs/Makefile.am @@ -1 +1 @@ -dist_sbin_SCRIPTS = fsck.zfs +dist_sbin_SCRIPTS = $(top_srcdir)/cmd/fsck_zfs/fsck.zfs diff --git a/cmd/vdev_id/Makefile.am b/cmd/vdev_id/Makefile.am index fb815faad084..496243210c03 100644 --- a/cmd/vdev_id/Makefile.am +++ b/cmd/vdev_id/Makefile.am @@ -1 +1 @@ -dist_udev_SCRIPTS = vdev_id +dist_udev_SCRIPTS = $(top_srcdir)/cmd/vdev_id/vdev_id diff --git a/config/kernel.m4 b/config/kernel.m4 index 9145dbd89bf4..2c379c0d785f 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -272,12 +272,11 @@ AC_DEFUN([ZFS_AC_SPL], [ dnl # source directory. In order of preference: dnl # splsrc0="/var/lib/dkms/spl/${VERSION}/build" - splsrc1="/usr/local/src/spl-${VERSION}/${LINUX_VERSION}" - splsrc2="/usr/local/src/spl-${VERSION}" - splsrc3="/usr/src/spl-${VERSION}/${LINUX_VERSION}" - splsrc4="/usr/src/spl-${VERSION}" - splsrc5="../spl/" - splsrc6="$LINUX" + splsrc1="/usr/src/spl-${VERSION}/${LINUX_VERSION}" + splsrc2="/usr/src/spl-${VERSION}" + splsrc3="../spl" + splsrc4="../../spl" + splsrc5="$LINUX" AC_MSG_CHECKING([spl source directory]) AS_IF([test -z "${splsrc}"], [ @@ -291,10 +290,8 @@ AC_DEFUN([ZFS_AC_SPL], [ splsrc=$(readlink -f "${splsrc3}") ], [ test -e "${splsrc4}/spl.release.in" ], [ splsrc=${splsrc4} - ], [ test -e "${splsrc5}/spl.release.in"], [ - splsrc=$(readlink -f "${splsrc5}") - ], [ test -e "${splsrc6}/spl.release.in" ], [ - splsrc=${splsrc6} + ], [ test -e "${splsrc5}/spl.release.in" ], [ + splsrc=${splsrc5} ], [ splsrc="[Not found]" ]) @@ -332,6 +329,8 @@ AC_DEFUN([ZFS_AC_SPL], [ splbuild="${splsrc}/${LINUX_VERSION}" ], [ test -e "${splsrc}/spl_config.h" ], [ splbuild="${splsrc}" + ], [ find -L "${splsrc}" -name spl_config.h 2> /dev/null | grep -wq spl_config.h ], [ + splbuild=$(find -L "${splsrc}" -name spl_config.h | sed 's,/spl_config.h,,') ], [ splbuild="[Not found]" ]) diff --git a/dracut/90zfs/Makefile.am b/dracut/90zfs/Makefile.am index 2d1360aded1b..4926ed4a0347 100644 --- a/dracut/90zfs/Makefile.am +++ b/dracut/90zfs/Makefile.am @@ -1,9 +1,8 @@ pkgdracutdir = $(dracutdir)/modules.d/90zfs pkgdracut_SCRIPTS = \ - $(top_srcdir)/dracut/90zfs/export-zfs.sh \ - $(top_srcdir)/dracut/90zfs/module-setup.sh \ - $(top_srcdir)/dracut/90zfs/mount-zfs.sh \ - $(top_srcdir)/dracut/90zfs/parse-zfs.sh + module-setup.sh \ + mount-zfs.sh \ + parse-zfs.sh EXTRA_DIST = \ $(top_srcdir)/dracut/90zfs/export-zfs.sh.in \ @@ -17,7 +16,7 @@ $(pkgdracut_SCRIPTS): -e 's,@udevdir\@,$(udevdir),g' \ -e 's,@udevruledir\@,$(udevruledir),g' \ -e 's,@sysconfdir\@,$(sysconfdir),g' \ - '$@.in' >'$@' + "$(abs_top_srcdir)/dracut/90zfs/$@.in' >'$@' distclean-local:: -$(RM) $(pkgdracut_SCRIPTS) diff --git a/etc/modules-load.d/Makefile.am b/etc/modules-load.d/Makefile.am index 980cb851995e..a6780e1f0838 100644 --- a/etc/modules-load.d/Makefile.am +++ b/etc/modules-load.d/Makefile.am @@ -1,5 +1,5 @@ modulesload_DATA = \ - $(top_srcdir)/etc/modules-load.d/zfs.conf + zfs.conf EXTRA_DIST = \ $(top_srcdir)/etc/modules-load.d/zfs.conf.in @@ -7,7 +7,7 @@ EXTRA_DIST = \ $(modulesload_DATA): -$(SED) \ -e '' \ - '$@.in' >'$@' + "$(top_srcdir)/etc/modules-load.d/$@.in" >'$@' distclean-local:: -$(RM) $(modulesload_DATA) diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am index b7a8db2435c3..3901e8cb349f 100644 --- a/etc/systemd/system/Makefile.am +++ b/etc/systemd/system/Makefile.am @@ -1,12 +1,12 @@ systemdpreset_DATA = \ - $(top_srcdir)/etc/systemd/system/50-zfs.preset + 50-zfs.preset systemdunit_DATA = \ - $(top_srcdir)/etc/systemd/system/zed.service \ - $(top_srcdir)/etc/systemd/system/zfs-import-cache.service \ - $(top_srcdir)/etc/systemd/system/zfs-import-scan.service \ - $(top_srcdir)/etc/systemd/system/zfs-mount.service \ - $(top_srcdir)/etc/systemd/system/zfs-share.service \ - $(top_srcdir)/etc/systemd/system/zfs.target + zed.service \ + zfs-import-cache.service \ + zfs-import-scan.service \ + zfs-mount.service \ + zfs-share.service \ + zfs.target EXTRA_DIST = \ $(top_srcdir)/etc/systemd/system/zed.service.in \ diff --git a/etc/zfs/Makefile.am b/etc/zfs/Makefile.am index ff35469fe7bb..a292265a3f06 100644 --- a/etc/zfs/Makefile.am +++ b/etc/zfs/Makefile.am @@ -1,9 +1,9 @@ pkgsysconfdir = $(sysconfdir)/zfs pkgsysconf_DATA = \ - vdev_id.conf.alias.example \ - vdev_id.conf.sas_direct.example \ - vdev_id.conf.sas_switch.example \ - vdev_id.conf.multipath.example + $(top_srcdir)/etc/zfs/vdev_id.conf.alias.example \ + $(top_srcdir)/etc/zfs/vdev_id.conf.sas_direct.example \ + $(top_srcdir)/etc/zfs/vdev_id.conf.sas_switch.example \ + $(top_srcdir)/etc/zfs/vdev_id.conf.multipath.example EXTRA_DIST = $(pkgsysconf_DATA) diff --git a/lib/libspl/asm-generic/Makefile.am b/lib/libspl/asm-generic/Makefile.am index 17fe501fa183..12e3d3dc5dfe 100644 --- a/lib/libspl/asm-generic/Makefile.am +++ b/lib/libspl/asm-generic/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/config/Rules.am DEFAULT_INCLUDES += \ - -I$(top_srcdir)/lib/libspl/include + -I$(top_srcdir)/lib/libspl/include atomic_SOURCE = atomic.c atomic_ASM = atomic.S diff --git a/lib/libspl/asm-x86_64/Makefile.am b/lib/libspl/asm-x86_64/Makefile.am index 339c18d7ccb0..3ef1b8f20978 100644 --- a/lib/libspl/asm-x86_64/Makefile.am +++ b/lib/libspl/asm-x86_64/Makefile.am @@ -1 +1,2 @@ -noinst_HEADERS = $(top_srcdir)/lib/libspl/asm-x86_64/*.S +noinst_HEADERS = \ + $(top_srcdir)/lib/libspl/asm-x86_64/*.S diff --git a/lib/libspl/include/ia32/sys/Makefile.am b/lib/libspl/include/ia32/sys/Makefile.am index c8136ee2ad42..cd08ca612d60 100644 --- a/lib/libspl/include/ia32/sys/Makefile.am +++ b/lib/libspl/include/ia32/sys/Makefile.am @@ -1,3 +1,3 @@ libspldir = $(includedir)/libspl/ia32/sys libspl_HEADERS = \ - $(top_srcdir)/lib/libspl/include/ia32/sys/asm_linkage.h + $(top_srcdir)/lib/libspl/include/ia32/sys/asm_linkage.h diff --git a/man/man1/Makefile.am b/man/man1/Makefile.am index 113cd0d80e44..5394c1a0e4bb 100644 --- a/man/man1/Makefile.am +++ b/man/man1/Makefile.am @@ -1,5 +1,10 @@ -dist_man_MANS = zhack.1 zpios.1 ztest.1 -EXTRA_DIST = cstyle.1 +dist_man_MANS = \ + $(top_srcdir)/man/man1/zhack.1 \ + $(top_srcdir)/man/man1/zpios.1 \ + $(top_srcdir)/man/man1/ztest.1 + +EXTRA_DIST = \ + $(top_srcdir)/man/man1/cstyle.1 install-data-local: $(INSTALL) -d -m 0755 "$(DESTDIR)$(mandir)/man1" diff --git a/man/man5/Makefile.am b/man/man5/Makefile.am index 4746914c593c..c9f7698ff8d1 100644 --- a/man/man5/Makefile.am +++ b/man/man5/Makefile.am @@ -1,4 +1,8 @@ -dist_man_MANS = vdev_id.conf.5 zpool-features.5 zfs-module-parameters.5 zfs-events.5 +dist_man_MANS = \ + $(top_srcdir)/man/man5/vdev_id.conf.5 \ + $(top_srcdir)/man/man5/zpool-features.5 \ + $(top_srcdir)/man/man5/zfs-module-parameters.5 \ + $(top_srcdir)/man/man5/zfs-events.5 install-data-local: $(INSTALL) -d -m 0755 "$(DESTDIR)$(mandir)/man5" diff --git a/man/man8/Makefile.am b/man/man8/Makefile.am index b89e34dfd4fe..b89e67a7b017 100644 --- a/man/man8/Makefile.am +++ b/man/man8/Makefile.am @@ -1,18 +1,18 @@ dist_man_MANS = \ - fsck.zfs.8 \ - mount.zfs.8 \ - vdev_id.8 \ - zdb.8 \ - zfs.8 \ - zinject.8 \ - zpool.8 \ - zstreamdump.8 + $(top_srcdir)/man/man8/fsck.zfs.8 \ + $(top_srcdir)/man/man8/mount.zfs.8 \ + $(top_srcdir)/man/man8/vdev_id.8 \ + $(top_srcdir)/man/man8/zdb.8 \ + $(top_srcdir)/man/man8/zfs.8 \ + $(top_srcdir)/man/man8/zinject.8 \ + $(top_srcdir)/man/man8/zpool.8 \ + $(top_srcdir)/man/man8/zstreamdump.8 nodist_man_MANS = \ zed.8 EXTRA_DIST = \ - zed.8.in + $(top_srcdir)/man/man8/zed.8.in zed.8: $(srcdir)/zed.8.in diff --git a/module/avl/Makefile.in b/module/avl/Makefile.in index 27f9e4af4993..98c011e8aa81 100644 --- a/module/avl/Makefile.in +++ b/module/avl/Makefile.in @@ -1,7 +1,10 @@ +src = @abs_top_srcdir@/module/avl +obj = @abs_builddir@ + MODULE := zavl EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ obj-$(CONFIG_ZFS) := $(MODULE).o -$(MODULE)-objs += @top_srcdir@/module/avl/avl.o +$(MODULE)-objs += avl.o diff --git a/module/nvpair/Makefile.in b/module/nvpair/Makefile.in index 211fc726dfab..a8144452a4b3 100644 --- a/module/nvpair/Makefile.in +++ b/module/nvpair/Makefile.in @@ -1,10 +1,13 @@ +src = @abs_top_srcdir@/module/nvpair +obj = @abs_builddir@ + MODULE := znvpair EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ obj-$(CONFIG_ZFS) := $(MODULE).o -$(MODULE)-objs += @top_srcdir@/module/nvpair/nvpair.o -$(MODULE)-objs += @top_srcdir@/module/nvpair/fnvpair.o -$(MODULE)-objs += @top_srcdir@/module/nvpair/nvpair_alloc_spl.o -$(MODULE)-objs += @top_srcdir@/module/nvpair/nvpair_alloc_fixed.o +$(MODULE)-objs += nvpair.o +$(MODULE)-objs += fnvpair.o +$(MODULE)-objs += nvpair_alloc_spl.o +$(MODULE)-objs += nvpair_alloc_fixed.o diff --git a/module/unicode/Makefile.in b/module/unicode/Makefile.in index 226e23baa8d8..b26e669274be 100644 --- a/module/unicode/Makefile.in +++ b/module/unicode/Makefile.in @@ -1,8 +1,11 @@ +src = @abs_top_srcdir@/module/unicode +obj = @abs_builddir@ + MODULE := zunicode EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ obj-$(CONFIG_ZFS) := $(MODULE).o -$(MODULE)-objs += @top_srcdir@/module/unicode/u8_textprep.o -$(MODULE)-objs += @top_srcdir@/module/unicode/uconv.o +$(MODULE)-objs += u8_textprep.o +$(MODULE)-objs += uconv.o diff --git a/module/zcommon/Makefile.in b/module/zcommon/Makefile.in index d4f5ba7ec70e..67e474ee089d 100644 --- a/module/zcommon/Makefile.in +++ b/module/zcommon/Makefile.in @@ -1,14 +1,17 @@ +src = @abs_top_srcdir@/module/zcommon +obj = @abs_builddir@ + MODULE := zcommon EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ obj-$(CONFIG_ZFS) := $(MODULE).o -$(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_deleg.o -$(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_prop.o -$(MODULE)-objs += @top_srcdir@/module/zcommon/zprop_common.o -$(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_namecheck.o -$(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_comutil.o -$(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_fletcher.o -$(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_uio.o -$(MODULE)-objs += @top_srcdir@/module/zcommon/zpool_prop.o +$(MODULE)-objs += zfs_deleg.o +$(MODULE)-objs += zfs_prop.o +$(MODULE)-objs += zprop_common.o +$(MODULE)-objs += zfs_namecheck.o +$(MODULE)-objs += zfs_comutil.o +$(MODULE)-objs += zfs_fletcher.o +$(MODULE)-objs += zfs_uio.o +$(MODULE)-objs += zpool_prop.o diff --git a/module/zfs/Makefile.in b/module/zfs/Makefile.in index 48e7e97e9814..09ef22c9a8db 100644 --- a/module/zfs/Makefile.in +++ b/module/zfs/Makefile.in @@ -1,3 +1,6 @@ +src = @abs_top_srcdir@/module/zfs +obj = @abs_builddir@ + MODULE := zfs EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ diff --git a/module/zpios/Makefile.in b/module/zpios/Makefile.in index 437bf2287637..10a101da4dc0 100644 --- a/module/zpios/Makefile.in +++ b/module/zpios/Makefile.in @@ -1,7 +1,10 @@ +src = @abs_top_srcdir@/module/zpios +obj = @abs_builddir@ + MODULE := zpios EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ obj-$(CONFIG_ZFS) := $(MODULE).o -$(MODULE)-objs += @top_srcdir@/module/zpios/pios.o +$(MODULE)-objs += pios.o diff --git a/udev/rules.d/Makefile.am b/udev/rules.d/Makefile.am index 6816addb4cc6..d560bf30e053 100644 --- a/udev/rules.d/Makefile.am +++ b/udev/rules.d/Makefile.am @@ -1,7 +1,7 @@ udevrule_DATA = \ - $(top_srcdir)/udev/rules.d/69-vdev.rules \ - $(top_srcdir)/udev/rules.d/60-zvol.rules \ - $(top_srcdir)/udev/rules.d/90-zfs.rules + 69-vdev.rules \ + 60-zvol.rules \ + 90-zfs.rules EXTRA_DIST = \ $(top_srcdir)/udev/rules.d/69-vdev.rules.in \ @@ -14,7 +14,7 @@ $(udevrule_DATA): -e 's,@udevdir\@,$(udevdir),g' \ -e 's,@udevruledir\@,$(udevruledir),g' \ -e 's,@sysconfdir\@,$(sysconfdir),g' \ - '$@.in' >'$@' + "$(abs_top_srcdir)/udev/rules.d/$@.in" > '$@' distclean-local:: -$(RM) $(udevrule_DATA)