Fix out-of-tree build failures

Resolve the incorrect use of srcdir and builddir references for
various files in the build system.  These have crept in over time
and went unnoticed because when building in the top level directory
srcdir and builddir are identical.

With this change it's again possible to build in a subdirectory.

    $ mkdir obj
    $ cd obj
    $ ../configure
    $ make

Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Don Brady <don.brady@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #8921 
Closes #8943
This commit is contained in:
Brian Behlendorf 2019-06-24 09:32:47 -07:00 committed by GitHub
parent cc9625c47c
commit 8f12a4f8d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 88 additions and 72 deletions

View File

@ -52,7 +52,8 @@ distclean-local::
-type f -print | xargs $(RM)
all-local:
-${top_srcdir}/scripts/zfs-tests.sh -c
-[ -x ${top_builddir}/scripts/zfs-tests.sh ] && \
${top_builddir}/scripts/zfs-tests.sh -c
dist-hook: gitrev
cp ${top_srcdir}/include/zfs_gitrev.h $(distdir)/include; \

View File

@ -1,12 +1,11 @@
SUBDIRS = zed.d
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
EXTRA_DIST = zed.d/README \
zed.d/history_event-zfs-list-cacher.sh.in
sbin_PROGRAMS = zed
ZED_SRC = \
@ -47,55 +46,3 @@ zed_LDADD = \
zed_LDADD += -lrt
zed_LDFLAGS = -pthread
zedconfdir = $(sysconfdir)/zfs/zed.d
dist_zedconf_DATA = \
zed.d/zed-functions.sh \
zed.d/zed.rc
zedexecdir = $(zfsexecdir)/zed.d
dist_zedexec_SCRIPTS = \
zed.d/all-debug.sh \
zed.d/all-syslog.sh \
zed.d/data-notify.sh \
zed.d/generic-notify.sh \
zed.d/resilver_finish-notify.sh \
zed.d/scrub_finish-notify.sh \
zed.d/statechange-led.sh \
zed.d/statechange-notify.sh \
zed.d/vdev_clear-led.sh \
zed.d/vdev_attach-led.sh \
zed.d/pool_import-led.sh \
zed.d/resilver_finish-start-scrub.sh
nodist_zedexec_SCRIPTS = zed.d/history_event-zfs-list-cacher.sh
$(nodist_zedexec_SCRIPTS): %: %.in
-$(SED) -e 's,@bindir\@,$(bindir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
$< >'$@'
zedconfdefaults = \
all-syslog.sh \
data-notify.sh \
resilver_finish-notify.sh \
scrub_finish-notify.sh \
statechange-led.sh \
statechange-notify.sh \
vdev_clear-led.sh \
vdev_attach-led.sh \
pool_import-led.sh \
resilver_finish-start-scrub.sh
install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(zedconfdir)"
for f in $(zedconfdefaults); do \
test -f "$(DESTDIR)$(zedconfdir)/$${f}" -o \
-L "$(DESTDIR)$(zedconfdir)/$${f}" || \
ln -s "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \
done
chmod 0600 "$(DESTDIR)$(zedconfdir)/zed.rc"

57
cmd/zed/zed.d/Makefile.am Normal file
View File

@ -0,0 +1,57 @@
include $(top_srcdir)/config/Rules.am
EXTRA_DIST = \
README \
history_event-zfs-list-cacher.sh.in
zedconfdir = $(sysconfdir)/zfs/zed.d
dist_zedconf_DATA = \
zed-functions.sh \
zed.rc
zedexecdir = $(zfsexecdir)/zed.d
dist_zedexec_SCRIPTS = \
all-debug.sh \
all-syslog.sh \
data-notify.sh \
generic-notify.sh \
resilver_finish-notify.sh \
scrub_finish-notify.sh \
statechange-led.sh \
statechange-notify.sh \
vdev_clear-led.sh \
vdev_attach-led.sh \
pool_import-led.sh \
resilver_finish-start-scrub.sh
nodist_zedexec_SCRIPTS = history_event-zfs-list-cacher.sh
$(nodist_zedexec_SCRIPTS): %: %.in
-$(SED) -e 's,@bindir\@,$(bindir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
$< >'$@'
zedconfdefaults = \
all-syslog.sh \
data-notify.sh \
resilver_finish-notify.sh \
scrub_finish-notify.sh \
statechange-led.sh \
statechange-notify.sh \
vdev_clear-led.sh \
vdev_attach-led.sh \
pool_import-led.sh \
resilver_finish-start-scrub.sh
install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(zedconfdir)"
for f in $(zedconfdefaults); do \
test -f "$(DESTDIR)$(zedconfdir)/$${f}" -o \
-L "$(DESTDIR)$(zedconfdir)/$${f}" || \
ln -s "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \
done
chmod 0600 "$(DESTDIR)$(zedconfdir)/zed.rc"

View File

