autoconf: use include directives instead of recursing down etc

dist diff:
  -zfs-2.1.99/etc/systemd/system/50-zfs.preset.in
  +zfs-2.1.99/etc/systemd/system/50-zfs.preset

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316
This commit is contained in:
наб 2022-04-10 01:19:15 +02:00 committed by Brian Behlendorf
parent 50d2c9e4fd
commit 48f4379974
20 changed files with 113 additions and 127 deletions

View File

@ -4,9 +4,9 @@ INSTALL_DATA_HOOKS =
ALL_LOCAL =
CHECKS = shellcheck checkbashisms
include $(top_srcdir)/config/Shellcheck.am
include $(top_srcdir)/config/Rules.am
include $(top_srcdir)/config/CppCheck.am
include $(top_srcdir)/config/Shellcheck.am
include $(top_srcdir)/config/Substfiles.am
ACLOCAL_AMFLAGS = -I config
@ -16,11 +16,11 @@ if BUILD_LINUX
include $(srcdir)/%D%/rpm/Makefile.am
endif
CPPCHECKDIRS += etc/systemd/system-generators
if CONFIG_USER
SUBDIRS += . tests etc
SUBDIRS += . tests
include $(srcdir)/%D%/cmd/Makefile.am
include $(srcdir)/%D%/contrib/Makefile.am
include $(srcdir)/%D%/etc/Makefile.am
include $(srcdir)/%D%/lib/Makefile.am
include $(srcdir)/%D%/man/Makefile.am
include $(srcdir)/%D%/scripts/Makefile.am
@ -98,7 +98,7 @@ dist-hook:
PHONY += codecheck $(CHECKS)
codecheck: $(CHECKS)
SHELLCHECKDIRS = etc tests
SHELLCHECKDIRS = tests
SHELLCHECKSCRIPTS += autogen.sh
PHONY += checkstyle

View File

@ -13,9 +13,9 @@ CPPCHECKTARGETS =
cppcheck-recursive-%:
$(MAKE) -C $(subst ^,/,$(subst cppcheck-recursive-,,$@)) cppcheck
_CTGT = $(subst -,_,$(subst .,_,$(subst cppcheck-for-,,$@)))
_CTGT = $(subst cppcheck-for-,,$@)
cppcheck-for-%:
@[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)$(nodist_$(_CTGT)_SOURCES)" ]
$(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES) $(nodist_$(_CTGT)_SOURCES)
cppcheck: $(addprefix cppcheck-for-,$(CPPCHECKTARGETS)) $(addprefix cppcheck-recursive-,$(subst /,^,$(CPPCHECKDIRS)))
cppcheck: $(addprefix cppcheck-for-,$(subst -,_,$(subst .,_,$(subst /,_,$(CPPCHECKTARGETS))))) $(addprefix cppcheck-recursive-,$(CPPCHECKDIRS))

View File

@ -12,7 +12,7 @@ JUST_SHELLCHECK_OPTS = $(addprefix shellcheck-here-,$(subst /,^,$(1)))
JUST_CHECKBASHISMS_OPTS = $(addprefix checkbashisms-here-,$(subst /,^,$(1)))
SHELLCHECK_OPTS = $(call JUST_SHELLCHECK_OPTS,$(1)) $(call JUST_CHECKBASHISMS_OPTS,$(1))
.PHONY: shellcheck shellcheck-recursive
PHONY += shellcheck shellcheck-recursive
shellcheck-recursive:
@set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir shellcheck; done
@ -28,7 +28,7 @@ endif
shellcheck: $(SHELLCHECKSCRIPTS) $(call JUST_SHELLCHECK_OPTS,$(SHELLCHECKSCRIPTS)) shellcheck-recursive
.PHONY: checkbashisms checkbashisms-recursive
PHONY += checkbashisms checkbashisms-recursive
checkbashisms-recursive:
@set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done

View File

@ -35,16 +35,15 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
AC_MSG_RESULT([$enable_systemd])
AS_IF([test "x$enable_systemd" = xyes], [
ZFS_INIT_SYSTEMD=systemd
ZFS_MODULE_LOAD=modules-load.d
DEFINE_SYSTEMD='--with systemd --define "_unitdir $(systemdunitdir)" --define "_presetdir $(systemdpresetdir)" --define "_generatordir $(systemdgeneratordir)"'
modulesloaddir=$systemdmodulesloaddir
],[
DEFINE_SYSTEMD='--without systemd'
])
AC_SUBST(ZFS_INIT_SYSTEMD)
AC_SUBST(ZFS_MODULE_LOAD)
ZFS_INIT_SYSTEMD=$enable_systemd
ZFS_WANT_MODULES_LOAD_D=$enable_systemd
AC_SUBST(DEFINE_SYSTEMD)
AC_SUBST(systemdunitdir)
AC_SUBST(systemdpresetdir)

View File

