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

ifndef DISABLE_LDPRELOAD
all: lib/libdarshan.so 
endif
6 7 8 9 10

DESTDIR =
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
11
datarootdir = $(DESTDIR)@datarootdir@
12 13 14 15 16 17
includedir = $(DESTDIR)@includedir@
mandir = $(DESTDIR)@mandir@
sbindir = $(DESTDIR)@sbindir@
bindir = $(DESTDIR)@bindir@
libdir = $(DESTDIR)@libdir@

18 19
DISABLE_LDPRELOAD = @DISABLE_LDPRELOAD@

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
lib::
37
	@mkdir -p $@
38 39 40 41

mktestdir::
	mkdir -p test

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

darshan-parser: darshan-parser.c darshan.h darshan-log-format.h darshan-logutils.h darshan-logutils.o | uthash-1.9.2
46
	gcc $(CFLAGS) -lz $< darshan-logutils.o -o $@
47

48
darshan-analyzer: darshan-analyzer.c darshan.h darshan-log-format.h darshan-logutils.h darshan-logutils.o
49
	gcc $(CFLAGS) -lz $< darshan-logutils.o -o $@
50

51 52 53
darshan-log-params: darshan-log-params.c darshan-log-format.h
	gcc $(CFLAGS) -lz $< -o $@

54 55 56 57 58 59 60 61 62 63 64 65 66
darshan-diff: darshan-diff.o darshan.h darshan-log-format.h darshan-logutils.o darshan-logutils.h
	gcc $(CFLAGS) -lz $< darshan-logutils.o -o $@
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 $@

67
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h darshan-log-format.h | lib
68
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
69

70 71 72
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 $@

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

76 77 78
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 $@

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

82 83 84
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 $@

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

88 89 90
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 $@

91 92
lib/lookup3.o: lib/lookup3.c
	$(CC) $(CFLAGS_MPI) -c $< -o $@
93

94 95 96
lib/lookup3.po: lib/lookup3.c
	$(CC) $(CFLAGS_MPI_SHARED) -c $< -o $@

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

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

103
%.i: %.c
104
	$(CC) -E $(CFLAGS_MPI) -c $< -o $@
105

106
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-pnetcdf.o lib/darshan-hdf5.o
107 108 109 110 111
	ar rcs $@ $^

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

112
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
113
	$(CC) $(CFLAGS_MPI_SHARED) -ldl -o $@ $^ -lpthread -lrt -lz
114

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

139 140

clean::
141
	rm -f *.o *.a lib/*.o lib/*.po lib/*.a lib/*.so darshan-parser darshan-diff darshan-analyzer darshan-log-params
142 143

distclean:: clean
144
	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
145
	rm -f compilers/*-V1R4 compilers/fast/*-V1R4 compilers/*-pcarns
146
	rm -rf uthash-1.9.2
147
	rm -rf autom4te.cache