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