xref: /freebsd/sys/contrib/openzfs/cmd/zpool/Makefile.am (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1zpool_CFLAGS  = $(AM_CFLAGS)
2zpool_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS)
3
4zpool_CPPFLAGS  = $(AM_CPPFLAGS)
5zpool_CPPFLAGS += -I$(srcdir)/%D%
6
7sbin_PROGRAMS   += zpool
8CPPCHECKTARGETS += zpool
9
10zpool_SOURCES = \
11	%D%/zpool_iter.c \
12	%D%/zpool_main.c \
13	%D%/zpool_util.c \
14	%D%/zpool_util.h \
15	%D%/zpool_vdev.c
16
17if BUILD_FREEBSD
18zpool_SOURCES += \
19	%D%/os/freebsd/zpool_vdev_os.c
20endif
21
22if BUILD_LINUX
23zpool_SOURCES += \
24	%D%/os/linux/zpool_vdev_os.c
25endif
26
27zpool_LDADD = \
28	libzfs.la \
29	libzfs_core.la \
30	libnvpair.la \
31	libuutil.la \
32	libzutil.la
33
34zpool_LDADD += $(LTLIBINTL)
35
36if BUILD_FREEBSD
37zpool_LDADD += -lgeom
38endif
39zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS)
40
41dist_noinst_DATA += %D%/zpool.d/README
42
43SHELLCHECKSCRIPTS += $(dist_zpoolexec_SCRIPTS)
44zpoolexecdir = $(zfsexecdir)/zpool.d
45dist_zpoolexec_SCRIPTS = \
46	%D%/zpool.d/ata_err \
47	%D%/zpool.d/cmd_to \
48	%D%/zpool.d/defect \
49	%D%/zpool.d/dm-deps \
50	%D%/zpool.d/enc \
51	%D%/zpool.d/encdev \
52	%D%/zpool.d/fault_led \
53	%D%/zpool.d/health \
54	%D%/zpool.d/hours_on \
55	%D%/zpool.d/iostat \
56	%D%/zpool.d/iostat-10s \
57	%D%/zpool.d/iostat-1s \
58	%D%/zpool.d/label \
59	%D%/zpool.d/locate_led \
60	%D%/zpool.d/lsblk \
61	%D%/zpool.d/media \
62	%D%/zpool.d/model \
63	%D%/zpool.d/nonmed \
64	%D%/zpool.d/nvme_err \
65	%D%/zpool.d/off_ucor \
66	%D%/zpool.d/pend_sec \
67	%D%/zpool.d/pwr_cyc \
68	%D%/zpool.d/r_proc \
69	%D%/zpool.d/r_ucor \
70	%D%/zpool.d/realloc \
71	%D%/zpool.d/rep_ucor \
72	%D%/zpool.d/serial \
73	%D%/zpool.d/ses \
74	%D%/zpool.d/size \
75	%D%/zpool.d/slot \
76	%D%/zpool.d/smart \
77	%D%/zpool.d/smart_test \
78	%D%/zpool.d/smartx \
79	%D%/zpool.d/temp \
80	%D%/zpool.d/test_ended \
81	%D%/zpool.d/test_progress \
82	%D%/zpool.d/test_status \
83	%D%/zpool.d/test_type \
84	%D%/zpool.d/upath \
85	%D%/zpool.d/vendor \
86	%D%/zpool.d/w_proc \
87	%D%/zpool.d/w_ucor
88
89zpoolconfdefaults = \
90	dm-deps \
91	enc \
92	encdev \
93	fault_led \
94	iostat \
95	iostat-1s \
96	iostat-10s \
97	label \
98	locate_led \
99	lsblk \
100	media \
101	model \
102	serial \
103	ses \
104	size \
105	slot \
106	smart \
107	smartx \
108	temp \
109	health \
110	r_proc \
111	w_proc \
112	r_ucor \
113	w_ucor \
114	nonmed \
115	defect \
116	hours_on \
117	realloc \
118	rep_ucor \
119	cmd_to \
120	pend_sec \
121	off_ucor \
122	ata_err \
123	nvme_err \
124	pwr_cyc \
125	upath \
126	vendor \
127	smart_test \
128	test_type \
129	test_status \
130	test_progress \
131	test_ended
132
133zpoolcompatdir = $(pkgdatadir)/compatibility.d
134dist_zpoolcompat_DATA = \
135	%D%/compatibility.d/compat-2018 \
136	%D%/compatibility.d/compat-2019 \
137	%D%/compatibility.d/compat-2020 \
138	%D%/compatibility.d/compat-2021 \
139	%D%/compatibility.d/freebsd-11.0 \
140	%D%/compatibility.d/freebsd-11.2 \
141	%D%/compatibility.d/freebsd-11.3 \
142	%D%/compatibility.d/freenas-9.10.2 \
143	%D%/compatibility.d/grub2 \
144	%D%/compatibility.d/openzfs-2.0-freebsd \
145	%D%/compatibility.d/openzfs-2.0-linux \
146	%D%/compatibility.d/openzfs-2.1-freebsd \
147	%D%/compatibility.d/openzfs-2.1-linux \
148	%D%/compatibility.d/openzfs-2.2 \
149	%D%/compatibility.d/openzfsonosx-1.7.0 \
150	%D%/compatibility.d/openzfsonosx-1.8.1 \
151	%D%/compatibility.d/openzfsonosx-1.9.3 \
152	%D%/compatibility.d/zol-0.6.1 \
153	%D%/compatibility.d/zol-0.6.4 \
154	%D%/compatibility.d/zol-0.6.5 \
155	%D%/compatibility.d/zol-0.7 \
156	%D%/compatibility.d/zol-0.8
157
158# canonical <- alias symbolic link pairs
159# eg: "2018" is a link to "compat-2018"
160zpoolcompatlinks = \
161	"compat-2018		2018" \
162	"compat-2019		2019" \
163	"compat-2020		2020" \
164	"compat-2021		2021" \
165	"freebsd-11.0		freebsd-11.1" \
166	"freebsd-11.0		freenas-11.0" \
167	"freebsd-11.2		freenas-11.2" \
168	"freebsd-11.3		freebsd-11.4" \
169	"freebsd-11.3		freebsd-12.0" \
170	"freebsd-11.3		freebsd-12.1" \
171	"freebsd-11.3		freebsd-12.2" \
172	"freebsd-11.3		freebsd-12.3" \
173	"freebsd-11.3		freebsd-12.4" \
174	"openzfs-2.1-freebsd	freebsd-13.0" \
175	"openzfs-2.1-freebsd	freebsd-13.1" \
176	"openzfs-2.1-freebsd	freebsd-13.2" \
177	"freebsd-11.3		freenas-11.3" \
178	"freenas-11.0		freenas-11.1" \
179	"openzfsonosx-1.9.3	openzfsonosx-1.9.4" \
180	"openzfs-2.0-freebsd	truenas-12.0" \
181	"zol-0.7		ubuntu-18.04" \
182	"zol-0.8		ubuntu-20.04" \
183	"openzfs-2.1-linux	ubuntu-22.04" \
184	"openzfs-2.2		openzfs-2.2-linux" \
185	"openzfs-2.2		openzfs-2.2-freebsd"
186
187zpoolconfdir = $(sysconfdir)/zfs/zpool.d
188INSTALL_DATA_HOOKS += zpool-install-data-hook
189zpool-install-data-hook:
190	$(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)"
191	set -x; for f in $(zpoolconfdefaults); do \
192	  [ -f "$(DESTDIR)$(zpoolconfdir)/$${f}" ] || \
193	  [ -L "$(DESTDIR)$(zpoolconfdir)/$${f}" ] || \
194	    $(LN_S) "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \
195	done
196	set -x; printf '%s\n' $(zpoolcompatlinks) | \
197	while read -r canon alias; do \
198		$(LN_S) -f "$${canon}" "$(DESTDIR)$(zpoolcompatdir)/$${alias}"; \
199	done
200