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) |
b6cf38f0 | 5 | LIBS = -lm $(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 | ||
93bcfd20 | 24 | SOURCE := gettime.c fio.c ioengines.c init.c stat.c log.c time.c filesetup.c \ |
d015e398 BC |
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 \ | |
c7c6cb4c | 27 | lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \ |
d48a9799 | 28 | engines/mmap.c engines/sync.c engines/null.c engines/net.c \ |
62cb17de | 29 | memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \ |
67bf9823 | 30 | json.c lib/zipf.c lib/axmap.c lib/lfsr.c gettime-thread.c \ |
f2a2ce0e HL |
31 | helpers.c lib/flist_sort.c lib/hweight.c lib/getrusage.c \ |
32 | idletime.c | |
67bf9823 | 33 | |
c81f9347 BC |
34 | ifdef CONFIG_64BIT_LLP64 |
35 | CFLAGS += -DBITS_PER_LONG=32 | |
36 | endif | |
67bf9823 JA |
37 | ifdef CONFIG_64BIT |
38 | CFLAGS += -DBITS_PER_LONG=64 | |
39 | endif | |
40 | ifdef CONFIG_32BIT | |
41 | CFLAGS += -DBITS_PER_LONG=32 | |
42 | endif | |
67bf9823 | 43 | ifdef CONFIG_LIBAIO |
67bf9823 JA |
44 | SOURCE += engines/libaio.c |
45 | endif | |
46 | ifdef CONFIG_RDMA | |
67bf9823 JA |
47 | SOURCE += engines/rdma.c |
48 | endif | |
49 | ifdef CONFIG_POSIXAIO | |
67bf9823 JA |
50 | SOURCE += engines/posixaio.c |
51 | endif | |
52 | ifdef CONFIG_LINUX_FALLOCATE | |
53 | SOURCE += engines/falloc.c | |
54 | endif | |
55 | ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT | |
56 | SOURCE += engines/e4defrag.c | |
57 | endif | |
58 | ifdef CONFIG_LINUX_SPLICE | |
67bf9823 JA |
59 | SOURCE += engines/splice.c |
60 | endif | |
61 | ifdef CONFIG_GUASI | |
67bf9823 JA |
62 | SOURCE += engines/guasi.c |
63 | endif | |
64 | ifdef CONFIG_FUSION_AW | |
67bf9823 JA |
65 | SOURCE += engines/fusion-aw.c |
66 | endif | |
67 | ifdef CONFIG_SOLARISAIO | |
67bf9823 JA |
68 | SOURCE += engines/solarisaio.c |
69 | endif | |
4700b234 | 70 | ifdef CONFIG_WINDOWSAIO |
4700b234 JA |
71 | SOURCE += engines/windowsaio.c |
72 | endif | |
67bf9823 | 73 | ifndef CONFIG_STRSEP |
67bf9823 JA |
74 | SOURCE += lib/strsep.c |
75 | endif | |
76 | ifndef CONFIG_GETOPT_LONG_ONLY | |
67bf9823 JA |
77 | SOURCE += lib/getopt_long.c |
78 | endif | |
67bf9823 | 79 | ifndef CONFIG_INET_ATON |
67bf9823 JA |
80 | SOURCE += lib/inet_aton.c |
81 | endif | |
d015e398 BC |
82 | |
83 | ifeq ($(UNAME), Linux) | |
67bf9823 JA |
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 | |
213a01b0 | 87 | LDFLAGS += -rdynamic |
d015e398 | 88 | endif |
ec5c6b12 | 89 | ifeq ($(UNAME), Android) |
67bf9823 | 90 | SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c |
ec5c6b12 AC |
91 | LIBS += -ldl |
92 | LDFLAGS += -rdynamic | |
ec5c6b12 | 93 | endif |
d015e398 | 94 | ifeq ($(UNAME), SunOS) |
7366ad05 | 95 | LIBS += -lpthread -ldl |
d015e398 BC |
96 | CPPFLAGS += -D__EXTENSIONS__ |
97 | endif | |
98 | ifeq ($(UNAME), FreeBSD) | |
d015e398 | 99 | LIBS += -lpthread -lrt |
213a01b0 | 100 | LDFLAGS += -rdynamic |
d015e398 BC |
101 | endif |
102 | ifeq ($(UNAME), NetBSD) | |
d015e398 | 103 | LIBS += -lpthread -lrt |
213a01b0 | 104 | LDFLAGS += -rdynamic |
d015e398 BC |
105 | endif |
106 | ifeq ($(UNAME), AIX) | |
d015e398 | 107 | LIBS += -lpthread -ldl -lrt |
d015e398 | 108 | CPPFLAGS += -D_LARGE_FILES -D__ppc__ |
48b35be0 | 109 | LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000 |
d015e398 | 110 | endif |
c00a2289 | 111 | ifeq ($(UNAME), HP-UX) |
b5ffb752 | 112 | LIBS += -lpthread -ldl -lrt |
67bf9823 | 113 | CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED |
c00a2289 | 114 | endif |
d015e398 | 115 | ifeq ($(UNAME), Darwin) |
d015e398 BC |
116 | LIBS += -lpthread -ldl |
117 | endif | |
118 | ifneq (,$(findstring CYGWIN,$(UNAME))) | |
93bcfd20 | 119 | SOURCE := $(filter-out engines/mmap.c,$(SOURCE)) |
4700b234 | 120 | SOURCE += os/windows/posix.c |
93bcfd20 BC |
121 | LIBS += -lpthread -lpsapi -lws2_32 |
122 | CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format | |
d015e398 BC |
123 | endif |
124 | ||
9b836561 | 125 | OBJS = $(SOURCE:.c=.o) |
f67d6ee2 | 126 | -include $(OBJS:.o=.d) |
79d16311 | 127 | |
61f78f3a | 128 | T_SMALLOC_OBJS = t/stest.o |
39ab7da2 | 129 | T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o |
61f78f3a JA |
130 | T_SMALLOC_PROGS = t/stest |
131 | ||
132 | T_IEEE_OBJS = t/ieee754.o | |
f98f3d07 | 133 | T_IEEE_OBJS += lib/ieee754.o |
61f78f3a JA |
134 | T_IEEE_PROGS = t/ieee754 |
135 | ||
6ff38856 | 136 | T_ZIPF_OBS = t/genzipf.o |
24baa4c7 | 137 | T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o |
eed3f518 | 138 | T_ZIPF_PROGS = t/genzipf |
6ff38856 | 139 | |
ad1f90aa JA |
140 | T_AXMAP_OBJS = t/axmap.o |
141 | T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o | |
142 | T_AXMAP_PROGS = t/axmap | |
143 | ||
7a887ffe AP |
144 | T_LFSR_TEST_OBJS = t/lfsr-test.o |
145 | T_LFSR_TEST_OBJS += lib/lfsr.o | |
146 | T_LFSR_TEST_PROGS = t/lfsr-test | |
147 | ||
61f78f3a JA |
148 | T_OBJS = $(T_SMALLOC_OBJS) |
149 | T_OBJS += $(T_IEEE_OBJS) | |
6ff38856 | 150 | T_OBJS += $(T_ZIPF_OBJS) |
ad1f90aa | 151 | T_OBJS += $(T_AXMAP_OBJS) |
7a887ffe | 152 | T_OBJS += $(T_LFSR_TEST_OBJS) |
6ff38856 JA |
153 | |
154 | T_PROGS = $(T_SMALLOC_PROGS) | |
155 | T_PROGS += $(T_IEEE_PROGS) | |
156 | T_PROGS += $(T_ZIPF_PROGS) | |
ad1f90aa | 157 | T_PROGS += $(T_AXMAP_PROGS) |
7a887ffe | 158 | T_PROGS += $(T_LFSR_TEST_PROGS) |
3427207d | 159 | |
4c3ecec4 JA |
160 | ifneq ($(findstring $(MAKEFLAGS),s),s) |
161 | ifndef V | |
162 | QUIET_CC = @echo ' ' CC $@; | |
6ce038de | 163 | QUIET_LINK = @echo ' ' LINK $@; |
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 | |
f67d6ee2 | 178 | all: $(PROGS) $(SCRIPTS) FORCE |
f84622e9 | 179 | |
692a5d22 JA |
180 | .PHONY: all install clean |
181 | .PHONY: FORCE cscope | |
182 | ||
183 | FIO-VERSION-FILE: FORCE | |
84306c1d | 184 | @$(SHELL) ./FIO-VERSION-GEN |
692a5d22 JA |
185 | -include FIO-VERSION-FILE |
186 | ||
7496ea3e | 187 | override CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"' |
692a5d22 | 188 | |
cb340b15 | 189 | .c.o: FORCE FIO-VERSION-FILE |
4feafb1e | 190 | $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $< |
f67d6ee2 JA |
191 | @$(CC) -MM $(CFLAGS) $(CPPFLAGS) $*.c > $*.d |
192 | @mv -f $*.d $*.d.tmp | |
193 | @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d | |
194 | @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ | |
195 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d | |
196 | @rm -f $*.d.tmp | |
e52947d1 | 197 | |
cb340b15 | 198 | init.o: FIO-VERSION-FILE init.c |
4feafb1e | 199 | $(QUIET_CC)$(CC) -o init.o $(CFLAGS) $(CPPFLAGS) -c init.c |
a6204b68 | 200 | |
61f78f3a | 201 | t/stest: $(T_SMALLOC_OBJS) |
6ce038de | 202 | $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS) |
61f78f3a JA |
203 | |
204 | t/ieee754: $(T_IEEE_OBJS) | |
6ce038de | 205 | $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS) |
fbc2792b | 206 | |
6ff38856 | 207 | t/genzipf: $(T_ZIPF_OBJS) |
6ce038de | 208 | $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS) $(LDFLAGS) |
6ff38856 | 209 | |
ad1f90aa | 210 | t/axmap: $(T_AXMAP_OBJS) |
6ce038de | 211 | $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_AXMAP_OBJS) $(LIBS) $(LDFLAGS) |
ad1f90aa | 212 | |
7a887ffe AP |
213 | t/lfsr-test: $(T_LFSR_TEST_OBJS) |
214 | $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_LFSR_TEST_OBJS) $(LIBS) $(LDFLAGS) | |
215 | ||
2f9ade3c | 216 | fio: $(OBJS) |
6ce038de | 217 | $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS) |
4c3ecec4 | 218 | |
692a5d22 | 219 | clean: FORCE |
ff01f0f1 | 220 | -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak config-host.h cscope.out *.d |
ebac4655 | 221 | |
592ef98a | 222 | cscope: |
366badd3 | 223 | @cscope -b -R |
592ef98a | 224 | |
692a5d22 | 225 | install: $(PROGS) $(SCRIPTS) FORCE |
513ba3f7 | 226 | $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) |
ebac4655 | 227 | $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir) |
d60e92d1 AC |
228 | $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 |
229 | $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1 | |
ccd4f41b | 230 | $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1 |