ioengine: Add fallocate ioengine
[fio.git] / Makefile
... / ...
CommitLineData
1CC ?= gcc
2DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
3CPPFLAGS= -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
4 $(DEBUGFLAGS)
5OPTFLAGS= -O3 -fno-omit-frame-pointer -g $(EXTFLAGS)
6CFLAGS = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS)
7LIBS = -lm $(EXTLIBS)
8PROGS = fio
9SCRIPTS = fio_generate_plots
10UNAME := $(shell uname)
11
12SOURCE := gettime.c fio.c ioengines.c init.c stat.c log.c time.c filesetup.c \
13 eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \
14 rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \
15 lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \
16 engines/mmap.c engines/sync.c engines/null.c engines/net.c \
17 memalign.c server.c client.c iolog.c backend.c libfio.c flow.c json.c
18
19ifeq ($(UNAME), Linux)
20 SOURCE += diskutil.c fifo.c blktrace.c helpers.c cgroup.c trim.c \
21 engines/libaio.c engines/posixaio.c engines/sg.c \
22 engines/splice.c engines/syslet-rw.c engines/guasi.c \
23 engines/binject.c engines/rdma.c profiles/tiobench.c \
24 engines/fusion-aw.c engines/falloc.c
25 LIBS += -lpthread -ldl -lrt -laio
26 LDFLAGS += -rdynamic
27endif
28ifeq ($(UNAME), SunOS)
29 SOURCE += fifo.c lib/strsep.c helpers.c engines/posixaio.c \
30 engines/solarisaio.c
31 LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket
32 CPPFLAGS += -D__EXTENSIONS__
33endif
34ifeq ($(UNAME), FreeBSD)
35 SOURCE += helpers.c engines/posixaio.c
36 LIBS += -lpthread -lrt
37 LDFLAGS += -rdynamic
38endif
39ifeq ($(UNAME), NetBSD)
40 SOURCE += helpers.c engines/posixaio.c
41 LIBS += -lpthread -lrt
42 LDFLAGS += -rdynamic
43endif
44ifeq ($(UNAME), AIX)
45 SOURCE += fifo.c helpers.c lib/getopt_long.c engines/posixaio.c
46 LIBS += -lpthread -ldl -lrt
47 CPPFLAGS += -D_LARGE_FILES -D__ppc__
48 LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000
49endif
50ifeq ($(UNAME), HP-UX)
51 SOURCE += fifo.c helpers.c lib/getopt_long.c lib/strsep.c engines/posixaio.c
52 LIBS += -lpthread -ldl -lrt
53 CFLAGS += -D_LARGEFILE64_SOURCE
54endif
55ifeq ($(UNAME), Darwin)
56 SOURCE += helpers.c engines/posixaio.c
57 LIBS += -lpthread -ldl
58endif
59ifneq (,$(findstring CYGWIN,$(UNAME)))
60 SOURCE := $(filter-out engines/mmap.c,$(SOURCE))
61 SOURCE += engines/windowsaio.c os/windows/posix.c
62 LIBS += -lpthread -lpsapi -lws2_32
63 CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format
64 CC = x86_64-w64-mingw32-gcc
65 #CC = i686-w64-mingw32-gcc
66endif
67
68OBJS = $(SOURCE:.c=.o)
69
70T_SMALLOC_OBJS = t/stest.o
71T_SMALLOC_OBJS += mutex.o smalloc.o t/log.o
72T_SMALLOC_PROGS = t/stest
73
74T_IEEE_OBJS = t/ieee754.o
75T_IEEE_OBJS += ieee754.o
76T_IEEE_PROGS = t/ieee754
77
78T_OBJS = $(T_SMALLOC_OBJS)
79T_OBJS += $(T_IEEE_OBJS)
80
81ifneq ($(findstring $(MAKEFLAGS),s),s)
82ifndef V
83 QUIET_CC = @echo ' ' CC $@;
84 QUIET_DEP = @echo ' ' DEP $@;
85endif
86endif
87
88INSTALL = install
89prefix = /usr/local
90bindir = $(prefix)/bin
91
92ifeq ($(UNAME), Darwin)
93mandir = /usr/share/man
94else
95mandir = $(prefix)/man
96endif
97
98all: .depend $(PROGS) $(SCRIPTS) FORCE
99
100.PHONY: all install clean
101.PHONY: FORCE cscope
102
103FIO-VERSION-FILE: FORCE
104 @$(SHELL) ./FIO-VERSION-GEN
105-include FIO-VERSION-FILE
106
107CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
108
109.c.o: .depend FORCE
110 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
111
112init.o: FIO-VERSION-FILE
113 $(QUIET_CC)$(CC) -o init.o -c $(CFLAGS) $(CPPFLAGS) -c init.c
114
115t/stest: $(T_SMALLOC_OBJS)
116 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS)
117
118t/ieee754: $(T_IEEE_OBJS)
119 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS)
120
121fio: $(OBJS)
122 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
123
124.depend: $(SOURCE)
125 $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend
126
127$(PROGS): .depend
128
129clean: FORCE
130 -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE
131
132cscope:
133 @cscope -b -R
134
135install: $(PROGS) $(SCRIPTS) FORCE
136 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
137 $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
138 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
139 $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1
140 $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1
141
142ifneq ($(wildcard .depend),)
143include .depend
144endif