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