Makefile.in 3.53 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

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@
13
buildlib = lib
14 15 16 17

VPATH = $(srcdir)

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

21 22 23 24
# 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

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

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

35 36
${buildlib}/::
	@mkdir -p $@
37 38 39 40

mktestdir::
	mkdir -p test

41
darshan-parser: darshan-parser.c darshan.h darshan-log-format.h darshan-logutils.h darshan-logutils.o
42
	gcc $(CFLAGS) -lz $< darshan-logutils.o -o $@
43

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

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

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

63
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h darshan-log-format.h | ${buildlib}/
64
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
65

66
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h darshan-log-format.h | ${buildlib}/
67
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
68

69
lib/darshan-hdf5.o: lib/darshan-hdf5.c darshan.h darshan-log-format.h | ${buildlib}/
70
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
71

72
lib/darshan-posix.o: lib/darshan-posix.c darshan.h darshan-log-format.h | ${buildlib}/
73
	$(CC) $(cp_zlib_include_flags) $(CFLAGS_MPI) -c $< -o $@
74

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

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

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

84
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-pnetcdf.o lib/darshan-hdf5.o
85 86 87 88 89 90 91 92 93 94 95
	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)
96
	install -m 755 darshan-diff $(bindir)
97
	install -m 755 darshan-analyzer $(bindir)
98
	install -m 755 darshan-mk-log-dirs.pl $(bindir)
99
	install -m 755 darshan-gen-cc.pl $(bindir)
Philip Carns's avatar
Philip Carns committed
100
	install -m 755 darshan-gen-cxx.pl $(bindir)
101
	install -m 755 darshan-gen-fortran.pl $(bindir)
102 103

clean::
Philip Carns's avatar
Philip Carns committed
104
	rm -f *.o *.a lib/*.o lib/*.a darshan-parser darshan-diff darshan-analyzer darshan-log-params
105 106 107

distclean:: clean
	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
108
	rm -f compilers/*-V1R4 compilers/fast/*-V1R4 compilers/*-pcarns
109
	rmdir autom4te.cache