Makefile.in 11.9 KB
Newer Older
1 2
#TODO: each module provides own makefile with module-specific objects, build options, etc.

3 4 5
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
6 7 8 9 10 11
datarootdir = @datarootdir@
includedir = @includedir@
mandir = @mandir@
sbindir = @sbindir@
bindir = @bindir@
libdir = @libdir@
12 13 14 15
LDFLAGS = @LDFLAGS@
CC = @CC@
LD = @LD@

16
DISABLE_STATIC_LIB = @DISABLE_STATIC_LIB@
17
DISABLE_LDPRELOAD = @DISABLE_LDPRELOAD@
18
ENABLE_MMAP_LOGS = @ENABLE_MMAP_LOGS@
19
DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h
20
DARSHAN_VERSION = @DARSHAN_VERSION@
21

22 23 24
ifndef DISABLE_STATIC_LIB
all: lib/libdarshan.a lib/libdarshan-stubs.a
endif
25
ifndef DISABLE_LDPRELOAD
Philip Carns's avatar
Philip Carns committed
26
all: lib/libdarshan.so
27
endif
28

29 30 31 32 33 34 35 36
VPATH = $(srcdir)

CFLAGS = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I ../ -I $(srcdir) -I$(srcdir)/../ @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE

CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir) -I$(srcdir)/../ @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE -shared -fpic -DPIC -DDARSHAN_PRELOAD

LIBS = -lz @LIBBZ2@

37
BUILD_NULL_MODULE = @BUILD_NULL_MODULE@
Philip Carns's avatar
Philip Carns committed
38 39 40
BUILD_POSIX_MODULE = @BUILD_POSIX_MODULE@
BUILD_STDIO_MODULE = @BUILD_STDIO_MODULE@
BUILD_DXT_MODULE = @BUILD_DXT_MODULE@
41 42 43 44 45 46
BUILD_MPIIO_MODULE = @BUILD_MPIIO_MODULE@
BUILD_PNETCDF_MODULE = @BUILD_PNETCDF_MODULE@
BUILD_HDF5_MODULE = @BUILD_HDF5_MODULE@
BUILD_BGQ_MODULE = @BUILD_BGQ_MODULE@
BUILD_LUSTRE_MODULE = @BUILD_LUSTRE_MODULE@
BUILD_MDHIM_MODULE = @BUILD_MDHIM_MODULE@
47

Philip Carns's avatar
Philip Carns committed
48 49 50
DARSHAN_STATIC_MOD_OBJS =
DARSHAN_DYNAMIC_MOD_OBJS =

51 52 53 54 55
ifdef BUILD_NULL_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-null.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-null.po
endif

Philip Carns's avatar
Philip Carns committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69
ifdef BUILD_POSIX_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-posix.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-posix.po
endif

ifdef BUILD_STDIO_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-stdio.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-stdio.po
endif

ifdef BUILD_DXT_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-dxt.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-dxt.po
endif
70

71 72 73 74 75 76 77 78 79 80
ifdef BUILD_MPIIO_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-mpiio.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-mpiio.po
endif

ifdef BUILD_PNETCDF_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-pnetcdf.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-pnetcdf.po
endif

81 82 83 84
ifdef BUILD_HDF5_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-hdf5.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-hdf5.po
endif
85

86
ifdef BUILD_BGQ_MODULE
87 88
DARSHAN_STATIC_MOD_OBJS += lib/darshan-bgq.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-bgq.po
89 90
CFLAGS += -DDARSHAN_BGQ
CFLAGS_SHARED += -DDARSHAN_BGQ
91 92
endif

93
ifdef BUILD_LUSTRE_MODULE
94 95 96 97 98 99
DARSHAN_STATIC_MOD_OBJS += lib/darshan-lustre.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-lustre.po
CFLAGS += -DDARSHAN_LUSTRE
CFLAGS_SHARED += -DDARSHAN_LUSTRE
endif