@ -120,6 +120,7 @@ AC_CONFIG_FILES([
cmd/dbufstat/Makefile
cmd/arc_summary/Makefile
cmd/zed/Makefile
cmd/zed/zed.d/Makefile
cmd/raidz_test/Makefile
cmd/zgenhostid/Makefile
contrib/Makefile

View File

@ -11,13 +11,18 @@ EXTRA_DIST = \
$(top_srcdir)/contrib/initramfs/README.initramfs.markdown
install-initrdSCRIPTS: $(EXTRA_DIST)
for d in conf.d conf-hooks.d hooks scripts scripts/local-top; do \
$(MKDIR_P) $(DESTDIR)$(initrddir)/$$d; \
cp $(top_srcdir)/contrib/initramfs/$$d/zfs \
$(DESTDIR)$(initrddir)/$$d/; \
for d in conf.d conf-hooks.d scripts/local-top; do \
$(MKDIR_P) $(DESTDIR)$(initrddir)/$$d; \
cp $(top_srcdir)/contrib/initramfs/$$d/zfs \
$(DESTDIR)$(initrddir)/$$d/; \
done
if [ -f etc/init.d/zfs ]; then \
$(MKDIR_P) $(DESTDIR)$(DEFAULT_INITCONF_DIR); \
cp $(top_srcdir)/etc/init.d/zfs \
$(DESTDIR)$(DEFAULT_INITCONF_DIR)/; \
for d in hooks scripts; do \
$(MKDIR_P) $(DESTDIR)$(initrddir)/$$d; \
cp $(top_builddir)/contrib/initramfs/$$d/zfs \
$(DESTDIR)$(initrddir)/$$d/; \
done
if [ -f $(top_builddir)/etc/init.d/zfs ]; then \
$(MKDIR_P) $(DESTDIR)$(DEFAULT_INITCONF_DIR); \
cp $(top_builddir)/etc/init.d/zfs \
$(DESTDIR)$(DEFAULT_INITCONF_DIR)/; \
fi

View File

@ -24,7 +24,7 @@ all-local:
# files are later created by manually loading the Python modules.
#
install-exec-local:
$(PYTHON) $(srcdir)/setup.py install \
$(PYTHON) $(builddir)/setup.py install \
--prefix $(prefix) \
--root $(DESTDIR)/ \
--install-lib $(pythonsitedir) \

View File

@ -66,8 +66,9 @@ modules_uninstall:
distdir:
list='$(subdir-m)'; for subdir in $$list; do \
(cd @top_srcdir@/module && find $$subdir -name '*.c' -o -name '*.h' -o -name '*.S' |\
xargs cp --parents -t $$distdir); \
(cd @top_srcdir@/module && find $$subdir \
-name '*.c' -o -name '*.h' -o -name '*.S' | \
xargs cp --parents -t @abs_top_builddir@/module/$$distdir); \
done
distclean maintainer-clean: clean

View File

@ -60,7 +60,7 @@ all-local:
-e '\|^export SBIN_DIR=|s|$$|@abs_top_builddir@/bin|' \
-e '\|^export ZTS_DIR=|s|$$|@abs_top_srcdir@/tests|' \
-e '\|^export SCRIPT_DIR=|s|$$|@abs_top_srcdir@/scripts|' \
common.sh.in >common.sh
$(abs_top_srcdir)/scripts/common.sh.in >common.sh
-echo "$$EXTRA_ENVIRONMENT" >>common.sh
clean-local:
@ -71,4 +71,5 @@ install-data-hook:
-e '\|^export SBIN_DIR=|s|$$|@sbindir@|' \
-e '\|^export ZTS_DIR=|s|$$|@datadir@/@PACKAGE@|' \
-e '\|^export SCRIPT_DIR=|s|$$|@datadir@/@PACKAGE@|' \
common.sh.in >$(DESTDIR)$(datadir)/@PACKAGE@/common.sh
$(abs_top_srcdir)/scripts/common.sh.in \
>$(DESTDIR)$(datadir)/@PACKAGE@/common.sh

View File

@ -1,2 +1,5 @@
pkgdatadir = $(datadir)/@PACKAGE@/runfiles
dist_pkgdata_DATA = *.run
dist_pkgdata_DATA = \
linux.run \
longevity.run \
perf-regression.run

View File

@ -1,7 +1,7 @@
include $(top_srcdir)/config/Rules.am
AM_CPPFLAGS += -I$(top_srcdir)/include
LDADD = $(top_srcdir)/lib/libicp/libicp.la
LDADD = $(top_builddir)/lib/libicp/libicp.la
AUTOMAKE_OPTIONS = subdir-objects

View File

@ -2,7 +2,7 @@ include $(top_srcdir)/config/Rules.am
AM_CPPFLAGS += -I$(top_srcdir)/include
AM_CPPFLAGS += -I$(top_srcdir)/lib/libspl/include
LDADD = $(top_srcdir)/lib/libzpool/libzpool.la
LDADD = $(top_builddir)/lib/libzpool/libzpool.la
AUTOMAKE_OPTIONS = subdir-objects