Fio 1.50-rc4
[fio.git] / Makefile
1 CC      = gcc
2 DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
3 CPPFLAGS= -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
4         $(DEBUGFLAGS)
5 OPTFLAGS= -O2 -fno-omit-frame-pointer -g $(EXTFLAGS)
6 CFLAGS  = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS) -rdynamic
7 LIBS    = -lpthread -lm -ldl -lrt -laio
8 PROGS   = fio
9 SCRIPTS = fio_generate_plots
10         
11 SOURCE = gettime.c fio.c ioengines.c init.c stat.c log.c time.c filesetup.c \
12         eta.c verify.c memory.c io_u.c parse.c mutex.c options.c rbtree.c \
13         diskutil.c fifo.c blktrace.c smalloc.c filehash.c helpers.c \
14         cgroup.c profile.c debug.c trim.c lib/rand.c lib/flist_sort.c \
15         lib/num2str.c $(wildcard crc/*.c) engines/cpu.c engines/libaio.c \
16         engines/mmap.c engines/posixaio.c engines/sg.c engines/splice.c \
17         engines/sync.c engines/null.c engines/net.c engines/syslet-rw.c \
18         engines/guasi.c engines/binject.c profiles/tiobench.c
19         
20 OBJS = $(SOURCE:.c=.o)
21
22 ifneq ($(findstring $(MAKEFLAGS),s),s)
23 ifndef V
24         QUIET_CC        = @echo '   ' CC $@;
25         QUIET_DEP       = @echo '   ' DEP $@;
26 endif
27 endif
28
29 INSTALL = install
30 prefix = /usr/local
31 bindir = $(prefix)/bin
32 mandir = $(prefix)/man
33
34 .c.o:
35         $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
36         
37 fio: $(OBJS)
38         $(QUIET_CC)$(CC) $(CFLAGS) -o $@ $(LIBS) $(OBJS)
39
40 depend:
41         $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend
42
43 $(PROGS): depend
44
45 all: depend $(PROGS) $(SCRIPTS)
46
47 clean:
48         -rm -f .depend $(OBJS) $(PROGS) core.* core
49
50 cscope:
51         @cscope -b -R
52
53 install: $(PROGS) $(SCRIPTS)
54         $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
55         $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
56         $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
57         $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1
58         $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1
59
60 ifneq ($(wildcard .depend),)
61 include .depend
62 endif