100 101 102 103 104 105 106
ifdef BUILD_MDHIM_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-mdhim.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-mdhim.po
CFLAGS += -DDARSHAN_MDHIM
CFLAGS_SHARED += -DDARSHAN_MDHIM
endif

107 108 109
lib::
	@mkdir -p $@

Shane Snyder's avatar
Shane Snyder committed
110
lib/darshan-core-init-finalize.o: lib/darshan-core-init-finalize.c darshan.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
111 112
	$(CC) $(CFLAGS) -c $< -o $@

113
lib/darshan-core-init-finalize.po: lib/darshan-core-init-finalize.c darshan.h darshan-dynamic.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
Shane Snyder's avatar
Shane Snyder committed
114 115 116 117 118
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

lib/darshan-core.o: lib/darshan-core.c darshan.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
	$(CC) $(CFLAGS) -c $< -o $@

119
lib/darshan-core.po: lib/darshan-core.c darshan.h darshan-dynamic.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
120 121
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

122
lib/darshan-common.o: lib/darshan-common.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) | lib
123 124
	$(CC) $(CFLAGS) -c $< -o $@

125
lib/darshan-common.po: lib/darshan-common.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) | lib
126 127
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

128
lib/darshan-null.o: lib/darshan-null.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-null-log-format.h | lib
129
	$(CC) $(CFLAGS) -c $< -o $@
130

131
lib/darshan-null.po: lib/darshan-null.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-null-log-format.h | lib
132
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
133

134
lib/darshan-posix.o: lib/darshan-posix.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-posix-log-format.h | lib
135
	$(CC) $(CFLAGS) -DDARSHAN_WRAP_MMAP -c $< -o $@
Philip Carns's avatar
Philip Carns committed
136

137
lib/darshan-posix.po: lib/darshan-posix.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-posix-log-format.h | lib
138 139
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

140
lib/darshan-mpiio.o: lib/darshan-mpiio.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h | lib
141 142
	$(CC) $(CFLAGS) -c $< -o $@

143
lib/darshan-mpiio.po: lib/darshan-mpiio.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h | lib
Philip Carns's avatar
Philip Carns committed
144 145
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

146
lib/darshan-bgq.o: lib/darshan-bgq.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h | lib
Kevin Harms's avatar
Kevin Harms committed
147 148
	$(CC) $(CFLAGS) -c $< -o $@

149
lib/darshan-bgq.po: lib/darshan-bgq.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h | lib
Kevin Harms's avatar
Kevin Harms committed
150 151
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

152
lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-hdf5-log-format.h | lib
153 154
	$(CC) $(CFLAGS) -c $< -o $@

155
lib/darshan-hdf5.po: lib/darshan-hdf5.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-hdf5-log-format.h | lib
156 157
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

158 159 160
lib/darshan-hdf5-stubs.o: lib/darshan-hdf5-stubs.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
	$(CC) $(CFLAGS) -c $< -o $@

161
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-pnetcdf-log-format.h | lib
Shane Snyder's avatar
Shane Snyder committed
162 163
	$(CC) $(CFLAGS) -c $< -o $@

164
lib/darshan-pnetcdf.po: lib/darshan-pnetcdf.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-pnetcdf-log-format.h | lib
Shane Snyder's avatar
Shane Snyder committed
165 166
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

167 168
lib/darshan-pnetcdf-stubs.o: lib/darshan-pnetcdf-stubs.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
	$(CC) $(CFLAGS) -c $< -o $@
Kevin Harms's avatar
Kevin Harms committed
169

170
lib/darshan-lustre.o: lib/darshan-lustre.c darshan-lustre.h darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-lustre-log-format.h | lib
171 172
	$(CC) $(CFLAGS) -c $< -o $@

173
lib/darshan-lustre.po: lib/darshan-lustre.c darshan-lustre.h darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-lustre-log-format.h | lib
174 175
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

