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
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
PHONY += codecheck $(CHECKS)
codecheck: $(CHECKS)
-SHELLCHECKDIRS = etc tests
+SHELLCHECKDIRS = tests
SHELLCHECKSCRIPTS += autogen.sh
PHONY += checkstyle
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))
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
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
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)
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
])
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 ;;
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],
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
-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
+++ /dev/null
-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)
+++ /dev/null
-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)
+++ /dev/null
-dist_modulesload_DATA = \
- zfs.conf
+++ /dev/null
-sudoersddir = $(sysconfdir)/sudoers.d
-sudoersd_DATA = zfs
-
-EXTRA_DIST = \
- zfs
+++ /dev/null
-SUBDIRS = system system-generators
+++ /dev/null
-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
*.service
*.target
-*.preset
*.timer
--- /dev/null
+# ZFS is enabled by default
+enable zfs-import-cache.service
+disable zfs-import-scan.service
+enable zfs-import.target
+enable zfs-mount.service
+enable zfs-share.service
+enable zfs-zed.service
+enable zfs-volume-wait.service
+enable zfs.target
+++ /dev/null
-# ZFS is enabled by default
-enable zfs-import-cache.service
-disable zfs-import-scan.service
-enable zfs-import.target
-enable zfs-mount.service
-enable zfs-share.service
-enable zfs-zed.service
-enable zfs-volume-wait.service
-enable zfs.target
+++ /dev/null
-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"
+++ /dev/null
-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)
+PHONY =
include $(top_srcdir)/config/Shellcheck.am
SUBDIRS = runfiles test-runner zfs-tests