blob: 4a9e7189fcb56932fc94745bf0f89c78140f7c45 [file] [log] [blame]
Jens Axboe12cbb462007-12-10 20:24:44 +01001CC = gcc
Jens Axboe79e48f72008-02-01 20:37:09 +01002DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
Bruce Cran9b836562011-01-08 19:49:54 +01003CPPFLAGS= -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
4 $(DEBUGFLAGS)
Jens Axboeb7eec502011-10-07 13:31:23 +02005OPTFLAGS= -O3 -fno-omit-frame-pointer -g $(EXTFLAGS)
Bruce Crand015e392011-01-28 08:39:09 +01006CFLAGS = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS)
Jens Axboe1b427252012-03-14 15:03:03 +01007LIBS = -lm -lz $(EXTLIBS)
Jens Axboeebac4652005-12-08 15:25:21 +01008PROGS = fio
9SCRIPTS = fio_generate_plots
Bruce Crand015e392011-01-28 08:39:09 +010010UNAME := $(shell uname)
11
Jens Axboe70d07ce2012-02-24 13:11:35 +010012GTK_CFLAGS = `pkg-config --cflags gtk+-2.0 gthread-2.0`
13GTK_LDFLAGS = `pkg-config --libs gtk+-2.0 gthread-2.0`
Stephen M. Cameronff1f3282012-02-24 08:17:30 +010014
Stephen M. Cameron8232e282012-02-24 08:17:31 +010015SOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \
Bruce Crand015e392011-01-28 08:39:09 +010016 eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \
17 rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \
Jens Axboec7c6cb42011-10-13 14:12:40 +020018 lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \
Jens Axboed48a9792011-07-09 08:54:26 +020019 engines/mmap.c engines/sync.c engines/null.c engines/net.c \
Jens Axboe2dc1cbb2012-03-08 14:52:25 +010020 memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \
21 cconv.c
Bruce Crand015e392011-01-28 08:39:09 +010022
23ifeq ($(UNAME), Linux)
24 SOURCE += diskutil.c fifo.c blktrace.c helpers.c cgroup.c trim.c \
25 engines/libaio.c engines/posixaio.c engines/sg.c \
26 engines/splice.c engines/syslet-rw.c engines/guasi.c \
ren yufei21b8aee2011-08-01 10:01:57 +020027 engines/binject.c engines/rdma.c profiles/tiobench.c
Bruce Crand015e392011-01-28 08:39:09 +010028 LIBS += -lpthread -ldl -lrt -laio
Jens Axboe213a01b2011-10-07 13:24:16 +020029 LDFLAGS += -rdynamic
Bruce Crand015e392011-01-28 08:39:09 +010030endif
31ifeq ($(UNAME), SunOS)
Jens Axboe33c142b2011-04-25 20:49:45 +020032 SOURCE += fifo.c lib/strsep.c helpers.c engines/posixaio.c \
Jens Axboed48a9792011-07-09 08:54:26 +020033 engines/solarisaio.c
Bruce Crand015e392011-01-28 08:39:09 +010034 LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket
35 CPPFLAGS += -D__EXTENSIONS__
36endif
37ifeq ($(UNAME), FreeBSD)
Jens Axboed48a9792011-07-09 08:54:26 +020038 SOURCE += helpers.c engines/posixaio.c
Bruce Crand015e392011-01-28 08:39:09 +010039 LIBS += -lpthread -lrt
Jens Axboe213a01b2011-10-07 13:24:16 +020040 LDFLAGS += -rdynamic
Bruce Crand015e392011-01-28 08:39:09 +010041endif
42ifeq ($(UNAME), NetBSD)
Jens Axboed48a9792011-07-09 08:54:26 +020043 SOURCE += helpers.c engines/posixaio.c
Bruce Crand015e392011-01-28 08:39:09 +010044 LIBS += -lpthread -lrt
Jens Axboe213a01b2011-10-07 13:24:16 +020045 LDFLAGS += -rdynamic
Bruce Crand015e392011-01-28 08:39:09 +010046endif
47ifeq ($(UNAME), AIX)
Jens Axboed48a9792011-07-09 08:54:26 +020048 SOURCE += fifo.c helpers.c lib/getopt_long.c engines/posixaio.c
Bruce Crand015e392011-01-28 08:39:09 +010049 LIBS += -lpthread -ldl -lrt
Bruce Crand015e392011-01-28 08:39:09 +010050 CPPFLAGS += -D_LARGE_FILES -D__ppc__
Michael Perzl48b35be2011-07-13 20:28:07 +020051 LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000
Bruce Crand015e392011-01-28 08:39:09 +010052endif
Jens Axboec00a2282011-07-08 20:56:06 +020053ifeq ($(UNAME), HP-UX)
Jens Axboed48a9792011-07-09 08:54:26 +020054 SOURCE += fifo.c helpers.c lib/getopt_long.c lib/strsep.c engines/posixaio.c
Jens Axboeb5ffb752011-07-09 13:28:19 +020055 LIBS += -lpthread -ldl -lrt
Jens Axboed48a9792011-07-09 08:54:26 +020056 CFLAGS += -D_LARGEFILE64_SOURCE
Jens Axboec00a2282011-07-08 20:56:06 +020057endif
Bruce Crand015e392011-01-28 08:39:09 +010058ifeq ($(UNAME), Darwin)
Jens Axboed48a9792011-07-09 08:54:26 +020059 SOURCE += helpers.c engines/posixaio.c
Bruce Crand015e392011-01-28 08:39:09 +010060 LIBS += -lpthread -ldl
61endif
62ifneq (,$(findstring CYGWIN,$(UNAME)))
Bruce Cran93bcfd22012-02-20 20:18:19 +010063 SOURCE := $(filter-out engines/mmap.c,$(SOURCE))
64 SOURCE += engines/windowsaio.c os/windows/posix.c
65 LIBS += -lpthread -lpsapi -lws2_32
66 CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format
67 CC = x86_64-w64-mingw32-gcc
Bruce Crand015e392011-01-28 08:39:09 +010068endif
69
Bruce Cran9b836562011-01-08 19:49:54 +010070OBJS = $(SOURCE:.c=.o)
Stephen M. Cameron8232e282012-02-24 08:17:31 +010071FIO_OBJS = $(OBJS) fio.o
Stephen M. Cameronaf58ef32012-03-07 07:56:16 +010072GFIO_OBJS = $(OBJS) gfio.o graph.o tickmarks.o
Jens Axboe79d16312010-03-04 12:43:20 +010073
Jens Axboe61f78f32011-10-05 10:25:54 +020074T_SMALLOC_OBJS = t/stest.o
75T_SMALLOC_OBJS += mutex.o smalloc.o t/log.o
76T_SMALLOC_PROGS = t/stest
77
78T_IEEE_OBJS = t/ieee754.o
79T_IEEE_OBJS += ieee754.o
80T_IEEE_PROGS = t/ieee754
81
82T_OBJS = $(T_SMALLOC_OBJS)
83T_OBJS += $(T_IEEE_OBJS)
Jens Axboe34272072011-08-16 10:01:03 +020084
Jens Axboe4c3ecec2008-03-01 16:20:13 +010085ifneq ($(findstring $(MAKEFLAGS),s),s)
86ifndef V
87 QUIET_CC = @echo ' ' CC $@;
Jens Axboe0b2d6a72008-03-03 12:20:26 +010088 QUIET_DEP = @echo ' ' DEP $@;
Jens Axboe4c3ecec2008-03-01 16:20:13 +010089endif
90endif
91
Jens Axboec1d57252006-10-09 19:56:04 +020092INSTALL = install
93prefix = /usr/local
94bindir = $(prefix)/bin
Jens Axboebcdf7c52012-02-08 14:19:27 +010095
96ifeq ($(UNAME), Darwin)
97mandir = /usr/share/man
98else
Aaron Carrolld60e92d2007-09-17 10:32:59 +020099mandir = $(prefix)/man
Jens Axboebcdf7c52012-02-08 14:19:27 +0100100endif
Jens Axboec1d57252006-10-09 19:56:04 +0200101
Michael Zappef84622e2011-06-01 20:15:18 +0200102all: .depend $(PROGS) $(SCRIPTS)
103
104.c.o: .depend
Bruce Cran9b836562011-01-08 19:49:54 +0100105 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
Diego Elio Pettenòe52947d2011-03-21 20:13:53 +0100106
Jens Axboe70d07ce2012-02-24 13:11:35 +0100107gfio.o: gfio.c
108 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gfio.c
109
Stephen M. Cameronaf58ef32012-03-07 07:56:16 +0100110graph.o: graph.c graph.h
111 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c graph.c
112
Jens Axboe61f78f32011-10-05 10:25:54 +0200113t/stest: $(T_SMALLOC_OBJS)
114 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS)
115
116t/ieee754: $(T_IEEE_OBJS)
117 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS)
Jens Axboefbc27922011-08-16 09:56:27 +0200118
Stephen M. Cameron8232e282012-02-24 08:17:31 +0100119fio: $(FIO_OBJS)
120 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(FIO_OBJS) $(LIBS) $(LDFLAGS)
Jens Axboe4c3ecec2008-03-01 16:20:13 +0100121
Jens Axboe70d07ce2012-02-24 13:11:35 +0100122gfio: $(GFIO_OBJS)
123 $(QUIET_CC)$(CC) $(LIBS) -o gfio $(GFIO_OBJS) $(LIBS) $(GTK_LDFLAGS)
124
Michael Zappef84622e2011-06-01 20:15:18 +0200125.depend: $(SOURCE)
Bruce Cran9b836562011-01-08 19:49:54 +0100126 $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend
Jens Axboe0b2d6a72008-03-03 12:20:26 +0100127
Michael Zappef84622e2011-06-01 20:15:18 +0200128$(PROGS): .depend
Jens Axboeebac4652005-12-08 15:25:21 +0100129
130clean:
Jens Axboe76792ac2012-03-12 15:17:12 +0100131 -rm -f .depend $(GFIO_OBJS) $(FIO_OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core gfio
Jens Axboeebac4652005-12-08 15:25:21 +0100132
Jens Axboe592ef982006-06-06 20:58:57 +0200133cscope:
Jens Axboe366badd2010-07-19 16:18:35 -0600134 @cscope -b -R
Jens Axboe592ef982006-06-06 20:58:57 +0200135
Jens Axboeebac4652005-12-08 15:25:21 +0100136install: $(PROGS) $(SCRIPTS)
Jens Axboe513ba3f2011-04-29 08:24:10 +0200137 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
Jens Axboeebac4652005-12-08 15:25:21 +0100138 $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
Aaron Carrolld60e92d2007-09-17 10:32:59 +0200139 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
140 $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1
Jens Axboeccd4f412009-05-20 11:36:39 +0200141 $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1
Jens Axboeebac4652005-12-08 15:25:21 +0100142
Jens Axboe06fecb42008-03-03 12:22:19 +0100143ifneq ($(wildcard .depend),)
144include .depend
145endif
Stephen M. Cameronff1f3282012-02-24 08:17:30 +0100146
Stephen M. Cameronff1f3282012-02-24 08:17:30 +0100147