Makefile.in 5.27 KB
Newer Older
1
all: lib/libdarshan-posix.a lib/libdarshan-mpi-io.a darshan-parser darshan-convert darshan-diff darshan-analyzer darshan-log-params
2

3 4 5 6
DESTDIR =
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
7
datarootdir = $(DESTDIR)@datarootdir@
8 9 10 11 12 13
includedir = $(DESTDIR)@includedir@
mandir = $(DESTDIR)@mandir@
sbindir = $(DESTDIR)@sbindir@
bindir = $(DESTDIR)@bindir@
libdir = $(DESTDIR)@libdir@

14 15
DISABLE_LDPRELOAD = @DISABLE_LDPRELOAD@

16 17 18 19
ifndef DISABLE_LDPRELOAD
all: lib/libdarshan.so 
endif

20 21
VPATH = $(srcdir)

22 23
cp_zlib_link_flags = @__CP_ZLIB_LINK_FLAGS@
cp_zlib_include_flags = @__CP_ZLIB_INCLUDE_FLAGS@
24

25 26
# deliberately avoid large file support for host side utilities to avoid
# potentially buggy libz 64 bit offset support
27
CFLAGS = -I . -I $(srcdir) @CFLAGS@ @CPPFLAGS@ 
28

29
CFLAGS_MPI = -I . -I $(srcdir) @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE 
30

31
CFLAGS_MPI_SHARED = -I . -I $(srcdir) @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE -shared -fpic -DPIC -DDARSHAN_PRELOAD
32

33 34 35
CC=@MPICC@
LD=@MPICC@

36 37
LIBS = -lz @LIBBZ2@

38
lib::
39
	@mkdir -p $@
40 41 42 43

mktestdir::
	mkdir -p test

44
uthash-1.9.2:
45
	tar xjvf $(srcdir)/extern/uthash-1.9.2.tar.bz2
46 47

darshan-parser: darshan-parser.c darshan.h darshan-log-format.h darshan-logutils.h darshan-logutils.o | uthash-1.9.2
48
	gcc $(CFLAGS) $(LIBS) $< darshan-logutils.o -o $@
49

50
darshan-convert: darshan-convert.c darshan.h darshan-log-format.h darshan-logutils.h darshan-logutils.o | uthash-1.9.2
51
	gcc $(CFLAGS) $(LIBS) $< darshan-logutils.o -o $@
52

53
darshan-analyzer: darshan-analyzer.c darshan.h darshan-log-format.h darshan-logutils.h darshan-logutils.o
54
	gcc $(CFLAGS) $(LIBS) $< darshan-logutils.o -o $@
55

56
darshan-log-params: darshan-log-params.c darshan-log-format.h
57
	gcc $(CFLAGS) $(LIBS) $< -o $@
58

59
darshan-diff: darshan-diff.o darshan.h darshan-log-format.h darshan-logutils.o darshan-logutils.h
60
	gcc $(CFLAGS) $(LIBS) $< darshan-logutils.o -o $@
61 62 63 64 65 66 67 68 69 70 71
darshan-diff.o: darshan-diff.c
	gcc $(CFLAGS) -c  $< -o $@
darshan-logutils.o: darshan-logutils.c
	gcc $(CFLAGS) -c  $< -o $@

test/gztest: test/gztest.c mktestdir
	gcc $(CFLAGS) -lz $< -o $@

test/gz-bench: test/gz-bench.c mktestdir
	gcc $(CFLAGS) -lz $< -o $@

72
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h darshan-log-format.h | lib
73
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
74

75 76 77
lib/darshan-mpi-io.po: lib/darshan-mpi-io.c darshan.h darshan-log-format.h | lib
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI_SHARED) -c $< -o $@

78
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h darshan-log-format.h | lib 
79
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
80

81 82 83
lib/darshan-pnetcdf.po: lib/darshan-pnetcdf.c darshan.h darshan-log-format.h | lib 
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI_SHARED) -c $< -o $@

84
lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h darshan-log-format.h | lib
85
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
86

87 88 89
lib/darshan-hdf5.po: lib/darshan-hdf5.c darshan.h darshan-log-format.h | lib
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI_SHARED) -c $< -o $@

90
lib/darshan-posix.o: lib/darshan-posix.c darshan.h darshan-log-format.h | lib
91
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
92

93 94 95
lib/darshan-posix.po: lib/darshan-posix.c darshan.h darshan-log-format.h | lib
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI_SHARED) -c $< -o $@

96 97
lib/lookup3.o: lib/lookup3.c
	$(CC) $(CFLAGS_MPI) -c $< -o $@
98

99 100 101
lib/lookup3.po: lib/lookup3.c
	$(CC) $(CFLAGS_MPI_SHARED) -c $< -o $@

102 103
lib/lookup8.o: lib/lookup8.c
	$(CC) $(CFLAGS_MPI) -c $< -o $@
104

105 106 107
lib/lookup8.po: lib/lookup8.c
	$(CC) $(CFLAGS_MPI_SHARED) -c $< -o $@

108
%.i: %.c
109
	$(CC) -E $(CFLAGS_MPI) -c $< -o $@
110

111
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-pnetcdf.o lib/darshan-hdf5.o
112 113 114 115 116
	ar rcs $@ $^

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

117
lib/libdarshan.so: lib/darshan-mpi-io.po lib/darshan-pnetcdf.po lib/darshan-hdf5.po lib/darshan-posix.po lib/lookup3.po lib/lookup8.po
118
	$(CC) $(CFLAGS_MPI_SHARED) -ldl -o $@ $^ -lpthread -lrt -lz
119

120 121 122 123
install:: all
	install -d $(libdir)
	install -m 755 lib/libdarshan-posix.a $(libdir)
	install -m 755 lib/libdarshan-mpi-io.a $(libdir)
124
ifndef DISABLE_LDPRELOAD
125
	install -m 755 lib/libdarshan.so $(libdir)
126
endif
127 128
	install -d $(bindir)
	install -m 755 darshan-parser $(bindir)
129
	install -m 755 darshan-convert $(bindir)
130
	install -m 755 darshan-diff $(bindir)
131
	install -m 755 darshan-analyzer $(bindir)
132
	install -m 755 darshan-mk-log-dirs.pl $(bindir)
133
	install -m 755 darshan-gen-cc.pl $(bindir)
Philip Carns's avatar
Philip Carns committed
134
	install -m 755 darshan-gen-cxx.pl $(bindir)
135
	install -m 755 darshan-gen-fortran.pl $(bindir)
136 137
	install -m 755 util/bin/darshan-job-summary.pl $(bindir)
	install -d $(libdir)/TeX
138
	install -m 644 $(srcdir)/util/lib/TeX/Encode.pm $(libdir)/TeX/
139 140
	install -d $(libdir)/Number
	install -d $(libdir)/Number/Bytes
141
	install -m 644 $(srcdir)/util/lib/Number/Bytes/Human.pm $(libdir)/Number/Bytes
142
	install -d $(datarootdir)
143
	install -m 644 $(srcdir)/util/share/* $(datarootdir)
144

145 146

clean::
147
	rm -f *.o *.a lib/*.o lib/*.po lib/*.a lib/*.so darshan-parser darshan-convert darshan-diff darshan-analyzer darshan-log-params
148 149

distclean:: clean
150
	rm -f darshan-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 util/bin/darshan-job-summary.pl
151
	rm -f compilers/*-V1R4 compilers/fast/*-V1R4 compilers/*-pcarns
152
	rm -rf uthash-1.9.2
153
	rm -rf autom4te.cache