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