• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1CC	= gcc
2CFLAGS	= -Wall -O2 -g -W
3ALL_CFLAGS = $(CFLAGS) -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
4PROGS	= blkparse blktrace verify_blkparse blkrawverify blkiomon
5LIBS	= -lpthread
6SCRIPTS	= btrace
7
8ALL = $(PROGS) $(SCRIPTS) btt/btt btreplay/btrecord btreplay/btreplay \
9      btt/bno_plot.py iowatcher/iowatcher
10
11all: $(ALL)
12
13btt/btt:
14	$(MAKE) -C btt
15
16iowatcher/iowatcher:
17	$(MAKE) -C iowatcher
18
19btreplay/btrecord:
20	$(MAKE) -C btreplay
21
22btreplay/btreplay:
23	$(MAKE) -C btreplay
24
25%.o: %.c
26	$(CC) -o $*.o -c $(ALL_CFLAGS) $<
27
28blkparse: blkparse.o blkparse_fmt.o rbtree.o act_mask.o
29	$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^)
30
31blktrace: blktrace.o act_mask.o
32	$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
33
34verify_blkparse: verify_blkparse.o
35	$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^)
36
37blkrawverify: blkrawverify.o
38	$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^)
39
40blkiomon: blkiomon.o rbtree.o
41	$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) -lrt
42
43$(PROGS): | depend
44
45docs:
46	$(MAKE) -C doc all
47	$(MAKE) -C btt docs
48	$(MAKE) -C btreplay docs
49
50docsclean:
51	$(MAKE) -C doc clean
52	$(MAKE) -C btt clean
53	$(MAKE) -C btreplay clean
54
55depend:
56	@$(CC) -MM $(ALL_CFLAGS) *.c 1> .depend
57
58INSTALL = install
59prefix = /usr/local
60bindir = $(prefix)/bin
61mandir = $(prefix)/man
62RPMBUILD = rpmbuild
63TAR = tar
64
65export prefix INSTALL TAR
66
67dist: 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
75rpm: dist
76	$(RPMBUILD) -ta btrace-1.0.tar.bz2
77
78clean: 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
84install: 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
92ifneq ($(wildcard .depend),)
93include .depend
94endif
95