Add a simple test for LFSR generator
[fio.git] / Makefile
CommitLineData
79e48f72 1DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
44404c5a 2CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(DEBUGFLAGS)
b14c9ed7 3OPTFLAGS= -O3 -g -ffast-math $(EXTFLAGS)
d015e398 4CFLAGS = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS)
b6cf38f0 5LIBS = -lm $(EXTLIBS)
ebac4655
JA
6PROGS = fio
7SCRIPTS = fio_generate_plots
d015e398
BC
8UNAME := $(shell uname)
9
67bf9823
JA
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
93bcfd20 24SOURCE := 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
34ifdef CONFIG_64BIT_LLP64
35 CFLAGS += -DBITS_PER_LONG=32
36endif
67bf9823
JA
37ifdef CONFIG_64BIT
38 CFLAGS += -DBITS_PER_LONG=64
39endif
40ifdef CONFIG_32BIT
41 CFLAGS += -DBITS_PER_LONG=32
42endif
67bf9823 43ifdef CONFIG_LIBAIO
67bf9823
JA
44 SOURCE += engines/libaio.c
45endif
46ifdef CONFIG_RDMA
67bf9823
JA
47 SOURCE += engines/rdma.c
48endif
49ifdef CONFIG_POSIXAIO
67bf9823
JA
50 SOURCE += engines/posixaio.c
51endif
52ifdef CONFIG_LINUX_FALLOCATE
53 SOURCE += engines/falloc.c
54endif
55ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
56 SOURCE += engines/e4defrag.c
57endif
58ifdef CONFIG_LINUX_SPLICE
67bf9823
JA
59 SOURCE += engines/splice.c
60endif
61ifdef CONFIG_GUASI
67bf9823
JA
62 SOURCE += engines/guasi.c
63endif
64ifdef CONFIG_FUSION_AW
67bf9823
JA
65 SOURCE += engines/fusion-aw.c
66endif
67ifdef CONFIG_SOLARISAIO
67bf9823
JA
68 SOURCE += engines/solarisaio.c
69endif
4700b234 70ifdef CONFIG_WINDOWSAIO
4700b234
JA
71 SOURCE += engines/windowsaio.c
72endif
67bf9823 73ifndef CONFIG_STRSEP
67bf9823
JA
74 SOURCE += lib/strsep.c
75endif
76ifndef CONFIG_GETOPT_LONG_ONLY
67bf9823
JA
77 SOURCE += lib/getopt_long.c
78endif
67bf9823 79ifndef CONFIG_INET_ATON
67bf9823
JA
80 SOURCE += lib/inet_aton.c
81endif
d015e398
BC
82
83ifeq ($(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 88endif
ec5c6b12 89ifeq ($(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 93endif
d015e398 94ifeq ($(UNAME), SunOS)
7366ad05 95 LIBS += -lpthread -ldl
d015e398
BC
96 CPPFLAGS += -D__EXTENSIONS__
97endif
98ifeq ($(UNAME), FreeBSD)
d015e398 99 LIBS += -lpthread -lrt
213a01b0 100 LDFLAGS += -rdynamic
d015e398
BC
101endif
102ifeq ($(UNAME), NetBSD)
d015e398 103 LIBS += -lpthread -lrt
213a01b0 104 LDFLAGS += -rdynamic
d015e398
BC
105endif
106ifeq ($(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 110endif
c00a2289 111ifeq ($(UNAME), HP-UX)
b5ffb752 112 LIBS += -lpthread -ldl -lrt
67bf9823 113 CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED
c00a2289 114endif
d015e398 115ifeq ($(UNAME), Darwin)
d015e398
BC
116 LIBS += -lpthread -ldl
117endif
118ifneq (,$(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
123endif
124
9b836561 125OBJS = $(SOURCE:.c=.o)
f67d6ee2 126-include $(OBJS:.o=.d)
79d16311 127
61f78f3a 128T_SMALLOC_OBJS = t/stest.o
39ab7da2 129T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o
61f78f3a
JA
130T_SMALLOC_PROGS = t/stest
131
132T_IEEE_OBJS = t/ieee754.o
f98f3d07 133T_IEEE_OBJS += lib/ieee754.o
61f78f3a
JA
134T_IEEE_PROGS = t/ieee754
135
6ff38856 136T_ZIPF_OBS = t/genzipf.o
24baa4c7 137T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o
eed3f518 138T_ZIPF_PROGS = t/genzipf
6ff38856 139
ad1f90aa
JA
140T_AXMAP_OBJS = t/axmap.o
141T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o
142T_AXMAP_PROGS = t/axmap
143
7a887ffe
AP
144T_LFSR_TEST_OBJS = t/lfsr-test.o
145T_LFSR_TEST_OBJS += lib/lfsr.o
146T_LFSR_TEST_PROGS = t/lfsr-test
147
61f78f3a
JA
148T_OBJS = $(T_SMALLOC_OBJS)
149T_OBJS += $(T_IEEE_OBJS)
6ff38856 150T_OBJS += $(T_ZIPF_OBJS)
ad1f90aa 151T_OBJS += $(T_AXMAP_OBJS)
7a887ffe 152T_OBJS += $(T_LFSR_TEST_OBJS)
6ff38856
JA
153
154T_PROGS = $(T_SMALLOC_PROGS)
155T_PROGS += $(T_IEEE_PROGS)
156T_PROGS += $(T_ZIPF_PROGS)
ad1f90aa 157T_PROGS += $(T_AXMAP_PROGS)
7a887ffe 158T_PROGS += $(T_LFSR_TEST_PROGS)
3427207d 159
4c3ecec4
JA
160ifneq ($(findstring $(MAKEFLAGS),s),s)
161ifndef V
162 QUIET_CC = @echo ' ' CC $@;
6ce038de 163 QUIET_LINK = @echo ' ' LINK $@;
0b2d6a7a 164 QUIET_DEP = @echo ' ' DEP $@;
4c3ecec4
JA
165endif
166endif
167
c1d5725e
JA
168INSTALL = install
169prefix = /usr/local
170bindir = $(prefix)/bin
bcdf7c58
JA
171
172ifeq ($(UNAME), Darwin)
173mandir = /usr/share/man
174else
d60e92d1 175mandir = $(prefix)/man
bcdf7c58 176endif
c1d5725e 177
f67d6ee2 178all: $(PROGS) $(SCRIPTS) FORCE
f84622e9 179
692a5d22
JA
180.PHONY: all install clean
181.PHONY: FORCE cscope
182
183FIO-VERSION-FILE: FORCE
84306c1d 184 @$(SHELL) ./FIO-VERSION-GEN
692a5d22
JA
185-include FIO-VERSION-FILE
186
7496ea3e 187override 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 198init.o: FIO-VERSION-FILE init.c
4feafb1e 199 $(QUIET_CC)$(CC) -o init.o $(CFLAGS) $(CPPFLAGS) -c init.c
a6204b68 200
61f78f3a 201t/stest: $(T_SMALLOC_OBJS)
6ce038de 202 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS)
61f78f3a
JA
203
204t/ieee754: $(T_IEEE_OBJS)
6ce038de 205 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS)
fbc2792b 206
6ff38856 207t/genzipf: $(T_ZIPF_OBJS)
6ce038de 208 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS) $(LDFLAGS)
6ff38856 209
ad1f90aa 210t/axmap: $(T_AXMAP_OBJS)
6ce038de 211 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_AXMAP_OBJS) $(LIBS) $(LDFLAGS)
ad1f90aa 212
7a887ffe
AP
213t/lfsr-test: $(T_LFSR_TEST_OBJS)
214 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_LFSR_TEST_OBJS) $(LIBS) $(LDFLAGS)
215
2f9ade3c 216fio: $(OBJS)
6ce038de 217 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
4c3ecec4 218
692a5d22 219clean: FORCE
f67d6ee2 220 -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak cscope.out *.d
ebac4655 221
592ef98a 222cscope:
366badd3 223 @cscope -b -R
592ef98a 224
692a5d22 225install: $(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