Makefile.in 10.6 KB
Newer Older
1
all: lib/libdarshan.a lib/libdarshan-stubs.a lib/darshan-null.o
2

3 4
#TODO: each module provides own makefile with module-specific objects, build options, etc.

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
DESTDIR =
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = $(DESTDIR)@datarootdir@
includedir = $(DESTDIR)@includedir@
mandir = $(DESTDIR)@mandir@
sbindir = $(DESTDIR)@sbindir@
bindir = $(DESTDIR)@bindir@
libdir = $(DESTDIR)@libdir@
LDFLAGS = @LDFLAGS@
CC = @CC@
LD = @LD@

DISABLE_LDPRELOAD = @DISABLE_LDPRELOAD@
20
ENABLE_MMAP_LOGS = @ENABLE_MMAP_LOGS@
21
DARSHAN_USE_BGQ = @DARSHAN_USE_BGQ@
22
DARSHAN_USE_LUSTRE = @DARSHAN_USE_LUSTRE@
23
DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h
24
DARSHAN_VERSION = @DARSHAN_VERSION@
25

26
ifndef DISABLE_LDPRELOAD
27
all: lib/libdarshan.so lib/darshan-null.po
28
endif
29

30 31 32 33 34 35 36 37
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@

38
BUILD_HDF5_MODULE = @BUILD_HDF5_MODULE@
39
BUILD_MDHIM_MODULE = @BUILD_MDHIM_MODULE@
40 41 42 43 44 45 46 47

DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-pnetcdf.o lib/darshan-stdio.o lib/darshan-dxt.o
DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-pnetcdf.po lib/darshan-stdio.po lib/darshan-dxt.po

ifdef BUILD_HDF5_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-hdf5.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-hdf5.po
endif
48 49

ifdef DARSHAN_USE_BGQ
50 51
DARSHAN_STATIC_MOD_OBJS += lib/darshan-bgq.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-bgq.po
52 53
CFLAGS += -DDARSHAN_BGQ
CFLAGS_SHARED += -DDARSHAN_BGQ
54 55
endif

56 57 58 59 60 61 62
ifdef DARSHAN_USE_LUSTRE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-lustre.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-lustre.po
CFLAGS += -DDARSHAN_LUSTRE
CFLAGS_SHARED += -DDARSHAN_LUSTRE
endif

63 64 65 66 67 68 69
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

70 71 72
lib::
	@mkdir -p $@

73
lib/darshan-core-init-finalize.o: lib/darshan-core-init-finalize.c darshan.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
74 75
	$(CC) $(CFLAGS) -c $< -o $@

76
lib/darshan-core-init-finalize.po: lib/darshan-core-init-finalize.c darshan.h darshan-dynamic.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
77 78 79 80 81
	$(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 $@

82
lib/darshan-core.po: lib/darshan-core.c darshan.h darshan-dynamic.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
83 84
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

85
lib/darshan-common.o: lib/darshan-common.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) | lib
86 87
	$(CC) $(CFLAGS) -c $< -o $@

88
lib/darshan-common.po: lib/darshan-common.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) | lib
89 90
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

91
lib/darshan-null.o: lib/darshan-null.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-null-log-format.h | lib
92
	$(CC) $(CFLAGS) -c $< -o $@
93

94
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
95
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
96

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

100
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
101 102
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

103
lib/darshan-mpiio.o: lib/darshan-mpiio.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h | lib
104 105
	$(CC) $(CFLAGS) -c $< -o $@

106
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
107 108
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

109
lib/darshan-bgq.o: lib/darshan-bgq.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h | lib
110 111
	$(CC) $(CFLAGS) -c $< -o $@

112
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
113 114
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

115
lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-hdf5-log-format.h | lib
116 117
	$(CC) $(CFLAGS) -c $< -o $@

118
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
119 120
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

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

124
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-pnetcdf-log-format.h | lib
125 126
	$(CC) $(CFLAGS) -c $< -o $@

127
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
128 129
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

130 131
lib/darshan-pnetcdf-stubs.o: lib/darshan-pnetcdf-stubs.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
	$(CC) $(CFLAGS) -c $< -o $@
132

133
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
134 135
	$(CC) $(CFLAGS) -c $< -o $@

136
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
137 138
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

Shane Snyder's avatar
Shane Snyder committed
139
lib/darshan-stdio.o: lib/darshan-stdio.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-stdio-log-format.h | lib
140
	$(CC) $(CFLAGS) -c $< -o $@
141

Shane Snyder's avatar
Shane Snyder committed
142 143 144
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 $@

145
lib/darshan-dxt.o: lib/darshan-dxt.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | lib
146 147
	$(CC) $(CFLAGS) -c $< -o $@

148
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
149 150
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

151 152 153 154 155 156 157
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 $@


