Whamcloud - gitweb
06d9b60a563825e572bce4f769c84dca98582abc
[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_la_LDFLAGS = $(LIBREADLINE) -version-info 1:0:0 \
108                           -Wl,--version-script=liblustreapi.map
109 liblustreapi_la_LIBADD = $(top_builddir)/libcfs/libcfs/libcfs.la
110
111 pkgconfigdir = $(libdir)/pkgconfig
112 pkgconfig_DATA = lustre.pc
113
114 if UTILS
115 LIB_TARGETS =
116 if PLUGINS
117 if LDISKFS_ENABLED
118 LIB_TARGETS += mount_osd_ldiskfs.so
119 endif
120 if ZFS_ENABLED
121 LIB_TARGETS += mount_osd_zfs.so
122 endif
123 endif
124
125 install-exec-hook:
126         @$(NORMAL_INSTALL)
127         $(mkinstalldirs) $(DESTDIR)$(libdir)
128         $(mkinstalldirs) $(DESTDIR)$(libdir)/lustre
129         for p in $(LIB_TARGETS); do \
130           if test -f $$p; then \
131             f="`echo $$p | sed -e 's|^.*/||'`"; \
132             echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/lustre/$$f"; \
133             $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/lustre/$$f; \
134           else :; fi; \
135         done
136 endif # UTILS
137
138 llog_reader_SOURCES = llog_reader.c
139 llog_reader_LDADD := liblustreapi.la
140 llog_reader_DEPENDENCIES := liblustreapi.la
141
142 lr_reader_SOURCES = lr_reader.c
143
144 ofd_access_log_reader_SOURCES = \
145         lstddef.h \
146         ofd_access_batch.c \
147         ofd_access_batch.h \
148         ofd_access_log_reader.c
149 ofd_access_log_reader_LDADD := -lpthread
150
151 if UTILS
152
153 PLUGIN_LIB =
154 if PLUGINS
155 MNTMODLDFLAGS := -rdynamic
156 MNTMODLIBS := -ldl
157 MNTMODCFLAGS := -DPLUGIN_DIR=\"${pkglibdir}\"
158 else
159 MNTMODLIBS :=
160 endif # PLUGINS
161
162 if ZFS_ENABLED
163 noinst_LIBRARIES += libmount_utils_zfs.a
164
165 libmount_utils_zfs_a_SOURCES = libmount_utils_zfs.c
166 libmount_utils_zfs_a_CPPFLAGS := -DHAVE_IOCTL_IN_UNISTD_H $(ZFS_LIBZFS_INCLUDE)
167
168 if PLUGINS
169 lib_LTLIBRARIES += libmount_utils_zfs.la
170 libmount_utils_zfs.la : libmount_utils_zfs.a
171         $(CC) $(LDFLAGS) $(MNTMODLDFLAGS) -shared -export-dynamic -pthread \
172                          $(ZFS_LIBZFS_LDFLAGS) -o mount_osd_zfs.so \
173                          `$(AR) -t libmount_utils_zfs.a` \
174                          $(MNTMODLIBS) $(ZFS_LIBZFS_LIBS)
175 else
176 MNTMODLDFLAGS := $(ZFS_LIBZFS_LDFLAGS)
177 MNTMODLIBS += $(ZFS_LIBZFS_LIBS)
178 PLUGIN_LIB += libmount_utils_zfs.a
179 endif # PLUGINS
180 endif # ZFS_ENABLED
181
182 if LDISKFS_ENABLED
183 noinst_LIBRARIES += libmount_utils_ldiskfs.a
184
185 libmount_utils_ldiskfs_a_SOURCES = libmount_utils_ldiskfs.c
186 libmount_utils_ldiskfs_a_CPPFLAGS :=
187
188 if PLUGINS
189 lib_LTLIBRARIES += libmount_utils_ldiskfs.la
190 libmount_utils_ldiskfs.la : libmount_utils_ldiskfs.a
191         $(CC) $(LDFLAGS) $(MNTMODLDFLAGS) -shared -export-dynamic \
192                          -o mount_osd_ldiskfs.so \
193                          `$(AR) -t libmount_utils_ldiskfs.a` \
194                          $(MNTMODLIBS) -lext2fs
195 else
196 MNTMODLIBS += -lext2fs
197 PLUGIN_LIB += libmount_utils_ldiskfs.a
198 endif # PLUGINS
199 endif # LDISKFS_ENABLED
200
201 mount_lustre_SOURCES = mount_lustre.c mount_utils.c mount_utils.h $(GSSSRC)
202 mount_lustre_CPPFLAGS := ${MNTMODCFLAGS}
203 mount_lustre_LDFLAGS  := ${MNTMODLDFLAGS}
204 mount_lustre_LDADD    := $(SELINUX) $(LDLIBMOUNT) $(PLUGIN_LIB) $(GSSLIB) \
205                          $(top_builddir)/libcfs/libcfs/libcfs.la $(MNTMODLIBS)
206 mount_lustre_tgt_SOURCES = ${mount_lustre_SOURCES}
207 mount_lustre_tgt_CPPFLAGS = ${mount_lustre_CPPFLAGS}
208 mount_lustre_tgt_LDFLAGS = ${mount_lustre_LDFLAGS}
209 mount_lustre_tgt_LDADD = ${mount_lustre_LDADD}
210
211 mkfs_lustre_SOURCES = mkfs_lustre.c mount_utils.c mount_utils.h $(GSSSRC)
212 mkfs_lustre_CPPFLAGS := -UTUNEFS ${MNTMODCFLAGS}
213 mkfs_lustre_LDFLAGS  := ${MNTMODLDFLAGS}
214 mkfs_lustre_LDADD    := $(mount_lustre_LDADD)
215
216 tunefs_lustre_SOURCES = mkfs_lustre.c mount_utils.c mount_utils.h $(GSSSRC)
217 tunefs_lustre_CPPFLAGS := -DTUNEFS ${MNTMODCFLAGS}
218 tunefs_lustre_LDFLAGS  := ${MNTMODLDFLAGS}
219 tunefs_lustre_LDADD    := $(mkfs_lustre_LDADD)
220
221 l_tunedisk_SOURCES = l_tunedisk.c mount_utils.c mount_utils.h $(GSSSRC)
222 l_tunedisk_CPPFLAGS := ${MNTMODCFLAGS}
223 l_tunedisk_LDFLAGS  := ${MNTMODLDFLAGS}
224 l_tunedisk_LDADD    := $(mount_lustre_LDADD)
225
226 l_foreign_symlink_SOURCES = l_foreign_symlink.c
227 l_foreign_symlink_LDADD := $(top_builddir)/libcfs/libcfs/libcfs.la
228 l_foreign_symlink_DEPENDENCIES := $(top_builddir)/libcfs/libcfs/libcfs.la
229
230 l_getidentity_SOURCES = l_getidentity.c
231 l_getidentity_LDADD := $(top_builddir)/libcfs/libcfs/libcfs.la
232 l_getidentity_DEPENDENCIES := $(top_builddir)/libcfs/libcfs/libcfs.la
233
234 lhsmtool_posix_SOURCES = lhsmtool_posix.c pid_file.c pid_file.h
235 lhsmtool_posix_LDADD := liblustreapi.la $(PTHREAD_LIBS)
236 lhsmtool_posix_DEPENDENCIES := liblustreapi.la
237
238 l_getsepol_SOURCES = l_getsepol.c
239 l_getsepol_LDADD := liblustreapi.la -lcrypto $(SELINUX)
240 l_getsepol_DEPENDENCIES := liblustreapi.la
241
242 wirecheck_SOURCES = wirecheck.c
243 wirecheck_CPPFLAGS := -DCC="\"$(CC)\""
244
245 wiretest_SOURCES = wiretest.c
246
247 endif # UTILS
248
249 EXTRA_DIST = llstat llobdstat plot-llstat ldlm_debug_upcall liblustreapi.map
250
251 # NOTE: this should only be run on i386.
252 newwiretest: wirehdr.c wirecheck
253         cp wirehdr.c wiretest.c
254         LANG=C ./wirecheck >> wiretest.c
255         cp ../ptlrpc/wirehdr.c ../ptlrpc/wiretest.c
256         LANG=C ./wirecheck >> ../ptlrpc/wiretest.c