Skip to content

Commit

Permalink
2378: turbo/issue-1082 - Support parallel build trees (VPATH builds)
Browse files Browse the repository at this point in the history
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: openzfs#1082

For VPATH builds (addition for openzfs#1082):
* Add '../../spl' to spl source directory list to search
* Do a find in the found spl source for spl_config.h
  • Loading branch information
FransUrbo committed Nov 5, 2014
1 parent 1016d3b commit 055bdbe
Show file tree
Hide file tree
Showing 23 changed files with 98 additions and 73 deletions.
11 changes: 5 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/arcstat/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bin_SCRIPTS = arcstat.py
bin_SCRIPTS = $(top_srcdir)/cmd/arcstat/arcstat.py
EXTRA_DIST = $(bin_SCRIPTS)
2 changes: 1 addition & 1 deletion cmd/dbufstat/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bin_SCRIPTS = dbufstat.py
bin_SCRIPTS = $(top_srcdir)/cmd/dbufstat/dbufstat.py
EXTRA_DIST = $(bin_SCRIPTS)
2 changes: 1 addition & 1 deletion cmd/fsck_zfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dist_sbin_SCRIPTS = fsck.zfs
dist_sbin_SCRIPTS = $(top_srcdir)/cmd/fsck_zfs/fsck.zfs
2 changes: 1 addition & 1 deletion cmd/vdev_id/Makefile.am
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dist_udev_SCRIPTS = vdev_id
dist_udev_SCRIPTS = $(top_srcdir)/cmd/vdev_id/vdev_id
19 changes: 9 additions & 10 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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}"], [
Expand All @@ -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]"
])
Expand Down Expand Up @@ -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]"
])
Expand Down
9 changes: 4 additions & 5 deletions dracut/90zfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -17,7 +16,7 @@ $(pkgdracut_SCRIPTS):
-e 's,@udevdir\@,$(udevdir),g' \
-e 's,@udevruledir\@,$(udevruledir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
'[email protected]' >'$@'
"$(abs_top_srcdir)/dracut/90zfs/$@.in' >'$@'

distclean-local::
-$(RM) $(pkgdracut_SCRIPTS)
4 changes: 2 additions & 2 deletions etc/modules-load.d/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
modulesload_DATA = \
$(top_srcdir)/etc/modules-load.d/zfs.conf
zfs.conf

EXTRA_DIST = \
$(top_srcdir)/etc/modules-load.d/zfs.conf.in

$(modulesload_DATA):
-$(SED) \
-e '' \
'$@.in' >'$@'
"$(top_srcdir)/etc/modules-load.d/$@.in" >'$@'

distclean-local::
-$(RM) $(modulesload_DATA)
14 changes: 7 additions & 7 deletions etc/systemd/system/Makefile.am
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
8 changes: 4 additions & 4 deletions etc/zfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion lib/libspl/asm-generic/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion lib/libspl/asm-x86_64/Makefile.am
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
noinst_HEADERS = $(top_srcdir)/lib/libspl/asm-x86_64/*.S
noinst_HEADERS = \
$(top_srcdir)/lib/libspl/asm-x86_64/*.S
2 changes: 1 addition & 1 deletion lib/libspl/include/ia32/sys/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
9 changes: 7 additions & 2 deletions man/man1/Makefile.am
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 5 additions & 1 deletion man/man5/Makefile.am
Original file line number Diff line number Diff line change
@@ -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"
18 changes: 9 additions & 9 deletions man/man8/Makefile.am
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 4 additions & 1 deletion module/avl/Makefile.in
Original file line number Diff line number Diff line change
@@ -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
11 changes: 7 additions & 4 deletions module/nvpair/Makefile.in
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions module/unicode/Makefile.in
Original file line number Diff line number Diff line change
@@ -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
19 changes: 11 additions & 8 deletions module/zcommon/Makefile.in
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions module/zfs/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
src = @abs_top_srcdir@/module/zfs
obj = @abs_builddir@

MODULE := zfs

EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@
Expand Down
5 changes: 4 additions & 1 deletion module/zpios/Makefile.in
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions udev/rules.d/Makefile.am
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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)

0 comments on commit 055bdbe

Please sign in to comment.