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