Shane Snyder's avatar
Shane Snyder committed
176
lib/darshan-stdio.o: lib/darshan-stdio.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-stdio-log-format.h | lib
177
	$(CC) $(CFLAGS) -c $< -o $@
Kevin Harms's avatar
Kevin Harms committed
178

Shane Snyder's avatar
Shane Snyder committed
179 180 181
lib/darshan-stdio.po: lib/darshan-stdio.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-stdio-log-format.h | lib
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

182
lib/darshan-dxt.o: lib/darshan-dxt.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | lib
183 184
	$(CC) $(CFLAGS) -c $< -o $@

185
lib/darshan-dxt.po: lib/darshan-dxt.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | lib
186 187
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

188 189 190 191 192 193 194
lib/darshan-mdhim.o: lib/darshan-mdhim.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mdhim-log-format.h | lib
	$(CC) $(CFLAGS) -c $< -o $@

lib/darshan-mdhim.po: lib/darshan-mdhim.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mdhim-log-format.h | lib
	$(CC) $(CFLAGS_SHARED) -c $< -o $@


195 196 197
lib/lookup3.o: lib/lookup3.c
	$(CC) $(CFLAGS) -c $< -o $@

198 199
lib/lookup3.po: lib/lookup3.c
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
200 201 202 203

lib/lookup8.o: lib/lookup8.c
	$(CC) $(CFLAGS) -c $< -o $@

204 205
lib/lookup8.po: lib/lookup8.c
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
206

207
lib/libdarshan.a: lib/darshan-core-init-finalize.o lib/darshan-core.o lib/darshan-common.o $(DARSHAN_STATIC_MOD_OBJS) lib/lookup3.o lib/lookup8.o
208 209
	ar rcs $@ $^

210
lib/libdarshan.so: lib/darshan-core-init-finalize.po lib/darshan-core.po lib/darshan-common.po $(DARSHAN_DYNAMIC_MOD_OBJS) lib/lookup3.po lib/lookup8.po
211
	$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $@ $^ -lpthread -lrt -lz -ldl
212

213
ifdef BUILD_HDF5_MODULE
214 215
lib/libdarshan-stubs.a: lib/darshan-hdf5-stubs.o lib/darshan-pnetcdf-stubs.o
	ar rcs $@ $^
216 217 218 219
else
lib/libdarshan-stubs.a: lib/darshan-pnetcdf-stubs.o
	ar rcs $@ $^
endif
220

221 222

install:: all
223
	install -d $(DESTDIR)$(libdir)
224
ifndef DISABLE_STATIC_LIB
225 226
	install -m 755 lib/libdarshan.a $(DESTDIR)$(libdir)
	install -m 755 lib/libdarshan-stubs.a $(DESTDIR)$(libdir)
227
endif
228
ifndef DISABLE_LDPRELOAD
229
	install -m 755 lib/libdarshan.so $(DESTDIR)$(libdir)
230
endif
231 232 233 234 235 236 237 238 239 240 241 242 243 244
	install -d $(DESTDIR)$(bindir)
	install -m 755 darshan-mk-log-dirs.pl $(DESTDIR)$(bindir)
	install -m 755 darshan-gen-cc.pl $(DESTDIR)$(bindir)
	install -m 755 darshan-gen-cxx.pl $(DESTDIR)$(bindir)
	install -m 755 darshan-gen-fortran.pl $(DESTDIR)$(bindir)
	install -m 755 darshan-config $(DESTDIR)$(bindir)
	install -d $(DESTDIR)$(datarootdir)/craype-1.x/modulefiles/darshan
	install -m 755 share/craype-1.x/darshan-module $(DESTDIR)$(datarootdir)/craype-1.x/modulefiles/darshan/$(DARSHAN_VERSION)
	install -d $(DESTDIR)$(datarootdir)/craype-2.x/modulefiles/darshan
	install -m 755 share/craype-2.x/darshan-module $(DESTDIR)$(datarootdir)/craype-2.x/modulefiles/darshan/$(DARSHAN_VERSION)
	install -d $(DESTDIR)$(datarootdir)/mpi-profile
	install -m 755 share/mpi-profile/darshan-cc.conf $(DESTDIR)$(datarootdir)/mpi-profile/darshan-cc.conf
	install -m 755 share/mpi-profile/darshan-cxx.conf $(DESTDIR)$(datarootdir)/mpi-profile/darshan-cxx.conf
	install -m 755 share/mpi-profile/darshan-f.conf $(DESTDIR)$(datarootdir)/mpi-profile/darshan-f.conf
