1 CC = gcc 2 CFLAGS = -Wall -O2 -g -W -Wunused-result 3 ALL_CFLAGS = $(CFLAGS) -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 4 5 PROGS = iowatcher 6 INSTALL = install 7 prefix = /usr/local 8 bindir = $(prefix)/bin 9 10 export prefix INSTALL 11 12 ALL = $(PROGS) 13 14 $(PROGS): | depend 15 16 all: $(ALL) 17 18 %.o: %.c 19 $(CC) -o $*.o -c $(ALL_CFLAGS) $< 20 21 iowatcher: blkparse.o plot.o main.o tracers.o mpstat.o fio.o 22 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) -lm -lrt 23 24 depend: 25 @$(CC) -MM $(ALL_CFLAGS) *.c 1> .depend 26 27 clean: 28 -rm -f *.o $(PROGS) .depend 29 30 install: all 31 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) 32 $(INSTALL) -m 755 $(ALL) $(DESTDIR)$(bindir) 33 34 ifneq ($(wildcard .depend),) 35 include .depend 36 endif 37 38