xref: /freebsd/sys/contrib/openzfs/cmd/zpool/Makefile.am (revision 7a7741af18d6c8a804cc643cb7ecda9d730c6aa6)
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-2.06 \
144	%D%/compatibility.d/grub2-2.12 \
145	%D%/compatibility.d/openzfs-2.0-freebsd \
146	%D%/compatibility.d/openzfs-2.0-linux \
147	%D%/compatibility.d/openzfs-2.1-freebsd \
148	%D%/compatibility.d/openzfs-2.1-linux \
149	%D%/compatibility.d/openzfs-2.2 \
150	%D%/compatibility.d/openzfs-2.3 \
151	%D%/compatibility.d/openzfsonosx-1.7.0 \
152	%D%/compatibility.d/openzfsonosx-1.8.1 \
153	%D%/compatibility.d/openzfsonosx-1.9.3 \
154	%D%/compatibility.d/zol-0.6.1 \
155	%D%/compatibility.d/zol-0.6.4 \
156	%D%/compatibility.d/zol-0.6.5 \
157	%D%/compatibility.d/zol-0.7 \
158	%D%/compatibility.d/zol-0.8
159
160# canonical <- alias symbolic link pairs
161# eg: "2018" is a link to "compat-2018"
162zpoolcompatlinks = \
163	"compat-2018		2018" \
164	"compat-2019		2019" \
165	"compat-2020		2020" \
166	"compat-2021		2021" \
167	"freebsd-11.0		freebsd-11.1" \
168	"freebsd-11.0		freenas-11.0" \
169	"freebsd-11.2		freenas-11.2" \
170	"freebsd-11.3		freebsd-11.4" \
171	"freebsd-11.3		freebsd-12.0" \
172	"freebsd-11.3		freebsd-12.1" \
173	"freebsd-11.3		freebsd-12.2" \
174	"freebsd-11.3		freebsd-12.3" \
175	"freebsd-11.3		freebsd-12.4" \
176	"grub2-2.12		grub2" \
177	"openzfs-2.1-freebsd	freebsd-13.0" \
178	"openzfs-2.1-freebsd	freebsd-13.1" \
179	"openzfs-2.1-freebsd	freebsd-13.2" \
180	"freebsd-11.3		freenas-11.3" \
181	"freenas-11.0		freenas-11.1" \
182	"openzfsonosx-1.9.3	openzfsonosx-1.9.4" \
183	"openzfs-2.0-freebsd	truenas-12.0" \
184	"zol-0.7		ubuntu-18.04" \
185	"zol-0.8		ubuntu-20.04" \
186	"openzfs-2.1-linux	ubuntu-22.04" \
187	"openzfs-2.2		openzfs-2.2-linux" \
188	"openzfs-2.2		openzfs-2.2-freebsd" \
189	"openzfs-2.3		openzfs-2.3-linux" \
190	"openzfs-2.3		openzfs-2.3-freebsd"
191
192zpoolconfdir = $(sysconfdir)/zfs/zpool.d
193INSTALL_DATA_HOOKS += zpool-install-data-hook
194zpool-install-data-hook:
195	$(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)"
196	set -x; for f in $(zpoolconfdefaults); do \
197	  [ -f "$(DESTDIR)$(zpoolconfdir)/$${f}" ] || \
198	  [ -L "$(DESTDIR)$(zpoolconfdir)/$${f}" ] || \
199	    $(LN_S) "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \
200	done
201	set -x; printf '%s\n' $(zpoolcompatlinks) | \
202	while read -r canon alias; do \
203		$(LN_S) -f "$${canon}" "$(DESTDIR)$(zpoolcompatdir)/$${alias}"; \
204	done
205