245 246 247
	install -m 755 share/mpi-profile/darshan-cc-static.conf $(DESTDIR)$(datarootdir)/mpi-profile/darshan-cc-static.conf
	install -m 755 share/mpi-profile/darshan-cxx-static.conf $(DESTDIR)$(datarootdir)/mpi-profile/darshan-cxx-static.conf
	install -m 755 share/mpi-profile/darshan-f-static.conf $(DESTDIR)$(datarootdir)/mpi-profile/darshan-f-static.conf
248 249
	install -d $(DESTDIR)$(datarootdir)/ld-opts
	install -m 644 share/ld-opts/darshan-base-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-base-ld-opts
250
ifdef BUILD_POSIX_MODULE
251
	install -m 644 $(srcdir)/share/ld-opts/darshan-posix-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-posix-ld-opts
252 253
endif
ifdef BUILD_STDIO_MODULE
254
	install -m 644 share/ld-opts/darshan-stdio-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-stdio-ld-opts
255 256
endif
ifdef BUILD_MPIIO_MODULE
257
	install -m 644 $(srcdir)/share/ld-opts/darshan-mpiio-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-mpiio-ld-opts
258 259
endif
ifdef BUILD_PNETCDF_MODULE
260
	install -m 644 $(srcdir)/share/ld-opts/darshan-pnetcdf-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-pnetcdf-ld-opts
261
endif
262
ifdef BUILD_HDF5_MODULE
263
	install -m 644 $(srcdir)/share/ld-opts/darshan-hdf5-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-hdf5-ld-opts
264 265
endif
ifdef BUILD_MDHIM_MODULE
266
	install -m 644 $(srcdir)/share/ld-opts/darshan-mdhim-ld-opts $(DESTDIR)$(datarootdir)/ld-opts/darshan-mdhim-ld-opts
267
endif
268
ifdef ENABLE_MMAP_LOGS
269
	install -m 755 share/darshan-mmap-epilog.sh $(DESTDIR)$(datarootdir)/darshan-mmap-epilog.sh
270
endif
271 272
	install -d $(DESTDIR)$(libdir)/pkgconfig
	install -m 644 lib/pkgconfig/darshan-runtime.pc $(DESTDIR)$(libdir)/pkgconfig/darshan-runtime.pc
273 274

clean::
Philip Carns's avatar
Philip Carns committed
275
	rm -f *.o *.a lib/*.o lib/*.po lib/*.a lib/*.so
276 277

distclean:: clean
Philip Carns's avatar
Philip Carns committed
278
	rm -f darshan-runtime-config.h darshan-gen-cxx.pl darshan-gen-fortran.pl darshan-gen-cc.pl darshan-mk-log-dirs.pl darshan-config lib/pkgconfig/darshan-runtime.pc share/craype-1.x/darshan-module share/craype-2.x/darshan-module share/darshan-mmap-epilog.sh share/ld-opts/darshan-base-ld-opts share/mpi-profile/darshan-bg-cc.conf share/mpi-profile/darshan-bg-cxx.conf share/mpi-profile/darshan-bg-f.conf share/mpi-profile/darshan-cc.conf share/mpi-profile/darshan-cxx.conf share/mpi-profile/darshan-f.conf aclocal.m4 autom4te.cache/* config.status config.log Makefile
279
	rm -rf autom4te.cache