Add sample job file for fixed submission rate
[fio.git] / Makefile
... / ...
CommitLineData
1ifneq ($(wildcard config-host.mak),)
2all:
3include config-host.mak
4config-host-mak: configure
5 @echo $@ is out-of-date, running configure
6 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
7else
8config-host.mak:
9ifneq ($(MAKECMDGOALS),clean)
10 @echo "Running configure for you..."
11 @./configure
12endif
13all:
14include config-host.mak
15endif
16
17DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
18CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFIO_INTERNAL $(DEBUGFLAGS)
19OPTFLAGS= -O3 -g -ffast-math
20CFLAGS = -std=gnu99 -Wwrite-strings -Wall -Wdeclaration-after-statement $(OPTFLAGS) $(EXTFLAGS) $(BUILD_CFLAGS)
21LIBS += -lm $(EXTLIBS)
22PROGS = fio
23SCRIPTS = tools/fio_generate_plots tools/plot/fio2gnuplot tools/genfio
24
25ifdef CONFIG_GFIO
26 PROGS += gfio
27endif
28
29SOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \
30 eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \
31 lib/rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \
32 lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \
33 engines/mmap.c engines/sync.c engines/null.c engines/net.c \
34 memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \
35 cconv.c lib/prio_tree.c json.c lib/zipf.c lib/axmap.c \
36 lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \
37 lib/hweight.c lib/getrusage.c idletime.c td_error.c \
38 profiles/tiobench.c profiles/act.c io_u_queue.c filelock.c \
39 lib/tp.c lib/bloom.c lib/gauss.c workqueue.c
40
41ifdef CONFIG_LIBHDFS
42 HDFSFLAGS= -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -I $(FIO_LIBHDFS_INCLUDE)
43 HDFSLIB= -Wl,-rpath $(JAVA_HOME)/jre/lib/amd64/server -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm $(FIO_LIBHDFS_LIB)/libhdfs.a
44 CFLAGS += $(HDFSFLAGS)
45 SOURCE += engines/libhdfs.c
46endif
47
48ifdef CONFIG_64BIT_LLP64
49 CFLAGS += -DBITS_PER_LONG=32
50endif
51ifdef CONFIG_64BIT
52 CFLAGS += -DBITS_PER_LONG=64
53endif
54ifdef CONFIG_32BIT
55 CFLAGS += -DBITS_PER_LONG=32
56endif
57ifdef CONFIG_LIBAIO
58 SOURCE += engines/libaio.c
59endif
60ifdef CONFIG_RDMA
61 SOURCE += engines/rdma.c
62endif
63ifdef CONFIG_POSIXAIO
64 SOURCE += engines/posixaio.c
65endif
66ifdef CONFIG_LINUX_FALLOCATE
67 SOURCE += engines/falloc.c
68endif
69ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
70 SOURCE += engines/e4defrag.c
71endif
72ifdef CONFIG_LINUX_SPLICE
73 SOURCE += engines/splice.c
74endif
75ifdef CONFIG_GUASI
76 SOURCE += engines/guasi.c
77endif
78ifdef CONFIG_FUSION_AW
79 SOURCE += engines/fusion-aw.c
80endif
81ifdef CONFIG_SOLARISAIO
82 SOURCE += engines/solarisaio.c
83endif
84ifdef CONFIG_WINDOWSAIO
85 SOURCE += engines/windowsaio.c
86endif
87ifdef CONFIG_RBD
88 SOURCE += engines/rbd.c
89endif
90ifndef CONFIG_STRSEP
91 SOURCE += lib/strsep.c
92endif
93ifndef CONFIG_STRCASESTR
94 SOURCE += lib/strcasestr.c
95endif
96ifndef CONFIG_GETOPT_LONG_ONLY
97 SOURCE += lib/getopt_long.c
98endif
99ifndef CONFIG_INET_ATON
100 SOURCE += lib/inet_aton.c
101endif
102ifdef CONFIG_GFAPI
103 SOURCE += engines/glusterfs.c
104 SOURCE += engines/glusterfs_sync.c
105 SOURCE += engines/glusterfs_async.c
106 ifdef CONFIG_GF_FADVISE
107 CFLAGS += "-DGFAPI_USE_FADVISE"
108 endif
109endif
110ifdef CONFIG_MTD
111 SOURCE += engines/mtd.c
112 SOURCE += lib/libmtd.c
113 SOURCE += lib/libmtd_legacy.c
114endif
115
116ifeq ($(CONFIG_TARGET_OS), Linux)
117 SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \
118 engines/binject.c lib/linux-dev-lookup.c
119 LIBS += -lpthread -ldl
120 LDFLAGS += -rdynamic
121endif
122ifeq ($(CONFIG_TARGET_OS), Android)
123 SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c \
124 lib/linux-dev-lookup.c
125 LIBS += -ldl
126 LDFLAGS += -rdynamic
127endif
128ifeq ($(CONFIG_TARGET_OS), SunOS)
129 LIBS += -lpthread -ldl
130 CPPFLAGS += -D__EXTENSIONS__
131endif
132ifeq ($(CONFIG_TARGET_OS), FreeBSD)
133 LIBS += -lpthread -lrt
134 LDFLAGS += -rdynamic
135endif
136ifeq ($(CONFIG_TARGET_OS), OpenBSD)
137 LIBS += -lpthread
138 LDFLAGS += -rdynamic
139endif
140ifeq ($(CONFIG_TARGET_OS), NetBSD)
141 LIBS += -lpthread -lrt
142 LDFLAGS += -rdynamic
143endif
144ifeq ($(CONFIG_TARGET_OS), DragonFly)
145 LIBS += -lpthread -lrt
146 LDFLAGS += -rdynamic
147endif
148ifeq ($(CONFIG_TARGET_OS), AIX)
149 LIBS += -lpthread -ldl -lrt
150 CPPFLAGS += -D_LARGE_FILES -D__ppc__
151 LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000
152endif
153ifeq ($(CONFIG_TARGET_OS), HP-UX)
154 LIBS += -lpthread -ldl -lrt
155 CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED
156endif
157ifeq ($(CONFIG_TARGET_OS), Darwin)
158 LIBS += -lpthread -ldl
159endif
160ifneq (,$(findstring CYGWIN,$(CONFIG_TARGET_OS)))
161 SOURCE := $(filter-out engines/mmap.c,$(SOURCE))
162 SOURCE += os/windows/posix.c
163 LIBS += -lpthread -lpsapi -lws2_32
164 CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format -static
165endif
166
167OBJS = $(SOURCE:.c=.o)
168
169FIO_OBJS = $(OBJS) fio.o
170
171GFIO_OBJS = $(OBJS) gfio.o graph.o tickmarks.o ghelpers.o goptions.o gerror.o \
172 gclient.o gcompat.o cairo_text_helpers.o printing.o
173
174ifdef CONFIG_ARITHMETIC
175FIO_OBJS += lex.yy.o y.tab.o
176GFIO_OBJS += lex.yy.o y.tab.o
177endif
178
179-include $(OBJS:.o=.d)
180
181T_SMALLOC_OBJS = t/stest.o
182T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o t/debug.o
183T_SMALLOC_PROGS = t/stest
184
185T_IEEE_OBJS = t/ieee754.o
186T_IEEE_OBJS += lib/ieee754.o
187T_IEEE_PROGS = t/ieee754
188
189T_ZIPF_OBS = t/genzipf.o
190T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o lib/gauss.o t/genzipf.o
191T_ZIPF_PROGS = t/fio-genzipf
192
193T_AXMAP_OBJS = t/axmap.o
194T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o
195T_AXMAP_PROGS = t/axmap
196
197T_LFSR_TEST_OBJS = t/lfsr-test.o
198T_LFSR_TEST_OBJS += lib/lfsr.o gettime.o t/log.o t/debug.o
199T_LFSR_TEST_PROGS = t/lfsr-test
200
201ifeq ($(CONFIG_TARGET_OS), Linux)
202T_BTRACE_FIO_OBJS = t/btrace2fio.o
203T_BTRACE_FIO_OBJS += fifo.o lib/flist_sort.o t/log.o lib/linux-dev-lookup.o
204T_BTRACE_FIO_PROGS = t/fio-btrace2fio
205endif
206
207T_DEDUPE_OBJS = t/dedupe.o
208T_DEDUPE_OBJS += lib/rbtree.o t/log.o mutex.o smalloc.o gettime.o crc/md5.o \
209 memalign.o lib/bloom.o t/debug.o crc/xxhash.o crc/murmur3.o \
210 crc/crc32c.o crc/crc32c-intel.o crc/fnv.o
211T_DEDUPE_PROGS = t/fio-dedupe
212
213T_OBJS = $(T_SMALLOC_OBJS)
214T_OBJS += $(T_IEEE_OBJS)
215T_OBJS += $(T_ZIPF_OBJS)
216T_OBJS += $(T_AXMAP_OBJS)
217T_OBJS += $(T_LFSR_TEST_OBJS)
218T_OBJS += $(T_BTRACE_FIO_OBJS)
219T_OBJS += $(T_DEDUPE_OBJS)
220
221T_TEST_PROGS = $(T_SMALLOC_PROGS)
222T_TEST_PROGS += $(T_IEEE_PROGS)
223T_PROGS += $(T_ZIPF_PROGS)
224T_TEST_PROGS += $(T_AXMAP_PROGS)
225T_TEST_PROGS += $(T_LFSR_TEST_PROGS)
226T_PROGS += $(T_BTRACE_FIO_PROGS)
227T_PROGS += $(T_DEDUPE_PROGS)
228
229PROGS += $(T_PROGS)
230
231ifneq ($(findstring $(MAKEFLAGS),s),s)
232ifndef V
233 QUIET_CC = @echo ' ' CC $@;
234 QUIET_LINK = @echo ' ' LINK $@;
235 QUIET_DEP = @echo ' ' DEP $@;
236 QUIET_YACC = @echo ' ' YACC $@;
237 QUIET_LEX = @echo ' ' LEX $@;
238endif
239endif
240
241ifeq ($(CONFIG_TARGET_OS), SunOS)
242 INSTALL = ginstall
243else
244 INSTALL = install
245endif
246prefix = /usr/local
247bindir = $(prefix)/bin
248
249ifeq ($(CONFIG_TARGET_OS), Darwin)
250mandir = /usr/share/man
251sharedir = /usr/share/fio
252else
253mandir = $(prefix)/man
254sharedir = $(prefix)/share/fio
255endif
256
257all: $(PROGS) $(T_TEST_PROGS) $(SCRIPTS) FORCE
258
259.PHONY: all install clean
260.PHONY: FORCE cscope
261
262FIO-VERSION-FILE: FORCE
263 @$(SHELL) ./FIO-VERSION-GEN
264-include FIO-VERSION-FILE
265
266override CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
267
268%.o : %.c
269 $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
270 @$(CC) -MM $(CFLAGS) $(CPPFLAGS) $*.c > $*.d
271 @mv -f $*.d $*.d.tmp
272 @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
273 @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
274 sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
275 @rm -f $*.d.tmp
276
277ifdef CONFIG_ARITHMETIC
278lex.yy.c: exp/expression-parser.l
279 $(QUIET_LEX)$(LEX) exp/expression-parser.l
280
281lex.yy.o: lex.yy.c y.tab.h
282 $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
283
284y.tab.o: y.tab.c y.tab.h
285 $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
286
287y.tab.c: exp/expression-parser.y
288 $(QUIET_YACC)$(YACC) -l -d -b y exp/expression-parser.y
289
290y.tab.h: y.tab.c
291
292lexer.h: lex.yy.c
293
294exp/test-expression-parser.o: exp/test-expression-parser.c
295 $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
296exp/test-expression-parser: exp/test-expression-parser.o
297 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) $< y.tab.o lex.yy.o -o $@ $(LIBS)
298
299parse.o: lex.yy.o y.tab.o
300endif
301
302init.o: FIO-VERSION-FILE init.c
303 $(QUIET_CC)$(CC) -o init.o $(CFLAGS) $(CPPFLAGS) -c init.c
304
305gcompat.o: gcompat.c gcompat.h
306 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gcompat.c
307
308goptions.o: goptions.c goptions.h
309 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c goptions.c
310
311ghelpers.o: ghelpers.c ghelpers.h
312 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c ghelpers.c
313
314gerror.o: gerror.c gerror.h
315 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gerror.c
316
317gclient.o: gclient.c gclient.h
318 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gclient.c
319
320gfio.o: gfio.c ghelpers.c
321 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gfio.c
322
323graph.o: graph.c graph.h
324 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c graph.c
325
326cairo_text_helpers.o: cairo_text_helpers.c cairo_text_helpers.h
327 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c cairo_text_helpers.c
328
329printing.o: printing.c printing.h
330 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c printing.c
331
332t/stest: $(T_SMALLOC_OBJS)
333 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS)
334
335t/ieee754: $(T_IEEE_OBJS)
336 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS)
337
338fio: $(FIO_OBJS)
339 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(FIO_OBJS) $(LIBS) $(HDFSLIB)
340
341gfio: $(GFIO_OBJS)
342 $(QUIET_LINK)$(CC) $(filter-out -static, $(LDFLAGS)) -o gfio $(GFIO_OBJS) $(LIBS) $(GFIO_LIBS) $(GTK_LDFLAGS) $(HDFSLIB)
343
344t/fio-genzipf: $(T_ZIPF_OBJS)
345 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS)
346
347t/axmap: $(T_AXMAP_OBJS)
348 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_AXMAP_OBJS) $(LIBS)
349
350t/lfsr-test: $(T_LFSR_TEST_OBJS)
351 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_LFSR_TEST_OBJS) $(LIBS)
352
353ifeq ($(CONFIG_TARGET_OS), Linux)
354t/fio-btrace2fio: $(T_BTRACE_FIO_OBJS)
355 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_BTRACE_FIO_OBJS) $(LIBS)
356endif
357
358t/fio-dedupe: $(T_DEDUPE_OBJS)
359 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_DEDUPE_OBJS) $(LIBS)
360
361clean: FORCE
362 @rm -f .depend $(FIO_OBJS) $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) $(T_TEST_PROGS) core.* core gfio FIO-VERSION-FILE *.d lib/*.d crc/*.d engines/*.d profiles/*.d t/*.d config-host.mak config-host.h y.tab.[ch] lex.yy.c exp/*.[do] lexer.h
363
364distclean: clean FORCE
365 @rm -f cscope.out fio.pdf fio_generate_plots.pdf fio2gnuplot.pdf
366
367cscope:
368 @cscope -b -R
369
370tools/plot/fio2gnuplot.1:
371 @cat tools/plot/fio2gnuplot.manpage | txt2man -t fio2gnuplot > tools/plot/fio2gnuplot.1
372
373doc: tools/plot/fio2gnuplot.1
374 @man -t ./fio.1 | ps2pdf - fio.pdf
375 @man -t tools/fio_generate_plots.1 | ps2pdf - fio_generate_plots.pdf
376 @man -t tools/plot/fio2gnuplot.1 | ps2pdf - fio2gnuplot.pdf
377
378install: $(PROGS) $(SCRIPTS) tools/plot/fio2gnuplot.1 FORCE
379 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
380 $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
381 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
382 $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1
383 $(INSTALL) -m 644 tools/fio_generate_plots.1 $(DESTDIR)$(mandir)/man1
384 $(INSTALL) -m 644 tools/plot/fio2gnuplot.1 $(DESTDIR)$(mandir)/man1
385 $(INSTALL) -m 755 -d $(DESTDIR)$(sharedir)
386 $(INSTALL) -m 644 tools/plot/*gpm $(DESTDIR)$(sharedir)/