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