Commit | Line | Data |
---|---|---|
79e48f72 | 1 | DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG |
44404c5a | 2 | CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(DEBUGFLAGS) |
b14c9ed7 | 3 | OPTFLAGS= -O3 -g -ffast-math $(EXTFLAGS) |
d015e398 | 4 | CFLAGS = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS) |
1b42725f | 5 | LIBS = -lm -lz $(EXTLIBS) |
ebac4655 JA |
6 | PROGS = fio |
7 | SCRIPTS = fio_generate_plots | |
d015e398 BC |
8 | UNAME := $(shell uname) |
9 | ||
67bf9823 JA |
10 | ifneq ($(wildcard config-host.mak),) |
11 | all: | |
12 | include config-host.mak | |
13 | config-host-mak: configure | |
14 | @echo $@ is out-of-date, running configure | |
15 | @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh | |
16 | else | |
17 | config-host.mak: | |
18 | @echo "Running configure for you..." | |
19 | @./configure | |
20 | all: | |
21 | include config-host.mak | |
22 | endif | |
23 | ||
91f94d5b JA |
24 | ifdef CONFIG_GFIO |
25 | PROGS += gfio | |
26 | endif | |
27 | ||
8232e285 | 28 | SOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \ |
d015e398 | 29 | eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \ |
05775438 | 30 | lib/rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \ |
c7c6cb4c | 31 | lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \ |
d48a9799 | 32 | engines/mmap.c engines/sync.c engines/null.c engines/net.c \ |
2dc1cbb5 | 33 | memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \ |
9a0db1e2 | 34 | cconv.c lib/prio_tree.c json.c lib/zipf.c lib/axmap.c \ |
836fcc0f | 35 | lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \ |
95820b6e | 36 | lib/hweight.c lib/getrusage.c idletime.c |
67bf9823 | 37 | |
c81f9347 BC |
38 | ifdef CONFIG_64BIT_LLP64 |
39 | CFLAGS += -DBITS_PER_LONG=32 | |
40 | endif | |
67bf9823 JA |
41 | ifdef CONFIG_64BIT |
42 | CFLAGS += -DBITS_PER_LONG=64 | |
43 | endif | |
44 | ifdef CONFIG_32BIT | |
45 | CFLAGS += -DBITS_PER_LONG=32 | |
46 | endif | |
67bf9823 | 47 | ifdef CONFIG_LIBAIO |
67bf9823 JA |
48 | SOURCE += engines/libaio.c |
49 | endif | |
50 | ifdef CONFIG_RDMA | |
67bf9823 JA |
51 | SOURCE += engines/rdma.c |
52 | endif | |
53 | ifdef CONFIG_POSIXAIO | |
67bf9823 JA |
54 | SOURCE += engines/posixaio.c |
55 | endif | |
56 | ifdef CONFIG_LINUX_FALLOCATE | |
57 | SOURCE += engines/falloc.c | |
58 | endif | |
59 | ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT | |
60 | SOURCE += engines/e4defrag.c | |
61 | endif | |
62 | ifdef CONFIG_LINUX_SPLICE | |
67bf9823 JA |
63 | SOURCE += engines/splice.c |
64 | endif | |
65 | ifdef CONFIG_GUASI | |
67bf9823 JA |
66 | SOURCE += engines/guasi.c |
67 | endif | |
68 | ifdef CONFIG_FUSION_AW | |
67bf9823 JA |
69 | SOURCE += engines/fusion-aw.c |
70 | endif | |
71 | ifdef CONFIG_SOLARISAIO | |
67bf9823 JA |
72 | SOURCE += engines/solarisaio.c |
73 | endif | |
4700b234 | 74 | ifdef CONFIG_WINDOWSAIO |
4700b234 JA |
75 | SOURCE += engines/windowsaio.c |
76 | endif | |
67bf9823 | 77 | ifndef CONFIG_STRSEP |
67bf9823 JA |
78 | SOURCE += lib/strsep.c |
79 | endif | |
80 | ifndef CONFIG_GETOPT_LONG_ONLY | |
67bf9823 JA |
81 | SOURCE += lib/getopt_long.c |
82 | endif | |
67bf9823 | 83 | ifndef CONFIG_INET_ATON |
67bf9823 JA |
84 | SOURCE += lib/inet_aton.c |
85 | endif | |
d015e398 BC |
86 | |
87 | ifeq ($(UNAME), Linux) | |
67bf9823 JA |
88 | SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \ |
89 | engines/binject.c profiles/tiobench.c | |
90 | LIBS += -lpthread -ldl | |
213a01b0 | 91 | LDFLAGS += -rdynamic |
d015e398 | 92 | endif |
ec5c6b12 | 93 | ifeq ($(UNAME), Android) |
67bf9823 | 94 | SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c |
ec5c6b12 AC |
95 | LIBS += -ldl |
96 | LDFLAGS += -rdynamic | |
97 | CPPFLAGS += -DFIO_NO_HAVE_SHM_H | |
98 | endif | |
d015e398 | 99 | ifeq ($(UNAME), SunOS) |
d015e398 BC |
100 | LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket |
101 | CPPFLAGS += -D__EXTENSIONS__ | |
102 | endif | |
103 | ifeq ($(UNAME), FreeBSD) | |
d015e398 | 104 | LIBS += -lpthread -lrt |
213a01b0 | 105 | LDFLAGS += -rdynamic |
d015e398 BC |
106 | endif |
107 | ifeq ($(UNAME), NetBSD) | |
d015e398 | 108 | LIBS += -lpthread -lrt |
213a01b0 | 109 | LDFLAGS += -rdynamic |
d015e398 BC |
110 | endif |
111 | ifeq ($(UNAME), AIX) | |
d015e398 | 112 | LIBS += -lpthread -ldl -lrt |
d015e398 | 113 | CPPFLAGS += -D_LARGE_FILES -D__ppc__ |
48b35be0 | 114 | LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000 |
d015e398 | 115 | endif |
c00a2289 | 116 | ifeq ($(UNAME), HP-UX) |
b5ffb752 | 117 | LIBS += -lpthread -ldl -lrt |
67bf9823 | 118 | CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED |
c00a2289 | 119 | endif |
d015e398 | 120 | ifeq ($(UNAME), Darwin) |
d015e398 BC |
121 | LIBS += -lpthread -ldl |
122 | endif | |
123 | ifneq (,$(findstring CYGWIN,$(UNAME))) | |
93bcfd20 | 124 | SOURCE := $(filter-out engines/mmap.c,$(SOURCE)) |
4700b234 | 125 | SOURCE += os/windows/posix.c |
93bcfd20 BC |
126 | LIBS += -lpthread -lpsapi -lws2_32 |
127 | CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format | |
d015e398 BC |
128 | endif |
129 | ||
9b836561 | 130 | OBJS = $(SOURCE:.c=.o) |
8232e285 | 131 | FIO_OBJS = $(OBJS) fio.o |
1252d8f2 | 132 | GFIO_OBJS = $(OBJS) gfio.o graph.o tickmarks.o ghelpers.o goptions.o gerror.o \ |
bf3f7027 | 133 | gclient.o gcompat.o cairo_text_helpers.o printing.o |
79d16311 | 134 | |
61f78f3a | 135 | T_SMALLOC_OBJS = t/stest.o |
39ab7da2 | 136 | T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o |
61f78f3a JA |
137 | T_SMALLOC_PROGS = t/stest |
138 | ||
139 | T_IEEE_OBJS = t/ieee754.o | |
84f43c6f | 140 | T_IEEE_OBJS += lib/ieee754.o |
61f78f3a JA |
141 | T_IEEE_PROGS = t/ieee754 |
142 | ||
6ff38856 | 143 | T_ZIPF_OBS = t/genzipf.o |
24baa4c7 | 144 | T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o |
eed3f518 | 145 | T_ZIPF_PROGS = t/genzipf |
6ff38856 | 146 | |
ad1f90aa JA |
147 | T_AXMAP_OBJS = t/axmap.o |
148 | T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o | |
149 | T_AXMAP_PROGS = t/axmap | |
150 | ||
61f78f3a JA |
151 | T_OBJS = $(T_SMALLOC_OBJS) |
152 | T_OBJS += $(T_IEEE_OBJS) | |
6ff38856 | 153 | T_OBJS += $(T_ZIPF_OBJS) |
ad1f90aa | 154 | T_OBJS += $(T_AXMAP_OBJS) |
6ff38856 JA |
155 | |
156 | T_PROGS = $(T_SMALLOC_PROGS) | |
157 | T_PROGS += $(T_IEEE_PROGS) | |
158 | T_PROGS += $(T_ZIPF_PROGS) | |
ad1f90aa | 159 | T_PROGS += $(T_AXMAP_PROGS) |
3427207d | 160 | |
4c3ecec4 JA |
161 | ifneq ($(findstring $(MAKEFLAGS),s),s) |
162 | ifndef V | |
163 | QUIET_CC = @echo ' ' CC $@; | |
0b2d6a7a | 164 | QUIET_DEP = @echo ' ' DEP $@; |
4c3ecec4 JA |
165 | endif |
166 | endif | |
167 | ||
c1d5725e JA |
168 | INSTALL = install |
169 | prefix = /usr/local | |
170 | bindir = $(prefix)/bin | |
bcdf7c58 JA |
171 | |
172 | ifeq ($(UNAME), Darwin) | |
173 | mandir = /usr/share/man | |
174 | else | |
d60e92d1 | 175 | mandir = $(prefix)/man |
bcdf7c58 | 176 | endif |
c1d5725e | 177 | |
3d43382c | 178 | all: .depend $(PROGS) $(SCRIPTS) FORCE |
f84622e9 | 179 | |
3d43382c JA |
180 | .PHONY: all install clean |
181 | .PHONY: FORCE cscope | |
182 | ||
183 | FIO-VERSION-FILE: FORCE | |
84306c1d | 184 | @$(SHELL) ./FIO-VERSION-GEN |
3d43382c JA |
185 | -include FIO-VERSION-FILE |
186 | ||
187 | CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"' | |
188 | ||
189 | .c.o: .depend FORCE | |
4feafb1e | 190 | $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $< |
e52947d1 | 191 | |
32d4cc61 | 192 | init.o: FIO-VERSION-FILE |
4feafb1e | 193 | $(QUIET_CC)$(CC) -o init.o $(CFLAGS) $(CPPFLAGS) -c init.c |
32d4cc61 | 194 | |
f762cef9 JA |
195 | gcompat.o: gcompat.c gcompat.h |
196 | $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gcompat.c | |
197 | ||
9af4a244 JA |
198 | goptions.o: goptions.c goptions.h |
199 | $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c goptions.c | |
200 | ||
53e0e85d JA |
201 | ghelpers.o: ghelpers.c ghelpers.h |
202 | $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c ghelpers.c | |
203 | ||
41666588 JA |
204 | gerror.o: gerror.c gerror.h |
205 | $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gerror.c | |
206 | ||
1252d8f2 JA |
207 | gclient.o: gclient.c gclient.h |
208 | $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gclient.c | |
209 | ||
53e0e85d | 210 | gfio.o: gfio.c ghelpers.c |
70d07ce1 JA |
211 | $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gfio.c |
212 | ||
53e0e85d | 213 | graph.o: graph.c graph.h |
af58ef32 SC |
214 | $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c graph.c |
215 | ||
ee2f55b2 SC |
216 | cairo_text_helpers.o: cairo_text_helpers.c cairo_text_helpers.h |
217 | $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c cairo_text_helpers.c | |
218 | ||
bf3f7027 SC |
219 | printing.o: printing.c printing.h |
220 | $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c printing.c | |
221 | ||
61f78f3a JA |
222 | t/stest: $(T_SMALLOC_OBJS) |
223 | $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS) | |
224 | ||
225 | t/ieee754: $(T_IEEE_OBJS) | |
226 | $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS) | |
fbc2792b | 227 | |
33765372 | 228 | fio: $(FIO_OBJS) |
8232e285 | 229 | $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(FIO_OBJS) $(LIBS) $(LDFLAGS) |
4c3ecec4 | 230 | |
70d07ce1 JA |
231 | gfio: $(GFIO_OBJS) |
232 | $(QUIET_CC)$(CC) $(LIBS) -o gfio $(GFIO_OBJS) $(LIBS) $(GTK_LDFLAGS) | |
233 | ||
6ff38856 JA |
234 | t/genzipf: $(T_ZIPF_OBJS) |
235 | $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS) $(LDFLAGS) | |
236 | ||
ad1f90aa JA |
237 | t/axmap: $(T_AXMAP_OBJS) |
238 | $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_AXMAP_OBJS) $(LIBS) $(LDFLAGS) | |
239 | ||
f84622e9 | 240 | .depend: $(SOURCE) |
9b836561 | 241 | $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend |
0b2d6a7a | 242 | |
33765372 | 243 | $(PROGS): .depend |
ebac4655 | 244 | |
3d43382c | 245 | clean: FORCE |
135be493 | 246 | -rm -f .depend $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core gfio FIO-VERSION-FILE config-host.mak cscope.out |
ebac4655 | 247 | |
592ef98a | 248 | cscope: |
366badd3 | 249 | @cscope -b -R |
592ef98a | 250 | |
3d43382c | 251 | install: $(PROGS) $(SCRIPTS) FORCE |
513ba3f7 | 252 | $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) |
ebac4655 | 253 | $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir) |
d60e92d1 AC |
254 | $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 |
255 | $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1 | |
ccd4f41b | 256 | $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1 |
ebac4655 | 257 | |
06fecb4e JA |
258 | ifneq ($(wildcard .depend),) |
259 | include .depend | |
260 | endif | |
ff1f3280 | 261 | |
ff1f3280 | 262 |