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 \
    --with-spl=$HOME/src/git/spl/ \
    --with-spl-obj=$HOME/src/git/spl/build
  $ 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 <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1082
This commit is contained in:
Turbo Fredriksson
2014-06-09 23:55:31 +02:00
committed by Brian Behlendorf
parent 2a53e2dacc
commit 47a4a6fd5f
42 changed files with 476 additions and 388 deletions
+30 -16
View File
@@ -1,5 +1,9 @@
include $(top_srcdir)/config/Rules.am
VPATH = \
$(top_srcdir)/lib/libspl \
$(top_srcdir)/lib/libspl/$(TARGET_ASM_DIR)
AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
SUBDIRS = include $(TARGET_ASM_DIR)
@@ -13,21 +17,31 @@ AM_CCASFLAGS = \
noinst_LTLIBRARIES = libspl.la
libspl_la_SOURCES = \
$(top_srcdir)/lib/libspl/getexecname.c \
$(top_srcdir)/lib/libspl/gethrtime.c \
$(top_srcdir)/lib/libspl/gethrestime.c \
$(top_srcdir)/lib/libspl/getmntany.c \
$(top_srcdir)/lib/libspl/list.c \
$(top_srcdir)/lib/libspl/mkdirp.c \
$(top_srcdir)/lib/libspl/strlcat.c \
$(top_srcdir)/lib/libspl/strlcpy.c \
$(top_srcdir)/lib/libspl/strnlen.c \
$(top_srcdir)/lib/libspl/timestamp.c \
$(top_srcdir)/lib/libspl/zone.c \
$(top_srcdir)/lib/libspl/xdr.c \
$(top_srcdir)/lib/libspl/$(TARGET_ASM_DIR)/atomic.S \
$(top_srcdir)/lib/libspl/include/sys/list.h \
$(top_srcdir)/lib/libspl/include/sys/list_impl.h
USER_C = \
getexecname.c \
gethrtime.c \
gethrestime.c \
getmntany.c \
list.c \
mkdirp.c \
strlcat.c \
strlcpy.c \
strnlen.c \
timestamp.c \
zone.c \
xdr.c \
include/sys/list.h \
include/sys/list_impl.h
USER_ASM = atomic.S
KERNEL_C =
nodist_libspl_la_SOURCES = \
$(USER_C) \
$(USER_ASM) \
$(KERNEL_C)
libspl_la_LIBADD = -lrt
EXTRA_DIST = $(USER_C)
-6
View File
@@ -1,6 +0,0 @@
Stub file for 'make dist' distdir rule.
This file is directly referenced by ../Makefile.am as a source
file and thus will be expected by 'make dist'. To avoid this
being a problem this stub file was added. It will be overwritten
at build time based on assmebly generated from atomic.c.
+1 -1
View File
@@ -1 +1 @@
noinst_HEADERS = $(top_srcdir)/lib/libspl/asm-i386/*.S
noinst_HEADERS = atomic.S
+1 -1
View File
@@ -1 +1 @@
noinst_HEADERS = $(top_srcdir)/lib/libspl/asm-x86_64/*.S
noinst_HEADERS = atomic.S