1include $(top_srcdir)/config/Rules.am
2include $(top_srcdir)/config/Shellcheck.am
3
4AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS)
5
6DEFAULT_INCLUDES += -I$(srcdir)
7
8sbin_PROGRAMS = zpool
9
10zpool_SOURCES = \
11	zpool_iter.c \
12	zpool_main.c \
13	zpool_util.c \
14	zpool_util.h \
15	zpool_vdev.c
16
17if BUILD_FREEBSD
18zpool_SOURCES += os/freebsd/zpool_vdev_os.c
19endif
20
21if BUILD_LINUX
22zpool_SOURCES += os/linux/zpool_vdev_os.c
23endif
24
25zpool_LDADD = \
26	$(abs_top_builddir)/lib/libzfs/libzfs.la \
27	$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
28	$(abs_top_builddir)/lib/libnvpair/libnvpair.la \
29	$(abs_top_builddir)/lib/libuutil/libuutil.la
30
31zpool_LDADD += $(LTLIBINTL)
32
33if BUILD_FREEBSD
34zpool_LDADD += -lgeom
35endif
36zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS)
37
38include $(top_srcdir)/config/CppCheck.am
39
40zpoolconfdir = $(sysconfdir)/zfs/zpool.d
41zpoolexecdir = $(zfsexecdir)/zpool.d
42
43EXTRA_DIST = zpool.d/README compatibility.d
44
45dist_zpoolexec_SCRIPTS = \
46	zpool.d/dm-deps \
47	zpool.d/enc \
48	zpool.d/encdev \
49	zpool.d/fault_led \
50	zpool.d/iostat \
51	zpool.d/iostat-1s \
52	zpool.d/iostat-10s \
53	zpool.d/label \
54	zpool.d/locate_led \
55	zpool.d/lsblk \
56	zpool.d/media \
57	zpool.d/model \
58	zpool.d/serial \
59	zpool.d/ses \
60	zpool.d/size \
61	zpool.d/slot \
62	zpool.d/smart \
63	zpool.d/smartx \
64	zpool.d/temp \
65	zpool.d/health \
66	zpool.d/r_proc \
67	zpool.d/w_proc \
68	zpool.d/r_ucor \
69	zpool.d/w_ucor \
70	zpool.d/nonmed \
71	zpool.d/defect \
72	zpool.d/hours_on \
73	zpool.d/realloc \
74	zpool.d/rep_ucor \
75	zpool.d/cmd_to \
76	zpool.d/pend_sec \
77	zpool.d/off_ucor \
78	zpool.d/ata_err \
79	zpool.d/nvme_err \
80	zpool.d/pwr_cyc \
81	zpool.d/upath \
82	zpool.d/vendor \
83	zpool.d/smart_test \
84	zpool.d/test_type \
85	zpool.d/test_status \
86	zpool.d/test_progress \
87	zpool.d/test_ended
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
134
135dist_zpoolcompat_DATA = \
136	compatibility.d/compat-2018 \
137	compatibility.d/compat-2019 \
138	compatibility.d/compat-2020 \
139	compatibility.d/compat-2021 \
140	compatibility.d/freebsd-11.0 \
141	compatibility.d/freebsd-11.2 \
142	compatibility.d/freebsd-11.3 \
143	compatibility.d/freenas-9.10.2 \
144	compatibility.d/grub2 \
145	compatibility.d/openzfsonosx-1.7.0 \
146	compatibility.d/openzfsonosx-1.8.1 \
147	compatibility.d/openzfsonosx-1.9.3 \
148	compatibility.d/openzfs-2.0-freebsd \
149	compatibility.d/openzfs-2.0-linux \
150	compatibility.d/openzfs-2.1-freebsd \
151	compatibility.d/openzfs-2.1-linux \
152	compatibility.d/zol-0.6.1 \
153	compatibility.d/zol-0.6.4 \
154	compatibility.d/zol-0.6.5 \
155	compatibility.d/zol-0.7 \
156	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		freenas-11.3" \
173	"freenas-11.0		freenas-11.1" \
174	"openzfsonosx-1.9.3	openzfsonosx-1.9.4" \
175	"openzfs-2.0-freebsd	truenas-12.0" \
176	"zol-0.7		ubuntu-18.04" \
177	"zol-0.8		ubuntu-20.04"
178
179install-data-hook:
180	$(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)"
181	for f in $(zpoolconfdefaults); do \
182	  test -f "$(DESTDIR)$(zpoolconfdir)/$${f}" -o \
183	       -L "$(DESTDIR)$(zpoolconfdir)/$${f}" || \
184	    ln -s "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \
185	done
186	for l in $(zpoolcompatlinks); do \
187		(cd "$(DESTDIR)$(zpoolcompatdir)"; ln -sf $${l} ); \
188	done
189