From 37d7cd94f326896ffbd3f7609a20562c000cd4c8 Mon Sep 17 00:00:00 2001 From: Turbo Fredriksson Date: Wed, 11 Jun 2014 03:57:48 +0200 Subject: Support parallel build trees (VPATH builds) Build products from an out of tree build should be written relative to the build directory. Sources should be referred to by their locations in the source directory. This is accomplished by adding the 'src' and 'obj' variables for the module Makefile.am, using relative paths to reference source files, and by setting VPATH when source files are not co-located with the Makefile. This enables the following: $ mkdir build $ cd build $ ../configure $ make -s This change also has the advantage of resolving the following warning which is generated by modern versions of automake. Makefile.am:00: warning: source file 'xxx' is in a subdirectory, Makefile.am:00: but option 'subdir-objects' is disabled Signed-off-by: Turbo Fredriksson Signed-off-by: Brian Behlendorf Issue zfsonlinux/zfs#1082 --- Makefile.am | 10 +++++----- config/rpm.am | 2 +- include/util/Makefile.am | 2 +- module/spl/Makefile.in | 41 ++++++++++++++++++++++------------------- module/splat/Makefile.in | 37 ++++++++++++++++++++----------------- scripts/Makefile.am | 2 +- 6 files changed, 50 insertions(+), 44 deletions(-) diff --git a/Makefile.am b/Makefile.am index 89af931ae..4977448fd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,9 +1,9 @@ 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 @@ -40,11 +40,11 @@ dist-hook: $(distdir)/META 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/config/rpm.am b/config/rpm.am index 311c754d4..51a20b3e6 100644 --- a/config/rpm.am +++ b/config/rpm.am @@ -51,7 +51,7 @@ rpm-local: mkdir -p $(rpmbuild)/SPECS && \ cp ${RPM_SPEC_DIR}/$(rpmspec) $(rpmbuild)/SPECS && \ mkdir -p $(rpmbuild)/SOURCES && \ - cp scripts/kmodtool $(rpmbuild)/SOURCES && \ + cp $(top_srcdir)/scripts/kmodtool $(rpmbuild)/SOURCES && \ cp $(distdir).tar.gz $(rpmbuild)/SOURCES) srpm-common: dist diff --git a/include/util/Makefile.am b/include/util/Makefile.am index b721b5099..e2bf09fb1 100644 --- a/include/util/Makefile.am +++ b/include/util/Makefile.am @@ -2,7 +2,7 @@ COMMON_H = KERNEL_H = \ $(top_srcdir)/include/util/qsort.h \ - $(top_srcdir)/include/util/sscanf.h + $(top_srcdir)/include/util/sscanf.h USER_H = diff --git a/module/spl/Makefile.in b/module/spl/Makefile.in index d1742448d..a1f1ab823 100644 --- a/module/spl/Makefile.in +++ b/module/spl/Makefile.in @@ -1,27 +1,30 @@ # Makefile.in for spl kernel module +src = @abs_top_srcdir@/module/spl +obj = @abs_builddir@ + MODULE := spl EXTRA_CFLAGS = $(SPL_MODULE_CFLAGS) @KERNELCPPFLAGS@ # Solaris porting layer module obj-$(CONFIG_SPL) := $(MODULE).o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-proc.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-kmem.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-kmem-cache.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-vmem.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-thread.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-taskq.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-rwlock.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-vnode.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-err.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-kobj.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-generic.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-atomic.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-mutex.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-kstat.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-condvar.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-xdr.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-cred.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-tsd.o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-zlib.o +$(MODULE)-objs += spl-proc.o +$(MODULE)-objs += spl-kmem.o +$(MODULE)-objs += spl-kmem-cache.o +$(MODULE)-objs += spl-vmem.o +$(MODULE)-objs += spl-thread.o +$(MODULE)-objs += spl-taskq.o +$(MODULE)-objs += spl-rwlock.o +$(MODULE)-objs += spl-vnode.o +$(MODULE)-objs += spl-err.o +$(MODULE)-objs += spl-kobj.o +$(MODULE)-objs += spl-generic.o +$(MODULE)-objs += spl-atomic.o +$(MODULE)-objs += spl-mutex.o +$(MODULE)-objs += spl-kstat.o +$(MODULE)-objs += spl-condvar.o +$(MODULE)-objs += spl-xdr.o +$(MODULE)-objs += spl-cred.o +$(MODULE)-objs += spl-tsd.o +$(MODULE)-objs += spl-zlib.o diff --git a/module/splat/Makefile.in b/module/splat/Makefile.in index f4065196b..680f28492 100644 --- a/module/splat/Makefile.in +++ b/module/splat/Makefile.in @@ -1,25 +1,28 @@ # Makefile.in for splat kernel module +src = @abs_top_srcdir@/module/splat +obj = @abs_builddir@ + MODULE := splat EXTRA_CFLAGS = $(SPL_MODULE_CFLAGS) @KERNELCPPFLAGS@ # Solaris Porting LAyer Tests obj-$(CONFIG_SPL) := $(MODULE).o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-ctl.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-kmem.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-taskq.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-random.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-mutex.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-condvar.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-thread.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-rwlock.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-time.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-vnode.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-kobj.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-atomic.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-list.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-generic.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-cred.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-zlib.o -$(MODULE)-objs += @top_srcdir@/module/splat/splat-linux.o +$(MODULE)-objs += splat-ctl.o +$(MODULE)-objs += splat-kmem.o +$(MODULE)-objs += splat-taskq.o +$(MODULE)-objs += splat-random.o +$(MODULE)-objs += splat-mutex.o +$(MODULE)-objs += splat-condvar.o +$(MODULE)-objs += splat-thread.o +$(MODULE)-objs += splat-rwlock.o +$(MODULE)-objs += splat-time.o +$(MODULE)-objs += splat-vnode.o +$(MODULE)-objs += splat-kobj.o +$(MODULE)-objs += splat-atomic.o +$(MODULE)-objs += splat-list.o +$(MODULE)-objs += splat-generic.o +$(MODULE)-objs += splat-cred.o +$(MODULE)-objs += splat-zlib.o +$(MODULE)-objs += splat-linux.o diff --git a/scripts/Makefile.am b/scripts/Makefile.am index f146ec6e6..a718c4b1a 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,4 +1,4 @@ EXTRA_DIST = check.sh dkms.mkconf dkms.postbuild kmodtool check: - $(top_srcdir)/scripts/check.sh + scripts/check.sh -- cgit v1.2.3