1 CC = gcc 2 CFLAGS = -Wall -O2 -g -W 3 ALL_CFLAGS = $(CFLAGS) -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 4 PROGS = blkparse blktrace verify_blkparse blkrawverify blkiomon 5 LIBS = -lpthread 6 SCRIPTS = btrace 7 8 ALL = $(PROGS) $(SCRIPTS) btt/btt btreplay/btrecord btreplay/btreplay \ 9 btt/bno_plot.py 10 11 all: $(ALL) 12 13 btt/btt: 14 $(MAKE) -C btt 15 16 btreplay/btrecord: 17 $(MAKE) -C btreplay 18 19 btreplay/btreplay: 20 $(MAKE) -C btreplay 21 22 %.o: %.c 23 $(CC) -o $*.o -c $(ALL_CFLAGS) $< 24 25 blkparse: blkparse.o blkparse_fmt.o rbtree.o act_mask.o 26 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) 27 28 blktrace: blktrace.o act_mask.o 29 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) 30 31 verify_blkparse: verify_blkparse.o 32 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) 33 34 blkrawverify: blkrawverify.o 35 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) 36 37 blkiomon: blkiomon.o rbtree.o 38 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) -lrt 39 40 $(PROGS): | depend 41 42 docs: 43 $(MAKE) -C doc all 44 $(MAKE) -C btt docs 45 $(MAKE) -C btreplay docs 46 47 docsclean: 48 $(MAKE) -C doc clean 49 $(MAKE) -C btt clean 50 $(MAKE) -C btreplay clean 51 52 depend: 53 @$(CC) -MM $(ALL_CFLAGS) *.c 1> .depend 54 55 INSTALL = install 56 prefix = /usr/local 57 bindir = $(prefix)/bin 58 mandir = $(prefix)/man 59 RPMBUILD = rpmbuild 60 TAR = tar 61 62 export prefix INSTALL TAR 63 64 dist: btrace.spec 65 git-tar-tree HEAD btrace-1.0 > btrace-1.0.tar 66 @mkdir -p btrace-1.0 67 @cp btrace.spec btrace-1.0 68 $(TAR) rf btrace-1.0.tar btrace-1.0/btrace.spec 69 @rm -rf btrace-1.0 70 @bzip2 btrace-1.0.tar 71 72 rpm: dist 73 $(RPMBUILD) -ta btrace-1.0.tar.bz2 74 75 clean: docsclean 76 -rm -f *.o $(PROGS) .depend btrace-1.0.tar.bz2 77 $(MAKE) -C btt clean 78 $(MAKE) -C btreplay clean 79 80 install: all 81 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) 82 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 83 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8 84 $(INSTALL) -m 755 $(ALL) $(DESTDIR)$(bindir) 85 $(INSTALL) -m 644 doc/*.1 $(DESTDIR)$(mandir)/man1 86 $(INSTALL) -m 644 doc/*.8 $(DESTDIR)$(mandir)/man8 87 88 ifneq ($(wildcard .depend),) 89 include .depend 90 endif 91