Whamcloud - gitweb
LU-17308 mgs: move pool_cmd check to the kernel
[fs/lustre-release.git] / lustre / utils / Makefile.am
1 # Administration utilities Makefile
2
3 AM_CFLAGS  := -fPIC -D_GNU_SOURCE \
4               -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DLUSTRE_UTILS=1 $(UTILS_CFLAGS)
5 AM_LDFLAGS := $(UTILS_LDFLAGS)
6
7 if TESTS
8 EXTRA_PROGRAMS = wirecheck
9 endif
10
11 if UTILS
12
13 if GSS
14 SUBDIRS = . gss
15 GSSSRC = gss/err_util.c gss/err_util.h
16 GSSLIB = -lm
17 if GSS_SSK
18 GSSSRC += gss/sk_utils.c gss/sk_utils.h
19 GSSLIB += -lkeyutils -lcrypto -lssl
20 endif
21 if GSS_KEYRING
22 GSSLIB += -lkeyutils
23 endif
24 else
25 GSSSRC =
26 GSSLIB =
27 endif
28
29 # mount only finds helpers in /sbin
30 rootsbin_PROGRAMS = mount.lustre
31 if SERVER
32 rootsbin_PROGRAMS += mount.lustre_tgt
33 endif
34 bin_SCRIPTS   = llstat llobdstat lljobstat plot-llstat
35 bin_PROGRAMS  = lfs
36 sbin_SCRIPTS  = ldlm_debug_upcall
37 sbin_PROGRAMS = lctl l_getidentity llverdev llverfs lustre_rsync \
38                 ll_decode_linkea llsom_sync l_foreign_symlink
39
40 if TESTS
41 sbin_PROGRAMS += wiretest
42 endif # TESTS
43
44 if SERVER
45 sbin_PROGRAMS += mkfs.lustre tunefs.lustre lr_reader lshowmount \
46                  ll_decode_filter_fid llog_reader l_tunedisk \
47                  ofd_access_log_reader check_iam
48 endif
49 if LIBPTHREAD
50 sbin_PROGRAMS += lhsmtool_posix
51 endif
52
53 if SELINUX
54 if GETSEPOL
55 sbin_PROGRAMS += l_getsepol
56 endif
57 endif
58 endif # UTILS
59
60 lib_LIBRARIES =
61 noinst_LIBRARIES =
62 if LDISKFS_ENABLED
63 libiam_a_SOURCES = libiam.c
64 lib_LIBRARIES += libiam.a
65 endif
66
67 pkglib_LTLIBRARIES =
68 lib_LTLIBRARIES = liblustreapi.la
69
70 lctl_SOURCES = portals.c debug.c obd.c lustre_cfg.c lctl.c obdctl.h
71 lctl_SOURCES += lctl_thread.c lctl_thread.h
72 if SERVER
73 lctl_SOURCES += lustre_lfsck.c lsnapshot.c
74 endif
75 lctl_CFLAGS := $(AM_CFLAGS) $(LIBNL3_CFLAGS) -I $(top_builddir)/lnet/utils
76 lctl_LDADD := liblustreapi.la $(PTHREAD_LIBS) $(LIBNL3_LIBS) -lyaml
77 lctl_LDADD += $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.la
78
79 lfs_SOURCES = lfs.c lfs_project.c lfs_project.h callvpe.c callvpe.h
80 lfs_CFLAGS := -fPIC $(AM_CFLAGS) -I $(top_builddir)/lnet/utils
81 lfs_LDADD := liblustreapi.la -lz
82 lfs_LDADD += $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.la
83 lfs_DEPENDENCIES := liblustreapi.la
84
85 lustre_rsync_SOURCES = lustre_rsync.c lustre_rsync.h callvpe.c callvpe.h
86 lustre_rsync_LDADD :=  liblustreapi.la $(PTHREAD_LIBS)
87 lustre_rsync_DEPENDENCIES := liblustreapi.la
88
89 llsom_sync_LDADD := liblustreapi.la
90 llsom_sync_DEPENDENCIES := liblustreapi.la
91
92 lshowmount_SOURCES = lshowmount.c nidlist.c nidlist.h
93 lshowmount_LDADD :=  liblustreapi.la
94
95 if EXT2FS_DEVEL
96 EXT2FSLIB = -lext2fs
97 E2PLIB = -le2p
98 else
99 E2PLIB =
100 EXT2FSLIB =
101 endif
102
103 llverfs_LDADD := $(EXT2FSLIB) $(E2PLIB)
104
105 liblustreapi_la_SOURCES = liblustreapi.c liblustreapi_hsm.c \
106                           liblustreapi_nodemap.c lustreapi_internal.h \
107                           liblustreapi_json.c liblustreapi_layout.c \
108                           liblustreapi_lease.c liblustreapi_util.c \
109                           liblustreapi_kernelconn.c liblustreapi_param.c \
110                           liblustreapi_mirror.c liblustreapi_fid.c \
111                           liblustreapi_ladvise.c liblustreapi_chlg.c \
112                           liblustreapi_heat.c liblustreapi_pcc.c \
113                           liblustreapi_ioctl.c liblustreapi_root.c \
114                           liblustreapi_lseek.c liblustreapi_swap.c
115 liblustreapi_la_CFLAGS = -fPIC -D_GNU_SOURCE $(LIBNL3_CFLAGS) \
116                          -I $(top_builddir)/lnet/utils \
117                          -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \
118                          -DLUSTRE_UTILS=1
119 liblustreapi_la_LDFLAGS = $(LIBREADLINE) -version-info 1:0:0 \
120                           -Wl,--version-script=liblustreapi.map
121 liblustreapi_la_LIBADD = $(top_builddir)/libcfs/libcfs/libcfs.la \
122                          $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.la \
123                          $(LIBNL3_LIBS) -lpthread
124
125 pkgconfigdir = $(libdir)/pkgconfig
126 pkgconfig_DATA = lustre.pc
127
128 if UTILS
129 LIB_TARGETS =
130 if PLUGINS
131 if LDISKFS_ENABLED
132 LIB_TARGETS += mount_osd_ldiskfs.so
133 endif
134 if ZFS_ENABLED
135 LIB_TARGETS += mount_osd_zfs.so
136 endif
137 endif
138
139 install-exec-hook:
140         @$(NORMAL_INSTALL)
141         $(mkinstalldirs) $(DESTDIR)$(libdir)
142         $(mkinstalldirs) $(DESTDIR)$(libdir)/lustre
143         for p in $(LIB_TARGETS); do \
144           if test -f $$p; then \
145             f="`echo $$p | sed -e 's|^.*/||'`"; \
146             echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/lustre/$$f"; \
147             $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/lustre/$$f; \
148           else :; fi; \
149         done
150 endif # UTILS
151
152 llog_reader_SOURCES = llog_reader.c
153 llog_reader_LDADD := liblustreapi.la
154 llog_reader_DEPENDENCIES := liblustreapi.la
155
156 check_iam_SOURCES = check_iam.c
157
158 lr_reader_SOURCES = lr_reader.c
159
160 ofd_access_log_reader_SOURCES = \
161         lstddef.h \
162         ofd_access_batch.c \
163         ofd_access_batch.h \
164         ofd_access_log_reader.c
165 ofd_access_log_reader_LDADD := -lpthread liblustreapi.la
166 ofd_access_log_reader_DEPENDENCIES := liblustreapi.la
167
168 if UTILS
169
170 PLUGIN_LIB =
171 if PLUGINS
172 MNTMODLDFLAGS := -rdynamic
173 MNTMODLIBS := -ldl
174 MNTMODCFLAGS := -DPLUGIN_DIR=\"${pkglibdir}\"
175 else
176 MNTMODLIBS :=
177 endif # PLUGINS
178
179 if ZFS_ENABLED
180 noinst_LIBRARIES += libmount_utils_zfs.a
181
182 libmount_utils_zfs_a_SOURCES = libmount_utils_zfs.c
183 libmount_utils_zfs_a_CPPFLAGS := -DHAVE_IOCTL_IN_UNISTD_H $(ZFS_LIBZFS_INCLUDE)
184
185 if PLUGINS
186 lib_LTLIBRARIES += libmount_utils_zfs.la
187 libmount_utils_zfs.la : libmount_utils_zfs.a
188         $(CC) $(LDFLAGS) $(MNTMODLDFLAGS) -shared -export-dynamic -pthread \
189                          $(ZFS_LIBZFS_LDFLAGS) -o mount_osd_zfs.so \
190                          `$(AR) -t libmount_utils_zfs.a` \
191                          $(MNTMODLIBS) $(ZFS_LIBZFS_LIBS)
192 else
193 MNTMODLDFLAGS := $(ZFS_LIBZFS_LDFLAGS)
194 MNTMODLIBS += $(ZFS_LIBZFS_LIBS)
195 PLUGIN_LIB += libmount_utils_zfs.a
196 endif # PLUGINS
197 endif # ZFS_ENABLED
198
199 if LDISKFS_ENABLED
200 noinst_LIBRARIES += libmount_utils_ldiskfs.a
201
202 libmount_utils_ldiskfs_a_SOURCES = libmount_utils_ldiskfs.c
203 libmount_utils_ldiskfs_a_CPPFLAGS :=
204
205 if PLUGINS
206 lib_LTLIBRARIES += libmount_utils_ldiskfs.la
207 libmount_utils_ldiskfs.la : libmount_utils_ldiskfs.a
208         $(CC) $(LDFLAGS) $(MNTMODLDFLAGS) -shared -export-dynamic \
209                          -o mount_osd_ldiskfs.so \
210                          `$(AR) -t libmount_utils_ldiskfs.a` \
211                          $(MNTMODLIBS) -lext2fs
212 else
213 MNTMODLIBS += -lext2fs
214 PLUGIN_LIB += libmount_utils_ldiskfs.a
215 endif # PLUGINS
216 endif # LDISKFS_ENABLED
217
218 mount_lustre_SOURCES = mount_lustre.c mount_utils.c mount_utils.h $(GSSSRC)
219 mount_lustre_CPPFLAGS := ${MNTMODCFLAGS}
220 mount_lustre_LDFLAGS  := ${MNTMODLDFLAGS}
221 mount_lustre_LDADD    := $(SELINUX) $(LDLIBMOUNT) $(PLUGIN_LIB) $(GSSLIB) \
222                          $(top_builddir)/libcfs/libcfs/libcfs.la $(MNTMODLIBS)
223 mount_lustre_tgt_SOURCES = ${mount_lustre_SOURCES}
224 mount_lustre_tgt_CPPFLAGS = ${mount_lustre_CPPFLAGS}
225 mount_lustre_tgt_LDFLAGS = ${mount_lustre_LDFLAGS}
226 mount_lustre_tgt_LDADD = ${mount_lustre_LDADD}
227
228 mkfs_lustre_SOURCES = mkfs_lustre.c mount_utils.c mount_utils.h $(GSSSRC)
229 mkfs_lustre_CPPFLAGS := -UTUNEFS ${MNTMODCFLAGS}
230 mkfs_lustre_LDFLAGS  := ${MNTMODLDFLAGS}
231 mkfs_lustre_LDADD    := $(mount_lustre_LDADD)
232
233 tunefs_lustre_SOURCES = mkfs_lustre.c mount_utils.c mount_utils.h $(GSSSRC)
234 tunefs_lustre_CPPFLAGS := -DTUNEFS ${MNTMODCFLAGS}
235 tunefs_lustre_LDFLAGS  := ${MNTMODLDFLAGS}
236 tunefs_lustre_LDADD    := $(mkfs_lustre_LDADD)
237
238 l_tunedisk_SOURCES = l_tunedisk.c mount_utils.c mount_utils.h $(GSSSRC)
239 l_tunedisk_CPPFLAGS := ${MNTMODCFLAGS}
240 l_tunedisk_LDFLAGS  := ${MNTMODLDFLAGS}
241 l_tunedisk_LDADD    := $(mount_lustre_LDADD)
242
243 l_foreign_symlink_SOURCES = l_foreign_symlink.c
244 l_foreign_symlink_LDADD := $(top_builddir)/libcfs/libcfs/libcfs.la
245 l_foreign_symlink_DEPENDENCIES := $(top_builddir)/libcfs/libcfs/libcfs.la
246
247 l_getidentity_SOURCES = l_getidentity.c
248 l_getidentity_LDADD := $(top_builddir)/libcfs/libcfs/libcfs.la
249 l_getidentity_LDFLAGS = -ldl
250 l_getidentity_DEPENDENCIES := $(top_builddir)/libcfs/libcfs/libcfs.la
251
252 lhsmtool_posix_SOURCES = lhsmtool_posix.c pid_file.c pid_file.h
253 lhsmtool_posix_LDADD := liblustreapi.la $(PTHREAD_LIBS) \
254                 $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.la
255
256 l_getsepol_SOURCES = l_getsepol.c
257 l_getsepol_LDADD := liblustreapi.la -lcrypto $(SELINUX)
258 l_getsepol_DEPENDENCIES := liblustreapi.la
259
260 wirecheck_SOURCES = wirecheck.c
261 wirecheck_CPPFLAGS := -DCC="\"$(CC)\""
262
263 wiretest_SOURCES = wiretest.c
264
265 endif # UTILS
266
267 EXTRA_DIST = llstat llobdstat lljobstat plot-llstat ldlm_debug_upcall liblustreapi.map
268
269 # NOTE: this should only be run on i386.
270 newwiretest: wirehdr.c wirecheck
271         cp wirehdr.c wiretest.c
272         LANG=C ./wirecheck >> wiretest.c
273         cp ../ptlrpc/wirehdr.c ../ptlrpc/wiretest.c
274         LANG=C ./wirecheck >> ../ptlrpc/wiretest.c