Makefile.in 3.97 KB
Newer Older
1
all: checkpath lib/libdarshan-posix.a lib/libdarshan-mpi-io.a darshan-parser darshan-diff darshan-analyzer darshan-log-params
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

DESTDIR =
srcdir = @srcdir@
prefix = @prefix@
datarootdir = @datarootdir@
exec_prefix = @exec_prefix@
includedir = $(DESTDIR)@includedir@
mandir = $(DESTDIR)@mandir@
sbindir = $(DESTDIR)@sbindir@
bindir = $(DESTDIR)@bindir@
libdir = $(DESTDIR)@libdir@

VPATH = $(srcdir)

darshan_lib_path = @darshan_lib_path@
17 18
cp_zlib_link_flags = @__CP_ZLIB_LINK_FLAGS@
cp_zlib_include_flags = @__CP_ZLIB_INCLUDE_FLAGS@
19

20 21 22 23
# deliberately avoid large file support for host side utilities to avoid
# potentially buggy libz 64 bit offset support
CFLAGS = -I . -I $(srcdir) @CFLAGS@ @CPPFLAGS@ -Wall

24
CFLAGS_MPI = -I . -I $(srcdir) @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE -Wall
25 26 27 28 29 30 31 32 33
CC=@MPICC@
LD=@MPICC@

checkpath::
ifneq ($(darshan_lib_path),$(libdir)) 
	@echo "Error: <libdir> must match <prefix>/lib, don't use --libdir!"
	@exit 1
endif

34
mklibdir::
35
	@mkdir -p $@
36 37 38 39

mktestdir::
	mkdir -p test

40 41 42 43
uthash-1.9.2:
	tar xjvf extern/uthash-1.9.2.tar.bz2

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

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

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

52 53 54 55 56 57 58 59 60 61 62 63 64
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 $@

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

68
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h darshan-log-format.h | mklibdir 
69
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
70

71
lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h darshan-log-format.h | mklibdir
72
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
73

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

77 78
lib/lookup3.o: lib/lookup3.c
	$(CC) $(CFLAGS_MPI) -c $< -o $@
79

80 81
lib/lookup8.o: lib/lookup8.c
	$(CC) $(CFLAGS_MPI) -c $< -o $@
82

83 84 85
%.i: %.c
	$(CC) -E $(CFLAGS_MPI) -c $< o $@

86
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-pnetcdf.o lib/darshan-hdf5.o
87 88 89 90 91 92 93 94 95 96 97
	ar rcs $@ $^

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

install:: all
	install -d $(libdir)
	install -m 755 lib/libdarshan-posix.a $(libdir)
	install -m 755 lib/libdarshan-mpi-io.a $(libdir)
	install -d $(bindir)
	install -m 755 darshan-parser $(bindir)
98
	install -m 755 darshan-diff $(bindir)
99
	install -m 755 darshan-analyzer $(bindir)
100
	install -m 755 darshan-mk-log-dirs.pl $(bindir)
101
	install -m 755 darshan-gen-cc.pl $(bindir)
Philip Carns's avatar
Philip Carns committed
102
	install -m 755 darshan-gen-cxx.pl $(bindir)
103
	install -m 755 darshan-gen-fortran.pl $(bindir)
104 105 106 107 108 109 110 111 112
	install -m 755 util/bin/darshan-job-summary.pl $(bindir)
	install -d $(libdir)/TeX
	install -m 644 util/lib/TeX/Encode.pm $(libdir)/TeX/
	install -d $(libdir)/Number
	install -d $(libdir)/Number/Bytes
	install -m 644 util/lib/Number/Bytes/Human.pm $(libdir)/Number/Bytes
	install -d $(datarootdir)
	install -m 644 util/share/* $(datarootdir)

113 114

clean::
Philip Carns's avatar
Philip Carns committed
115
	rm -f *.o *.a lib/*.o lib/*.a darshan-parser darshan-diff darshan-analyzer darshan-log-params
116 117

distclean:: clean
118
	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
119
	rm -f compilers/*-V1R4 compilers/fast/*-V1R4 compilers/*-pcarns
120
	rm -rf uthash-1.9.2
121 122
	rm -rf autom4te.cache
	rm -rf mklibdir