Skip to content

Commit

Permalink
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.

Signed-off-by: Turbo Fredriksson <[email protected]>
Closes #1082
  • Loading branch information
FransUrbo committed Jul 1, 2015
1 parent 804e050 commit 9cc101c
Show file tree
Hide file tree
Showing 18 changed files with 167 additions and 148 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 @@ -57,11 +56,11 @@ shellcheck:
fi

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
4 changes: 2 additions & 2 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

autoreconf -fiv
rm -Rf autom4te.cache
autoreconf -fiv $(dirname $0)/configure.ac
rm -Rf $(dirname $0)/autom4te.cache
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
2 changes: 2 additions & 0 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,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
12 changes: 6 additions & 6 deletions dracut/90zfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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 \
$(top_srcdir)/dracut/90zfs/zfs-lib.sh
export-zfs.sh \
module-setup.sh \
mount-zfs.sh \
parse-zfs.sh \
zfs-lib.sh

EXTRA_DIST = \
$(top_srcdir)/dracut/90zfs/export-zfs.sh.in \
Expand All @@ -19,7 +19,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)
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
4 changes: 2 additions & 2 deletions lib/libzfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include $(top_srcdir)/config/Rules.am

libzfs_pcdir = $(datarootdir)/pkgconfig
libzfs_pc_DATA = $(top_srcdir)/lib/libzfs/libzfs.pc $(top_srcdir)/lib/libzfs/libzfs_core.pc
EXTRA_DIST = $(top_srcdir)/lib/libzfs/libzfs.pc $(top_srcdir)/lib/libzfs/libzfs_core.pc
libzfs_pc_DATA = libzfs.pc libzfs_core.pc
EXTRA_DIST = libzfs.pc libzfs_core.pc

DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
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
Loading

0 comments on commit 9cc101c

Please sign in to comment.