Pre-load and sort random blocks for pure read verify workloads
[fio.git] / Makefile
... / ...
CommitLineData
1DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
2CPPFLAGS= -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
3 $(DEBUGFLAGS)
4OPTFLAGS= -O3 -g -ffast-math $(EXTFLAGS)
5CFLAGS = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS)
6LIBS = -lm $(EXTLIBS)
7PROGS = fio
8SCRIPTS = fio_generate_plots
9UNAME := $(shell uname)
10
11ifneq ($(wildcard config-host.mak),)
12all:
13include config-host.mak
14config-host-mak: configure
15 @echo $@ is out-of-date, running configure
16 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
17else
18config-host.mak:
19 @echo "Running configure for you..."
20 @./configure
21all:
22include config-host.mak
23endif
24
25SOURCE := gettime.c fio.c ioengines.c init.c stat.c log.c time.c filesetup.c \
26 eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \
27 rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \
28 lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \
29 engines/mmap.c engines/sync.c engines/null.c engines/net.c \
30 memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \
31 json.c lib/zipf.c lib/axmap.c lib/lfsr.c gettime-thread.c \
32 helpers.c lib/flist_sort.c
33
34ifdef CONFIG_64BIT
35 CFLAGS += -DBITS_PER_LONG=64
36endif
37ifdef CONFIG_32BIT
38 CFLAGS += -DBITS_PER_LONG=32
39endif
40
41ifdef CONFIG_LIBAIO
42 CFLAGS += -DCONFIG_LIBAIO
43 SOURCE += engines/libaio.c
44endif
45ifdef CONFIG_RDMA
46 CFLAGS += -DCONFIG_RDMA
47 SOURCE += engines/rdma.c
48endif
49ifdef CONFIG_POSIXAIO
50 CFLAGS += -DCONFIG_POSIXAIO
51 SOURCE += engines/posixaio.c
52endif
53ifdef CONFIG_LINUX_FALLOCATE
54 SOURCE += engines/falloc.c
55endif
56ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
57 SOURCE += engines/e4defrag.c
58endif
59ifdef CONFIG_LINUX_SPLICE
60 CFLAGS += -DCONFIG_LINUX_SPLICE
61 SOURCE += engines/splice.c
62endif
63ifdef CONFIG_GUASI
64 CFLAGS += -DCONFIG_GUASI
65 SOURCE += engines/guasi.c
66endif
67ifdef CONFIG_FUSION_AW
68 CFLAGS += -DCONFIG_FUSION_AW
69 SOURCE += engines/fusion-aw.c
70endif
71ifdef CONFIG_SOLARISAIO
72 CFLAGS += -DCONFIG_SOLARISAIO
73 SOURCE += engines/solarisaio.c
74endif
75
76ifndef CONFIG_STRSEP
77 CFLAGS += -DCONFIG_STRSEP
78 SOURCE += lib/strsep.c
79endif
80ifndef CONFIG_GETOPT_LONG_ONLY
81 CFLAGS += -DCONFIG_GETOPT_LONG_ONLY
82 SOURCE += lib/getopt_long.c
83endif
84
85ifndef CONFIG_INET_ATON
86 CFLAGS += -DCONFIG_INET_ATON
87 SOURCE += lib/inet_aton.c
88endif
89ifdef CONFIG_CLOCK_GETTIME
90 CFLAGS += -DCONFIG_CLOCK_GETTIME
91endif
92ifdef CONFIG_POSIXAIO_FSYNC
93 CFLAGS += -DCONFIG_POSIXAIO_FSYNC
94endif
95ifdef CONFIG_FADVISE
96 CFLAGS += -DCONFIG_FADVISE
97endif
98ifdef CONFIG_CLOCK_MONOTONIC
99 CFLAGS += -DCONFIG_CLOCK_MONOTONIC
100endif
101ifdef CONFIG_CLOCK_MONOTONIC_PRECISE
102 CFLAGS += -DCONFIG_CLOCK_MONOTONIC_PRECISE
103endif
104ifdef CONFIG_GETTIMEOFDAY
105 CFLAGS += -DCONFIG_GETTIMEOFDAY
106endif
107ifdef CONFIG_SOCKLEN_T
108 CFLAGS += -DCONFIG_SOCKLEN_T
109endif
110ifdef CONFIG_SFAA
111 CFLAGS += -DCONFIG_SFAA
112endif
113ifdef CONFIG_FDATASYNC
114 CFLAGS += -DCONFIG_FDATASYNC
115endif
116ifdef CONFIG_3ARG_AFFINITY
117 CFLAGS += -DCONFIG_3ARG_AFFINITY
118endif
119ifdef CONFIG_2ARG_AFFINITY
120 CFLAGS += -DCONFIG_2ARG_AFFINITY
121endif
122ifdef CONFIG_SYNC_FILE_RANGE
123 CFLAGS += -DCONFIG_SYNC_FILE_RANGE
124endif
125ifdef CONFIG_LIBNUMA
126 CFLAGS += -DCONFIG_LIBNUMA
127endif
128ifdef CONFIG_TLS_THREAD
129 CFLAGS += -DCONFIG_TLS_THREAD
130endif
131
132ifeq ($(UNAME), Linux)
133 SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \
134 engines/binject.c profiles/tiobench.c
135 LIBS += -lpthread -ldl
136 LDFLAGS += -rdynamic
137endif
138ifeq ($(UNAME), Android)
139 SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c
140 LIBS += -ldl
141 LDFLAGS += -rdynamic
142 CPPFLAGS += -DFIO_NO_HAVE_SHM_H
143endif
144ifeq ($(UNAME), SunOS)
145 LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket
146 CPPFLAGS += -D__EXTENSIONS__
147endif
148ifeq ($(UNAME), FreeBSD)
149 LIBS += -lpthread -lrt
150 LDFLAGS += -rdynamic
151endif
152ifeq ($(UNAME), NetBSD)
153 LIBS += -lpthread -lrt
154 LDFLAGS += -rdynamic
155endif
156ifeq ($(UNAME), AIX)
157 LIBS += -lpthread -ldl -lrt
158 CPPFLAGS += -D_LARGE_FILES -D__ppc__
159 LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000
160endif
161ifeq ($(UNAME), HP-UX)
162 LIBS += -lpthread -ldl -lrt
163 CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED
164endif
165ifeq ($(UNAME), Darwin)
166 LIBS += -lpthread -ldl
167endif
168ifneq (,$(findstring CYGWIN,$(UNAME)))
169 SOURCE := $(filter-out engines/mmap.c,$(SOURCE))
170 SOURCE += engines/windowsaio.c os/windows/posix.c
171 LIBS += -lpthread -lpsapi -lws2_32
172 CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format
173endif
174
175OBJS = $(SOURCE:.c=.o)
176
177T_SMALLOC_OBJS = t/stest.o
178T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o
179T_SMALLOC_PROGS = t/stest
180
181T_IEEE_OBJS = t/ieee754.o
182T_IEEE_OBJS += lib/ieee754.o
183T_IEEE_PROGS = t/ieee754
184
185T_ZIPF_OBS = t/genzipf.o
186T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o
187T_ZIPF_PROGS = t/genzipf
188
189T_AXMAP_OBJS = t/axmap.o
190T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o
191T_AXMAP_PROGS = t/axmap
192
193T_OBJS = $(T_SMALLOC_OBJS)
194T_OBJS += $(T_IEEE_OBJS)
195T_OBJS += $(T_ZIPF_OBJS)
196T_OBJS += $(T_AXMAP_OBJS)
197
198T_PROGS = $(T_SMALLOC_PROGS)
199T_PROGS += $(T_IEEE_PROGS)
200T_PROGS += $(T_ZIPF_PROGS)
201T_PROGS += $(T_AXMAP_PROGS)
202
203ifneq ($(findstring $(MAKEFLAGS),s),s)
204ifndef V
205 QUIET_CC = @echo ' ' CC $@;
206 QUIET_DEP = @echo ' ' DEP $@;
207endif
208endif
209
210INSTALL = install
211prefix = /usr/local
212bindir = $(prefix)/bin
213
214ifeq ($(UNAME), Darwin)
215mandir = /usr/share/man
216else
217mandir = $(prefix)/man
218endif
219
220all: .depend $(PROGS) $(SCRIPTS) FORCE
221
222.PHONY: all install clean
223.PHONY: FORCE cscope
224
225FIO-VERSION-FILE: FORCE
226 @$(SHELL) ./FIO-VERSION-GEN
227-include FIO-VERSION-FILE
228
229CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
230
231.c.o: .depend FORCE
232 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
233
234init.o: FIO-VERSION-FILE
235 $(QUIET_CC)$(CC) -o init.o -c $(CFLAGS) $(CPPFLAGS) -c init.c
236
237t/stest: $(T_SMALLOC_OBJS)
238 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS)
239
240t/ieee754: $(T_IEEE_OBJS)
241 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS)
242
243t/genzipf: $(T_ZIPF_OBJS)
244 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS) $(LDFLAGS)
245
246t/axmap: $(T_AXMAP_OBJS)
247 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_AXMAP_OBJS) $(LIBS) $(LDFLAGS)
248
249fio: $(OBJS)
250 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
251
252.depend: $(SOURCE)
253 $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend
254
255$(PROGS): .depend
256
257clean: FORCE
258 -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak config-host.ld cscope.out
259
260cscope:
261 @cscope -b -R
262
263install: $(PROGS) $(SCRIPTS) FORCE
264 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
265 $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
266 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
267 $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1
268 $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1
269
270ifneq ($(wildcard .depend),)
271include .depend
272endif