Fix t/ieee754 link
[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 \
18 json.c lib/zipf.c
19
20ifeq ($(UNAME), Linux)
21 SOURCE += diskutil.c fifo.c blktrace.c helpers.c cgroup.c trim.c \
22 engines/libaio.c engines/posixaio.c engines/sg.c \
23 engines/splice.c engines/syslet-rw.c engines/guasi.c \
24 engines/binject.c engines/rdma.c profiles/tiobench.c \
25 engines/fusion-aw.c engines/falloc.c engines/e4defrag.c
26 LIBS += -lpthread -ldl -lrt -laio
27 LDFLAGS += -rdynamic
28endif
29ifeq ($(UNAME), SunOS)
30 SOURCE += fifo.c lib/strsep.c helpers.c engines/posixaio.c \
31 engines/solarisaio.c
32 LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket
33 CPPFLAGS += -D__EXTENSIONS__
34endif
35ifeq ($(UNAME), FreeBSD)
36 SOURCE += helpers.c engines/posixaio.c
37 LIBS += -lpthread -lrt
38 LDFLAGS += -rdynamic
39endif
40ifeq ($(UNAME), NetBSD)
41 SOURCE += helpers.c engines/posixaio.c
42 LIBS += -lpthread -lrt
43 LDFLAGS += -rdynamic
44endif
45ifeq ($(UNAME), AIX)
46 SOURCE += fifo.c helpers.c lib/getopt_long.c engines/posixaio.c
47 LIBS += -lpthread -ldl -lrt
48 CPPFLAGS += -D_LARGE_FILES -D__ppc__
49 LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000
50endif
51ifeq ($(UNAME), HP-UX)
52 SOURCE += fifo.c helpers.c lib/getopt_long.c lib/strsep.c engines/posixaio.c
53 LIBS += -lpthread -ldl -lrt
54 CFLAGS += -D_LARGEFILE64_SOURCE
55endif
56ifeq ($(UNAME), Darwin)
57 SOURCE += helpers.c engines/posixaio.c
58 LIBS += -lpthread -ldl
59endif
60ifneq (,$(findstring CYGWIN,$(UNAME)))
61 SOURCE := $(filter-out engines/mmap.c,$(SOURCE))
62 SOURCE += engines/windowsaio.c os/windows/posix.c
63 LIBS += -lpthread -lpsapi -lws2_32
64 CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format
65 CC = x86_64-w64-mingw32-gcc
66 #CC = i686-w64-mingw32-gcc
67endif
68
69OBJS = $(SOURCE:.c=.o)
70
71T_SMALLOC_OBJS = t/stest.o
72T_SMALLOC_OBJS += mutex.o smalloc.o t/log.o
73T_SMALLOC_PROGS = t/stest
74
75T_IEEE_OBJS = t/ieee754.o
76T_IEEE_OBJS += lib/ieee754.o
77T_IEEE_PROGS = t/ieee754
78
79T_ZIPF_OBS = t/genzipf.o
80T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o
81T_ZIPF_PROGS = t/genzip
82
83T_OBJS = $(T_SMALLOC_OBJS)
84T_OBJS += $(T_IEEE_OBJS)
85T_OBJS += $(T_ZIPF_OBJS)
86
87T_PROGS = $(T_SMALLOC_PROGS)
88T_PROGS += $(T_IEEE_PROGS)
89T_PROGS += $(T_ZIPF_PROGS)
90
91ifneq ($(findstring $(MAKEFLAGS),s),s)
92ifndef V
93 QUIET_CC = @echo ' ' CC $@;
94 QUIET_DEP = @echo ' ' DEP $@;
95endif
96endif
97
98INSTALL = install
99prefix = /usr/local
100bindir = $(prefix)/bin
101
102ifeq ($(UNAME), Darwin)
103mandir = /usr/share/man
104else
105mandir = $(prefix)/man
106endif
107
108all: .depend $(PROGS) $(SCRIPTS) FORCE
109
110.PHONY: all install clean
111.PHONY: FORCE cscope
112
113FIO-VERSION-FILE: FORCE
114 @$(SHELL) ./FIO-VERSION-GEN
115-include FIO-VERSION-FILE
116
117CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
118
119.c.o: .depend FORCE
120 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
121
122init.o: FIO-VERSION-FILE
123 $(QUIET_CC)$(CC) -o init.o -c $(CFLAGS) $(CPPFLAGS) -c init.c
124
125t/stest: $(T_SMALLOC_OBJS)
126 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS)
127
128t/ieee754: $(T_IEEE_OBJS)
129 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS)
130
131t/genzipf: $(T_ZIPF_OBJS)
132 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS) $(LDFLAGS)
133
134fio: $(OBJS)
135 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
136
137.depend: $(SOURCE)
138 $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend
139
140$(PROGS): .depend
141
142clean: FORCE
143 -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE
144
145cscope:
146 @cscope -b -R
147
148install: $(PROGS) $(SCRIPTS) FORCE
149 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
150 $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
151 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
152 $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1
153 $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1
154
155ifneq ($(wildcard .depend),)
156include .depend
157endif