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