Makefile.in 8.08 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
DARSHAN_USE_BGQ = @DARSHAN_USE_BGQ@
21
DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h
22
DARSHAN_VERSION = @DARSHAN_VERSION@
23

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

28 29 30 31 32 33 34 35
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@

36 37
DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o
DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po
38

39 40 41 42
# TODO: make the lustre module enabled using config options
DARSHAN_STATIC_MOD_OBJS += lib/darshan-lustre.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-lustre.po

43
ifdef DARSHAN_USE_BGQ
44 45
DARSHAN_STATIC_MOD_OBJS += lib/darshan-bgq.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-bgq.po
46 47
CFLAGS += -DDARSHAN_BGQ
CFLAGS_SHARED += -DDARSHAN_BGQ
48 49
endif

50 51 52
lib::
	@mkdir -p $@

53
lib/darshan-core-init-finalize.o: lib/darshan-core-init-finalize.c darshan.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
54 55
	$(CC) $(CFLAGS) -c $< -o $@

56
lib/darshan-core-init-finalize.po: lib/darshan-core-init-finalize.c darshan.h darshan-dynamic.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
57 58 59 60 61
	$(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 $@

62
lib/darshan-core.po: lib/darshan-core.c darshan.h darshan-dynamic.h darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
63 64
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

65
lib/darshan-common.o: lib/darshan-common.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) | lib
66 67
	$(CC) $(CFLAGS) -c $< -o $@

68
lib/darshan-common.po: lib/darshan-common.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) | lib
69 70
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

71
lib/darshan-null.o: lib/darshan-null.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-null-log-format.h | lib
72
	$(CC) $(CFLAGS) -c $< -o $@
73

74
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
75
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
76

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

80
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
81 82
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

83
lib/darshan-mpiio.o: lib/darshan-mpiio.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h | lib
84 85
	$(CC) $(CFLAGS) -c $< -o $@

86
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
87 88
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

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

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

95
lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-hdf5-log-format.h | lib
96 97
	$(CC) $(CFLAGS) -c $< -o $@

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

101 102 103
lib/darshan-hdf5-stubs.o: lib/darshan-hdf5-stubs.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
	$(CC) $(CFLAGS) -c $< -o $@

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

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

110 111
lib/darshan-pnetcdf-stubs.o: lib/darshan-pnetcdf-stubs.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
	$(CC) $(CFLAGS) -c $< -o $@
112

113 114 115
lib/darshan-lustre.o: lib/darshan-lustre.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-lustre-log-format.h | lib
	$(CC) $(CFLAGS) -c $< -o $@

Shane Snyder's avatar
Shane Snyder committed
116
lib/darshan-lustre.po: lib/darshan-lustre.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-lustre-log-format.h | lib
117 118
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

119 120 121
lib/lookup3.o: lib/lookup3.c
	$(CC) $(CFLAGS) -c $< -o $@

122 123
lib/lookup3.po: lib/lookup3.c
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
124 125 126 127

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

128 129
lib/lookup8.po: lib/lookup8.c
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
130

131
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
132 133
	ar rcs $@ $^

134
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
135
	$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $@ $^ -lpthread -lrt -lz -ldl
136

137 138 139
lib/libdarshan-stubs.a: lib/darshan-hdf5-stubs.o lib/darshan-pnetcdf-stubs.o
	ar rcs $@ $^

140 141 142

install:: all
	install -d $(libdir)
143
	install -m 755 lib/libdarshan.a $(libdir)
144
	install -m 755 lib/libdarshan-stubs.a $(libdir)
145 146 147
ifndef DISABLE_LDPRELOAD
	install -m 755 lib/libdarshan.so $(libdir)
endif
148
	install -d $(bindir)
149
	install -m 755 darshan-mk-log-dirs.pl $(bindir)
150
	install -m 755 darshan-gen-cc.pl $(bindir)
151 152
	install -m 755 darshan-gen-cxx.pl $(bindir)
	install -m 755 darshan-gen-fortran.pl $(bindir)
153
	install -m 755 darshan-config $(bindir)
154 155 156 157 158 159 160 161 162 163 164
	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
165 166
	install -d $(datarootdir)/ld-opts
	install -m 644 share/ld-opts/darshan-base-ld-opts $(datarootdir)/ld-opts/darshan-base-ld-opts
167 168 169
	install -m 644 $(srcdir)/share/ld-opts/darshan-posix-ld-opts $(datarootdir)/ld-opts/darshan-posix-ld-opts
	install -m 644 $(srcdir)/share/ld-opts/darshan-hdf5-ld-opts $(datarootdir)/ld-opts/darshan-hdf5-ld-opts
	install -m 644 $(srcdir)/share/ld-opts/darshan-pnetcdf-ld-opts $(datarootdir)/ld-opts/darshan-pnetcdf-ld-opts
170 171
	install -d $(libdir)/pkgconfig
	install -m 644 lib/pkgconfig/darshan-runtime.pc $(libdir)/pkgconfig/darshan-runtime.pc
172 173 174 175 176

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

distclean:: clean
177
	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 darshan-base-ld-opts aclocal.m4 autom4te.cache/* config.status config.log Makefile 
178
	rm -rf autom4te.cache