xref: /freebsd/sys/contrib/openzfs/scripts/Makefile.am (revision 62ff619dcc3540659a319be71c9a489f1659e14a)
1scriptsdir = $(datadir)/$(PACKAGE)
2dist_scripts_SCRIPTS = \
3	%D%/zfs-helpers.sh \
4	%D%/zfs-tests.sh \
5	%D%/zfs.sh \
6	%D%/zimport.sh \
7	%D%/zloop.sh
8
9EXTRA_SCRIPTS = \
10	%D%/commitcheck.sh \
11	%D%/common.sh.in \
12	%D%/dkms.mkconf \
13	%D%/dkms.postbuild \
14	%D%/kmodtool \
15	%D%/make_gitrev.sh \
16	%D%/man-dates.sh \
17	%D%/mancheck.sh \
18	%D%/paxcheck.sh \
19	%D%/zfs-tests-color.sh
20
21EXTRA_DIST += \
22	%D%/cstyle.pl \
23	%D%/enum-extract.pl \
24	%D%/zfs2zol-patch.sed \
25	%D%/zol2zfs-patch.sed \
26	$(EXTRA_SCRIPTS)
27
28SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) $(EXTRA_SCRIPTS)
29
30define SCRIPTS_EXTRA_ENVIRONMENT
31
32# Only required for in-tree use
33export INTREE="yes"
34export GDB="libtool --mode=execute gdb"
35export LDMOD=/sbin/insmod
36
37export CMD_DIR=$(abs_top_builddir)
38export UDEV_SCRIPT_DIR=$(abs_top_srcdir)/udev
39export UDEV_CMD_DIR=$(abs_top_builddir)/udev
40export UDEV_RULE_DIR=$(abs_top_builddir)/udev/rules.d
41export ZEDLET_ETC_DIR=$$CMD_DIR/cmd/zed/zed.d
42export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/cmd/zed/zed.d
43export ZPOOL_SCRIPT_DIR=$$CMD_DIR/cmd/zpool/zpool.d
44export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/cmd/zpool/zpool.d
45export ZPOOL_COMPAT_DIR=$$CMD_DIR/cmd/zpool/compatibility.d
46export CONTRIB_DIR=$(abs_top_builddir)/contrib
47export LIB_DIR=$(abs_top_builddir)/.libs
48export SYSCONF_DIR=$(abs_top_builddir)/etc
49
50export INSTALL_UDEV_DIR=$(udevdir)
51export INSTALL_UDEV_RULE_DIR=$(udevruledir)
52export INSTALL_MOUNT_HELPER_DIR=$(mounthelperdir)
53export INSTALL_SYSCONF_DIR=$(sysconfdir)
54export INSTALL_PYTHON_DIR=$(pythonsitedir)
55
56export KMOD_SPL=$(abs_top_builddir)/module/spl.ko
57export KMOD_ZFS=$(abs_top_builddir)/module/zfs.ko
58export KMOD_FREEBSD=$(abs_top_builddir)/module/openzfs.ko
59endef
60
61export SCRIPTS_EXTRA_ENVIRONMENT
62
63CLEANFILES += %D%/common.sh
64%D%/common.sh: %D%/common.sh.in Makefile
65	-$(AM_V_at)$(MKDIR_P) $(@D)
66	-$(AM_V_GEN)$(SED) -e '/^export BIN_DIR=/s|$$|$(abs_top_builddir)/tests/zfs-tests/bin|' \
67		-e '/^export SBIN_DIR=/s|$$|$(abs_top_builddir)|' \
68		-e '/^export LIBEXEC_DIR=/s|$$|$(abs_top_builddir)|' \
69		-e '/^export ZTS_DIR=/s|$$|$(abs_top_srcdir)/tests|' \
70		-e '/^export SCRIPT_DIR=/s|$$|$(abs_top_srcdir)/scripts|' \
71		$< >$@
72	-$(AM_V_at)echo "$$SCRIPTS_EXTRA_ENVIRONMENT" >>$@
73
74ALL_LOCAL += scripts-all-local
75scripts-all-local: %D%/common.sh
76	-SCRIPT_COMMON=$< $(srcdir)/%D%/zfs-tests.sh -c
77
78CLEAN_LOCAL += scripts-clean-local
79scripts-clean-local:
80	-$(RM) -r tests/zfs-tests/bin/
81
82INSTALL_DATA_HOOKS += scripts-install-data-hook
83scripts-install-data-hook: %D%/common.sh.in Makefile
84	-$(SED) -e '/^export BIN_DIR=/s|$$|$(bindir)|' \
85		-e '/^export SBIN_DIR=/s|$$|$(sbindir)|' \
86		-e '/^export LIBEXEC_DIR=/s|$$|$(zfsexecdir)|' \
87		-e '/^export ZTS_DIR=/s|$$|$(datadir)/$(PACKAGE)|' \
88		-e '/^export SCRIPT_DIR=/s|$$|$(datadir)/$(PACKAGE)|' \
89		$< >$(DESTDIR)$(datadir)/$(PACKAGE)/common.sh
90