158 159 160
lib/lookup3.o: lib/lookup3.c
	$(CC) $(CFLAGS) -c $< -o $@

161 162
lib/lookup3.po: lib/lookup3.c
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
163 164 165 166

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

167 168
lib/lookup8.po: lib/lookup8.c
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
169

170
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
171 172
	ar rcs $@ $^

173
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
174
	$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $@ $^ -lpthread -lrt -lz -ldl
175

176
ifdef BUILD_HDF5_MODULE
177 178
lib/libdarshan-stubs.a: lib/darshan-hdf5-stubs.o lib/darshan-pnetcdf-stubs.o
	ar rcs $@ $^
179 180 181 182
else
lib/libdarshan-stubs.a: lib/darshan-pnetcdf-stubs.o
	ar rcs $@ $^
endif
183

184 185 186

install:: all
	install -d $(libdir)
187
	install -m 755 lib/libdarshan.a $(libdir)
188
	install -m 755 lib/libdarshan-stubs.a $(libdir)
189 190 191
ifndef DISABLE_LDPRELOAD
	install -m 755 lib/libdarshan.so $(libdir)
endif
192
	install -d $(bindir)
193
	install -m 755 darshan-mk-log-dirs.pl $(bindir)
194
	install -m 755 darshan-gen-cc.pl $(bindir)
195 196
	install -m 755 darshan-gen-cxx.pl $(bindir)
	install -m 755 darshan-gen-fortran.pl $(bindir)
197
	install -m 755 darshan-config $(bindir)
198 199 200 201 202 203 204 205 206 207 208
	install -d $(datarootdir)/craype-1.x/modulefiles/darshan
	install -m 755 share/craype-1.x/darshan-module $(datarootdir)/craype-1.x/modulefiles/darshan/$(DARSHAN_VERSION)
	install -d $(datarootdir)/craype-2.x/modulefiles/darshan
	install -m 755 share/craype-2.x/darshan-module $(datarootdir)/craype-2.x/modulefiles/darshan/$(DARSHAN_VERSION)
	install -d $(datarootdir)/mpi-profile
	install -m 755 share/mpi-profile/darshan-cc.conf $(datarootdir)/mpi-profile/darshan-cc.conf
	install -m 755 share/mpi-profile/darshan-cxx.conf $(datarootdir)/mpi-profile/darshan-cxx.conf
	install -m 755 share/mpi-profile/darshan-f.conf $(datarootdir)/mpi-profile/darshan-f.conf
	install -m 755 share/mpi-profile/darshan-bg-cc.conf $(datarootdir)/mpi-profile/darshan-bg-cc.conf
	install -m 755 share/mpi-profile/darshan-bg-cxx.conf $(datarootdir)/mpi-profile/darshan-bg-cxx.conf
	install -m 755 share/mpi-profile/darshan-bg-f.conf $(datarootdir)/mpi-profile/darshan-bg-f.conf
209 210
	install -d $(datarootdir)/ld-opts
	install -m 644 share/ld-opts/darshan-base-ld-opts $(datarootdir)/ld-opts/darshan-base-ld-opts
211
	install -m 644 $(srcdir)/share/ld-opts/darshan-posix-ld-opts $(datarootdir)/ld-opts/darshan-posix-ld-opts
212
ifdef BUILD_HDF5_MODULE
213
	install -m 644 $(srcdir)/share/ld-opts/darshan-hdf5-ld-opts $(datarootdir)/ld-opts/darshan-hdf5-ld-opts
214 215 216
endif
ifdef BUILD_MDHIM_MODULE
	install -m 644 $(srcdir)/share/ld-opts/darshan-mdhim-ld-opts $(datarootdir)/ld-opts/darshan-mdhim-ld-opts
217
endif
218
	install -m 644 $(srcdir)/share/ld-opts/darshan-pnetcdf-ld-opts $(datarootdir)/ld-opts/darshan-pnetcdf-ld-opts
219
	install -m 644 $(srcdir)/share/ld-opts/darshan-stdio-ld-opts $(datarootdir)/ld-opts/darshan-stdio-ld-opts
220
	install -m 644 $(srcdir)/share/ld-opts/darshan-mpiio-ld-opts $(datarootdir)/ld-opts/darshan-mpiio-ld-opts
221 222 223
ifdef ENABLE_MMAP_LOGS
	install -m 755 share/darshan-mmap-epilog.sh $(datarootdir)/darshan-mmap-epilog.sh
endif
224 225
	install -d $(libdir)/pkgconfig
	install -m 644 lib/pkgconfig/darshan-runtime.pc $(libdir)/pkgconfig/darshan-runtime.pc
226 227 228 229 230

clean::
	rm -f *.o *.a lib/*.o lib/*.po lib/*.a lib/*.so 

distclean:: clean
231
	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 
232
	rm -rf autom4te.cache