Makefile.in 3.52 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
all: lib/libdarshan-posix.a lib/libdarshan-mpi-io.a 

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@
DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h

ifndef DISABLE_LDPRELOAD
all: lib/libdarshan.so 
endif

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@

lib::
	@mkdir -p $@

35
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
36 37
	$(CC) $(CFLAGS) -c $< -o $@

38 39 40 41 42 43 44
lib/darshan-mpi-io.po: lib/darshan-mpi-io.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

lib/darshan-mpi-init-finalize.o: lib/darshan-mpi-init-finalize.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
	$(CC) $(CFLAGS) -c $< -o $@

lib/darshan-mpi-init-finalize.po: lib/darshan-mpi-init-finalize.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
45 46 47 48 49 50 51 52 53
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

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

lib/darshan-pnetcdf.po: lib/darshan-pnetcdf.c darshan.h $(DARSHAN_LOG_FORMAT) | lib 
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
54
	$(CC) $(CFLAGS) -c $< -o $@
55 56

lib/darshan-hdf5.po: lib/darshan-hdf5.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
57
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
58 59

lib/darshan-posix.o: lib/darshan-posix.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
60
	$(CC) $(CFLAGS) -c $< -o $@
61 62

lib/darshan-posix.po: lib/darshan-posix.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
63
	$(CC) $(CFLAGS_SHARED) -c $< -o $@
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79

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

lib/lookup3.po: lib/lookup3.c
	$(CC) $(CFLAGS_SHARED) -c $< -o $@

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

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

%.i: %.c
	$(CC) -E $(CFLAGS) -c $< -o $@

80
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-mpi-init-finalize.o lib/darshan-pnetcdf.o lib/darshan-hdf5.o
81 82 83 84 85
	ar rcs $@ $^

lib/libdarshan-posix.a: lib/darshan-posix.o lib/lookup3.o lib/lookup8.o
	ar rcs $@ $^

86
lib/libdarshan.so: lib/darshan-mpi-io.po lib/darshan-mpi-init-finalize.po lib/darshan-pnetcdf.po lib/darshan-hdf5.po lib/darshan-posix.po lib/lookup3.po lib/lookup8.po
Philip Carns's avatar
Philip Carns committed
87
	$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -ldl -o $@ $^ -lpthread -lrt -lz
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107

install:: all
	install -d $(libdir)
	install -m 755 lib/libdarshan-posix.a $(libdir)
	install -m 755 lib/libdarshan-mpi-io.a $(libdir)
ifndef DISABLE_LDPRELOAD
	install -m 755 lib/libdarshan.so $(libdir)
endif
	install -d $(bindir)
	install -m 755 darshan-mk-log-dirs.pl $(bindir)
	install -m 755 darshan-gen-cc.pl $(bindir)
	install -m 755 darshan-gen-cxx.pl $(bindir)
	install -m 755 darshan-gen-fortran.pl $(bindir)

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

distclean:: clean
	rm -f darshan-runtime-config.h darshan-gen-cxx.pl darshan-gen-fortran.pl darshan-gen-cc.pl darshan-mk-log-dirs.pl aclocal.m4 autom4te.cache/* config.status config.log Makefile 
	rm -rf autom4te.cache