@ -2,10 +2,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSVINIT], [
AC_ARG_ENABLE(sysvinit,
AS_HELP_STRING([--enable-sysvinit],
[install SysV init scripts [default: yes]]),
[],enable_sysvinit=yes)
[], enable_sysvinit=yes)
AS_IF([test "x$enable_sysvinit" = xyes],
[ZFS_INIT_SYSV=init.d])
AC_SUBST(ZFS_INIT_SYSV)
ZFS_INIT_SYSV=$enable_sysvinit
])

View File

@ -259,6 +259,10 @@ AC_DEFUN([ZFS_AC_CONFIG], [
AC_SUBST(TEST_JOBS)
])
ZFS_INIT_SYSV=
ZFS_INIT_SYSTEMD=
ZFS_WANT_MODULES_LOAD_D=
case "$ZFS_CONFIG" in
kernel) ZFS_AC_CONFIG_KERNEL ;;
user) ZFS_AC_CONFIG_USER ;;
@ -271,6 +275,10 @@ AC_DEFUN([ZFS_AC_CONFIG], [
user kernel|user|all|srpm]) ;;
esac
AM_CONDITIONAL([INIT_SYSV], [test "x$ZFS_INIT_SYSV" = "xyes"])
AM_CONDITIONAL([INIT_SYSTEMD], [test "x$ZFS_INIT_SYSTEMD" = "xyes"])
AM_CONDITIONAL([WANT_MODULES_LOAD_D], [test "x$ZFS_WANT_MODULES_LOAD_D" = "xyes"])
AM_CONDITIONAL([CONFIG_USER],
[test "$ZFS_CONFIG" = user -o "$ZFS_CONFIG" = all])
AM_CONDITIONAL([CONFIG_KERNEL],

View File

@ -66,15 +66,6 @@ ZFS_AC_DEBUG_INVARIANTS
AC_CONFIG_FILES([
Makefile
etc/Makefile
etc/default/Makefile
etc/init.d/Makefile
etc/modules-load.d/Makefile
etc/sudoers.d/Makefile
etc/systemd/Makefile
etc/systemd/system-generators/Makefile
etc/systemd/system/Makefile
etc/zfs/Makefile
include/Makefile
lib/libzfs/libzfs.pc
lib/libzfsbootenv/libzfsbootenv.pc

View File

@ -1,9 +1,95 @@
include $(top_srcdir)/config/Shellcheck.am
sudoersddir = $(sysconfdir)/sudoers.d
sudoersd_DATA = \
%D%/sudoers.d/zfs
EXTRA_DIST += $(sudoersd_DATA)
sysconf_zfsdir = $(sysconfdir)/zfs
dist_sysconf_zfs_DATA = \
%D%/zfs/vdev_id.conf.alias.example \
%D%/zfs/vdev_id.conf.multipath.example \
%D%/zfs/vdev_id.conf.sas_direct.example \
%D%/zfs/vdev_id.conf.sas_switch.example \
%D%/zfs/vdev_id.conf.scsi.example
sysconf_zfs_SCRIPTS = \
%D%/zfs/zfs-functions
SUBSTFILES += $(sysconf_zfs_SCRIPTS)
SHELLCHECKSCRIPTS += $(sysconf_zfs_SCRIPTS)
$(call SHELLCHECK_OPTS,$(sysconf_zfs_SCRIPTS)): SHELLCHECK_SHELL = sh
SUBDIRS = zfs sudoers.d
SHELLCHECKDIRS = default $(ZFS_INIT_SYSV) zfs
if BUILD_LINUX
SUBDIRS += default $(ZFS_INIT_SYSTEMD) $(ZFS_INIT_SYSV) $(ZFS_MODULE_LOAD)
initconf_SCRIPTS = \
%D%/default/zfs
SUBSTFILES += $(initconf_SCRIPTS)
SHELLCHECKSCRIPTS += $(initconf_SCRIPTS)
$(call SHELLCHECK_OPTS,$(initconf_SCRIPTS)): SHELLCHECK_SHELL = sh
if INIT_SYSV
EXTRA_DIST += $(addprefix %D%/,init.d/README.md)
init_SCRIPTS = \
%D%/init.d/zfs-import \
%D%/init.d/zfs-load-key \
%D%/init.d/zfs-mount \
%D%/init.d/zfs-share \
%D%/init.d/zfs-zed
SUBSTFILES += $(init_SCRIPTS)
SHELLCHECKSCRIPTS += $(init_SCRIPTS)
$(call SHELLCHECK_OPTS,$(init_SCRIPTS)): SHELLCHECK_SHELL = sh
endif
if INIT_SYSTEMD
dist_systemdpreset_DATA = \
%D%/systemd/system/50-zfs.preset
systemdunit_DATA = \
%D%/systemd/system/zfs-import-cache.service \
%D%/systemd/system/zfs-import-scan.service \
%D%/systemd/system/zfs-import.target \
%D%/systemd/system/zfs-mount.service \
%D%/systemd/system/zfs-scrub-monthly@.timer \
%D%/systemd/system/zfs-scrub-weekly@.timer \
%D%/systemd/system/zfs-scrub@.service \
%D%/systemd/system/zfs-share.service \
%D%/systemd/system/zfs-volume-wait.service \
%D%/systemd/system/zfs-volumes.target \
%D%/systemd/system/zfs-zed.service \
%D%/systemd/system/zfs.target
SUBSTFILES += $(systemdunit_DATA)
INSTALL_DATA_HOOKS += systemd-install-data-hook
systemd-install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(systemdunitdir)"
ln -sf /dev/null "$(DESTDIR)$(systemdunitdir)/zfs-import.service"
systemdgenerator_PROGRAMS = \
%D%/systemd/system-generators/zfs-mount-generator
%C%_systemd_system_generators_zfs_mount_generator_SOURCES = \
%D%/systemd/system-generators/zfs-mount-generator.c
%C%_systemd_system_generators_zfs_mount_generator_LDADD = \
libzfs.la
%C%_systemd_system_generators_zfs_mount_generator_LDFLAGS = -pthread
CPPCHECKTARGETS += $(systemdgenerator_PROGRAMS)
endif
if WANT_MODULES_LOAD_D
dist_modulesload_DATA = \
%D%/modules-load.d/zfs.conf
endif
endif
DIST_SUBDIRS = default init.d zfs systemd modules-load.d sudoers.d

View File

@ -1,11 +0,0 @@
CLEANFILES =
EXTRA_DIST =
include $(top_srcdir)/config/Substfiles.am
include $(top_srcdir)/config/Shellcheck.am
initconf_SCRIPTS = zfs
SUBSTFILES += $(initconf_SCRIPTS)
SHELLCHECK_SHELL = sh
SHELLCHECKSCRIPTS += $(initconf_SCRIPTS)

View File

@ -1,13 +0,0 @@
CLEANFILES =
EXTRA_DIST =
include $(top_srcdir)/config/Substfiles.am
include $(top_srcdir)/config/Shellcheck.am
EXTRA_DIST += README.md
init_SCRIPTS = zfs-import zfs-load-key zfs-mount zfs-share zfs-zed
SUBSTFILES += $(init_SCRIPTS)
SHELLCHECK_SHELL = sh
SHELLCHECKSCRIPTS += $(init_SCRIPTS)

View File

@ -1 +0,0 @@
*.conf

View File

@ -1,2 +0,0 @@
dist_modulesload_DATA = \
zfs.conf

View File

@ -1,5 +0,0 @@
sudoersddir = $(sysconfdir)/sudoers.d
sudoersd_DATA = zfs
EXTRA_DIST = \
zfs

View File

@ -1 +0,0 @@
SUBDIRS = system system-generators

View File

@ -1,15 +0,0 @@
include $(top_srcdir)/config/Rules.am
systemdgenerator_PROGRAMS = \
zfs-mount-generator
zfs_mount_generator_SOURCES = \
zfs-mount-generator.c
zfs_mount_generator_LDADD = \
$(abs_top_builddir)/libzfs.la
zfs_mount_generator_LDFLAGS = -pthread
include $(top_srcdir)/config/CppCheck.am
CPPCHECKTARGETS += zfs-mount-generator

View File

@ -1,4 +1,3 @@
*.service
*.target
*.preset
*.timer

View File

@ -1,26 +0,0 @@
CLEANFILES =
EXTRA_DIST =
include $(top_srcdir)/config/Substfiles.am
systemdpreset_DATA = \
50-zfs.preset
systemdunit_DATA = \
zfs-zed.service \
zfs-import-cache.service \
zfs-import-scan.service \
zfs-mount.service \
zfs-share.service \
zfs-volume-wait.service \
zfs-import.target \
zfs-volumes.target \
zfs.target \
zfs-scrub-monthly@.timer \
zfs-scrub-weekly@.timer \
zfs-scrub@.service
SUBSTFILES += $(systemdpreset_DATA) $(systemdunit_DATA)
install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(systemdunitdir)"
ln -sf /dev/null "$(DESTDIR)$(systemdunitdir)/zfs-import.service"

View File

@ -1,21 +0,0 @@
CLEANFILES =
EXTRA_DIST =
include $(top_srcdir)/config/Substfiles.am
include $(top_srcdir)/config/Shellcheck.am
pkgsysconfdir = $(sysconfdir)/zfs
dist_pkgsysconf_DATA = \
vdev_id.conf.alias.example \
vdev_id.conf.sas_direct.example \
vdev_id.conf.sas_switch.example \
vdev_id.conf.multipath.example \
vdev_id.conf.scsi.example
pkgsysconf_SCRIPTS = \
zfs-functions
SUBSTFILES += $(pkgsysconf_SCRIPTS)
SHELLCHECK_SHELL = sh
SHELLCHECKSCRIPTS += $(pkgsysconf_SCRIPTS)

View File

@ -1,3 +1,4 @@
PHONY =
include $(top_srcdir)/config/Shellcheck.am
SUBDIRS = runfiles test-runner zfs-tests