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