Makefile: remove config-host.ld
[fio.git] / Makefile
... / ...
CommitLineData
1DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
2CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(DEBUGFLAGS)
3OPTFLAGS= -O3 -g -ffast-math $(EXTFLAGS)
4CFLAGS = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS)
5LIBS = -lm $(EXTLIBS)
6PROGS = fio
7SCRIPTS = fio_generate_plots
8UNAME := $(shell uname)
9
10ifneq ($(wildcard config-host.mak),)
11all:
12include config-host.mak
13config-host-mak: configure
14 @echo $@ is out-of-date, running configure
15 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
16else
17config-host.mak:
18 @echo "Running configure for you..."
19 @./configure
20all:
21include config-host.mak
22endif
23
24SOURCE := gettime.c fio.c ioengines.c init.c stat.c log.c time.c filesetup.c \
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 \
27 lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \
28 engines/mmap.c engines/sync.c engines/null.c engines/net.c \
29 memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \
30 json.c lib/zipf.c lib/axmap.c lib/lfsr.c gettime-thread.c \
31 helpers.c lib/flist_sort.c lib/hweight.c lib/getrusage.c
32
33ifdef CONFIG_64BIT_LLP64
34 CFLAGS += -DBITS_PER_LONG=32
35endif
36ifdef CONFIG_64BIT
37 CFLAGS += -DBITS_PER_LONG=64
38endif
39ifdef CONFIG_32BIT
40 CFLAGS += -DBITS_PER_LONG=32
41endif
42ifdef CONFIG_LIBAIO
43 SOURCE += engines/libaio.c
44endif
45ifdef CONFIG_RDMA
46 SOURCE += engines/rdma.c
47endif
48ifdef CONFIG_POSIXAIO
49 SOURCE += engines/posixaio.c
50endif
51ifdef CONFIG_LINUX_FALLOCATE
52 SOURCE += engines/falloc.c
53endif
54ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
55 SOURCE += engines/e4defrag.c
56endif
57ifdef CONFIG_LINUX_SPLICE
58 SOURCE += engines/splice.c
59endif
60ifdef CONFIG_GUASI
61 SOURCE += engines/guasi.c
62endif
63ifdef CONFIG_FUSION_AW
64 SOURCE += engines/fusion-aw.c
65endif
66ifdef CONFIG_SOLARISAIO
67 SOURCE += engines/solarisaio.c
68endif
69ifdef CONFIG_WINDOWSAIO
70 SOURCE += engines/windowsaio.c
71endif
72ifndef CONFIG_STRSEP
73 SOURCE += lib/strsep.c
74endif
75ifndef CONFIG_GETOPT_LONG_ONLY
76 SOURCE += lib/getopt_long.c
77endif
78ifndef CONFIG_INET_ATON
79 SOURCE += lib/inet_aton.c
80endif
81
82ifeq ($(UNAME), Linux)
83 SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \
84 engines/binject.c profiles/tiobench.c
85 LIBS += -lpthread -ldl
86 LDFLAGS += -rdynamic
87endif
88ifeq ($(UNAME), Android)
89 SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c
90 LIBS += -ldl
91 LDFLAGS += -rdynamic
92 CPPFLAGS += -DFIO_NO_HAVE_SHM_H
93endif
94ifeq ($(UNAME), SunOS)
95 LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket
96 CPPFLAGS += -D__EXTENSIONS__
97endif
98ifeq ($(UNAME), FreeBSD)
99 LIBS += -lpthread -lrt
100 LDFLAGS += -rdynamic
101endif
102ifeq ($(UNAME), NetBSD)
103 LIBS += -lpthread -lrt
104 LDFLAGS += -rdynamic
105endif
106ifeq ($(UNAME), AIX)
107 LIBS += -lpthread -ldl -lrt
108 CPPFLAGS += -D_LARGE_FILES -D__ppc__
109 LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000
110endif
111ifeq ($(UNAME), HP-UX)
112 LIBS += -lpthread -ldl -lrt
113 CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED
114endif
115ifeq ($(UNAME), Darwin)
116 LIBS += -lpthread -ldl
117endif
118ifneq (,$(findstring CYGWIN,$(UNAME)))
119 SOURCE := $(filter-out engines/mmap.c,$(SOURCE))
120 SOURCE += os/windows/posix.c
121 LIBS += -lpthread -lpsapi -lws2_32
122 CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format
123endif
124
125OBJS = $(SOURCE:.c=.o)
126
127T_SMALLOC_OBJS = t/stest.o
128T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o
129T_SMALLOC_PROGS = t/stest
130
131T_IEEE_OBJS = t/ieee754.o
132T_IEEE_OBJS += lib/ieee754.o
133T_IEEE_PROGS = t/ieee754
134
135T_ZIPF_OBS = t/genzipf.o
136T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o
137T_ZIPF_PROGS = t/genzipf
138
139T_AXMAP_OBJS = t/axmap.o
140T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o
141T_AXMAP_PROGS = t/axmap
142
143T_OBJS = $(T_SMALLOC_OBJS)
144T_OBJS += $(T_IEEE_OBJS)
145T_OBJS += $(T_ZIPF_OBJS)
146T_OBJS += $(T_AXMAP_OBJS)
147
148T_PROGS = $(T_SMALLOC_PROGS)
149T_PROGS += $(T_IEEE_PROGS)
150T_PROGS += $(T_ZIPF_PROGS)
151T_PROGS += $(T_AXMAP_PROGS)
152
153ifneq ($(findstring $(MAKEFLAGS),s),s)
154ifndef V
155 QUIET_CC = @echo ' ' CC $@;
156 QUIET_DEP = @echo ' ' DEP $@;
157endif
158endif
159
160INSTALL = install
161prefix = /usr/local
162bindir = $(prefix)/bin
163
164ifeq ($(UNAME), Darwin)
165mandir = /usr/share/man
166else
167mandir = $(prefix)/man
168endif
169
170all: .depend $(PROGS) $(SCRIPTS) FORCE
171
172.PHONY: all install clean
173.PHONY: FORCE cscope
174
175FIO-VERSION-FILE: FORCE
176 @$(SHELL) ./FIO-VERSION-GEN
177-include FIO-VERSION-FILE
178
179CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
180
181.c.o: .depend FORCE
182 $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
183
184init.o: FIO-VERSION-FILE
185 $(QUIET_CC)$(CC) -o init.o $(CFLAGS) $(CPPFLAGS) -c init.c
186
187t/stest: $(T_SMALLOC_OBJS)
188 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS)
189
190t/ieee754: $(T_IEEE_OBJS)
191 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS)
192
193t/genzipf: $(T_ZIPF_OBJS)
194 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS) $(LDFLAGS)
195
196t/axmap: $(T_AXMAP_OBJS)
197 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_AXMAP_OBJS) $(LIBS) $(LDFLAGS)
198
199fio: $(OBJS)
200 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
201
202.depend: $(SOURCE)
203 $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend
204
205$(PROGS): .depend
206
207clean: FORCE
208 -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak cscope.out
209
210cscope:
211 @cscope -b -R
212
213install: $(PROGS) $(SCRIPTS) FORCE
214 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
215 $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
216 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
217 $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1
218 $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1
219
220ifneq ($(wildcard .depend),)
221include .depend
222endif