Only disable stdout ETA output if results are going to stdout
[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 idletime.c
33
34ifdef CONFIG_64BIT_LLP64
35 CFLAGS += -DBITS_PER_LONG=32
36endif
37ifdef CONFIG_64BIT
38 CFLAGS += -DBITS_PER_LONG=64
39endif
40ifdef CONFIG_32BIT
41 CFLAGS += -DBITS_PER_LONG=32
42endif
43ifdef CONFIG_LIBAIO
44 SOURCE += engines/libaio.c
45endif
46ifdef CONFIG_RDMA
47 SOURCE += engines/rdma.c
48endif
49ifdef CONFIG_POSIXAIO
50 SOURCE += engines/posixaio.c
51endif
52ifdef CONFIG_LINUX_FALLOCATE
53 SOURCE += engines/falloc.c
54endif
55ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
56 SOURCE += engines/e4defrag.c
57endif
58ifdef CONFIG_LINUX_SPLICE
59 SOURCE += engines/splice.c
60endif
61ifdef CONFIG_GUASI
62 SOURCE += engines/guasi.c
63endif
64ifdef CONFIG_FUSION_AW
65 SOURCE += engines/fusion-aw.c
66endif
67ifdef CONFIG_SOLARISAIO
68 SOURCE += engines/solarisaio.c
69endif
70ifdef CONFIG_WINDOWSAIO
71 SOURCE += engines/windowsaio.c
72endif
73ifndef CONFIG_STRSEP
74 SOURCE += lib/strsep.c
75endif
76ifndef CONFIG_GETOPT_LONG_ONLY
77 SOURCE += lib/getopt_long.c
78endif
79ifndef CONFIG_INET_ATON
80 SOURCE += lib/inet_aton.c
81endif
82
83ifeq ($(UNAME), Linux)
84 SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \
85 engines/binject.c profiles/tiobench.c
86 LIBS += -lpthread -ldl
87 LDFLAGS += -rdynamic
88endif
89ifeq ($(UNAME), Android)
90 SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c
91 LIBS += -ldl
92 LDFLAGS += -rdynamic
93 CPPFLAGS += -DFIO_NO_HAVE_SHM_H
94endif
95ifeq ($(UNAME), SunOS)
96 LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket
97 CPPFLAGS += -D__EXTENSIONS__
98endif
99ifeq ($(UNAME), FreeBSD)
100 LIBS += -lpthread -lrt
101 LDFLAGS += -rdynamic
102endif
103ifeq ($(UNAME), NetBSD)
104 LIBS += -lpthread -lrt
105 LDFLAGS += -rdynamic
106endif
107ifeq ($(UNAME), AIX)
108 LIBS += -lpthread -ldl -lrt
109 CPPFLAGS += -D_LARGE_FILES -D__ppc__
110 LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000
111endif
112ifeq ($(UNAME), HP-UX)
113 LIBS += -lpthread -ldl -lrt
114 CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED
115endif
116ifeq ($(UNAME), Darwin)
117 LIBS += -lpthread -ldl
118endif
119ifneq (,$(findstring CYGWIN,$(UNAME)))
120 SOURCE := $(filter-out engines/mmap.c,$(SOURCE))
121 SOURCE += os/windows/posix.c
122 LIBS += -lpthread -lpsapi -lws2_32
123 CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format
124endif
125
126OBJS = $(SOURCE:.c=.o)
127
128T_SMALLOC_OBJS = t/stest.o
129T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o
130T_SMALLOC_PROGS = t/stest
131
132T_IEEE_OBJS = t/ieee754.o
133T_IEEE_OBJS += lib/ieee754.o
134T_IEEE_PROGS = t/ieee754
135
136T_ZIPF_OBS = t/genzipf.o
137T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o
138T_ZIPF_PROGS = t/genzipf
139
140T_AXMAP_OBJS = t/axmap.o
141T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o
142T_AXMAP_PROGS = t/axmap
143
144T_OBJS = $(T_SMALLOC_OBJS)
145T_OBJS += $(T_IEEE_OBJS)
146T_OBJS += $(T_ZIPF_OBJS)
147T_OBJS += $(T_AXMAP_OBJS)
148
149T_PROGS = $(T_SMALLOC_PROGS)
150T_PROGS += $(T_IEEE_PROGS)
151T_PROGS += $(T_ZIPF_PROGS)
152T_PROGS += $(T_AXMAP_PROGS)
153
154ifneq ($(findstring $(MAKEFLAGS),s),s)
155ifndef V
156 QUIET_CC = @echo ' ' CC $@;
157 QUIET_DEP = @echo ' ' DEP $@;
158endif
159endif
160
161INSTALL = install
162prefix = /usr/local
163bindir = $(prefix)/bin
164
165ifeq ($(UNAME), Darwin)
166mandir = /usr/share/man
167else
168mandir = $(prefix)/man
169endif
170
171all: .depend $(PROGS) $(SCRIPTS) FORCE
172
173.PHONY: all install clean
174.PHONY: FORCE cscope
175
176FIO-VERSION-FILE: FORCE
177 @$(SHELL) ./FIO-VERSION-GEN
178-include FIO-VERSION-FILE
179
180CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
181
182.c.o: .depend FORCE
183 $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
184
185init.o: FIO-VERSION-FILE
186 $(QUIET_CC)$(CC) -o init.o $(CFLAGS) $(CPPFLAGS) -c init.c
187
188t/stest: $(T_SMALLOC_OBJS)
189 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS)
190
191t/ieee754: $(T_IEEE_OBJS)
192 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS)
193
194t/genzipf: $(T_ZIPF_OBJS)
195 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS) $(LDFLAGS)
196
197t/axmap: $(T_AXMAP_OBJS)
198 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_AXMAP_OBJS) $(LIBS) $(LDFLAGS)
199
200fio: $(OBJS)
201 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
202
203.depend: $(SOURCE)
204 $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend
205
206$(PROGS): .depend
207
208clean: FORCE
209 -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak cscope.out
210
211cscope:
212 @cscope -b -R
213
214install: $(PROGS) $(SCRIPTS) FORCE
215 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
216 $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
217 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
218 $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1
219 $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1
220
221ifneq ($(wildcard .depend),)
222include .depend
223endif