Makefile revision 9db01ef976006c002b05fa4e4ec589eb029aac5b
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 -lz $(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 24ifdef CONFIG_GFIO 25 PROGS += gfio 26endif 27 28SOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \ 29 eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \ 30 lib/rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \ 31 lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \ 32 engines/mmap.c engines/sync.c engines/null.c engines/net.c \ 33 memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \ 34 cconv.c lib/prio_tree.c json.c lib/zipf.c lib/axmap.c \ 35 lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \ 36 lib/hweight.c lib/getrusage.c idletime.c 37 38ifdef CONFIG_64BIT_LLP64 39 CFLAGS += -DBITS_PER_LONG=32 40endif 41ifdef CONFIG_64BIT 42 CFLAGS += -DBITS_PER_LONG=64 43endif 44ifdef CONFIG_32BIT 45 CFLAGS += -DBITS_PER_LONG=32 46endif 47ifdef CONFIG_LIBAIO 48 SOURCE += engines/libaio.c 49endif 50ifdef CONFIG_RDMA 51 SOURCE += engines/rdma.c 52endif 53ifdef CONFIG_POSIXAIO 54 SOURCE += engines/posixaio.c 55endif 56ifdef CONFIG_LINUX_FALLOCATE 57 SOURCE += engines/falloc.c 58endif 59ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT 60 SOURCE += engines/e4defrag.c 61endif 62ifdef CONFIG_LINUX_SPLICE 63 SOURCE += engines/splice.c 64endif 65ifdef CONFIG_GUASI 66 SOURCE += engines/guasi.c 67endif 68ifdef CONFIG_FUSION_AW 69 SOURCE += engines/fusion-aw.c 70endif 71ifdef CONFIG_SOLARISAIO 72 SOURCE += engines/solarisaio.c 73endif 74ifdef CONFIG_WINDOWSAIO 75 SOURCE += engines/windowsaio.c 76endif 77ifndef CONFIG_STRSEP 78 SOURCE += lib/strsep.c 79endif 80ifndef CONFIG_GETOPT_LONG_ONLY 81 SOURCE += lib/getopt_long.c 82endif 83ifndef CONFIG_INET_ATON 84 SOURCE += lib/inet_aton.c 85endif 86 87ifeq ($(UNAME), Linux) 88 SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \ 89 engines/binject.c profiles/tiobench.c 90 LIBS += -lpthread -ldl 91 LDFLAGS += -rdynamic 92endif 93ifeq ($(UNAME), Android) 94 SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c 95 LIBS += -ldl 96 LDFLAGS += -rdynamic 97 CPPFLAGS += -DFIO_NO_HAVE_SHM_H 98endif 99ifeq ($(UNAME), SunOS) 100 LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket 101 CPPFLAGS += -D__EXTENSIONS__ 102endif 103ifeq ($(UNAME), FreeBSD) 104 LIBS += -lpthread -lrt 105 LDFLAGS += -rdynamic 106endif 107ifeq ($(UNAME), NetBSD) 108 LIBS += -lpthread -lrt 109 LDFLAGS += -rdynamic 110endif 111ifeq ($(UNAME), AIX) 112 LIBS += -lpthread -ldl -lrt 113 CPPFLAGS += -D_LARGE_FILES -D__ppc__ 114 LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000 115endif 116ifeq ($(UNAME), HP-UX) 117 LIBS += -lpthread -ldl -lrt 118 CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED 119endif 120ifeq ($(UNAME), Darwin) 121 LIBS += -lpthread -ldl 122endif 123ifneq (,$(findstring CYGWIN,$(UNAME))) 124 SOURCE := $(filter-out engines/mmap.c,$(SOURCE)) 125 SOURCE += os/windows/posix.c 126 LIBS += -lpthread -lpsapi -lws2_32 127 CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format 128endif 129 130OBJS = $(SOURCE:.c=.o) 131 132FIO_OBJS = $(OBJS) fio.o 133GFIO_OBJS = $(OBJS) gfio.o graph.o tickmarks.o ghelpers.o goptions.o gerror.o \ 134 gclient.o gcompat.o cairo_text_helpers.o printing.o 135 136-include $(OBJS:.o=.d) 137 138T_SMALLOC_OBJS = t/stest.o 139T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o 140T_SMALLOC_PROGS = t/stest 141 142T_IEEE_OBJS = t/ieee754.o 143T_IEEE_OBJS += lib/ieee754.o 144T_IEEE_PROGS = t/ieee754 145 146T_ZIPF_OBS = t/genzipf.o 147T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o 148T_ZIPF_PROGS = t/genzipf 149 150T_AXMAP_OBJS = t/axmap.o 151T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o 152T_AXMAP_PROGS = t/axmap 153 154T_OBJS = $(T_SMALLOC_OBJS) 155T_OBJS += $(T_IEEE_OBJS) 156T_OBJS += $(T_ZIPF_OBJS) 157T_OBJS += $(T_AXMAP_OBJS) 158 159T_PROGS = $(T_SMALLOC_PROGS) 160T_PROGS += $(T_IEEE_PROGS) 161T_PROGS += $(T_ZIPF_PROGS) 162T_PROGS += $(T_AXMAP_PROGS) 163 164ifneq ($(findstring $(MAKEFLAGS),s),s) 165ifndef V 166 QUIET_CC = @echo ' ' CC $@; 167 QUIET_LINK = @echo ' ' LINK $@; 168 QUIET_DEP = @echo ' ' DEP $@; 169endif 170endif 171 172INSTALL = install 173prefix = /usr/local 174bindir = $(prefix)/bin 175 176ifeq ($(UNAME), Darwin) 177mandir = /usr/share/man 178else 179mandir = $(prefix)/man 180endif 181 182all: $(PROGS) $(SCRIPTS) FORCE 183 184.PHONY: all install clean 185.PHONY: FORCE cscope 186 187FIO-VERSION-FILE: FORCE 188 @$(SHELL) ./FIO-VERSION-GEN 189-include FIO-VERSION-FILE 190 191override CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"' 192 193.c.o: FORCE FIO-VERSION-FILE 194 $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $< 195 @$(CC) -MM $(CFLAGS) $(CPPFLAGS) $*.c > $*.d 196 @mv -f $*.d $*.d.tmp 197 @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d 198 @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ 199 sed -e 's/^ *//' -e 's/$$/:/' >> $*.d 200 @rm -f $*.d.tmp 201 202init.o: FIO-VERSION-FILE init.c 203 $(QUIET_CC)$(CC) -o init.o $(CFLAGS) $(CPPFLAGS) -c init.c 204 205gcompat.o: gcompat.c gcompat.h 206 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gcompat.c 207 208goptions.o: goptions.c goptions.h 209 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c goptions.c 210 211ghelpers.o: ghelpers.c ghelpers.h 212 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c ghelpers.c 213 214gerror.o: gerror.c gerror.h 215 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gerror.c 216 217gclient.o: gclient.c gclient.h 218 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gclient.c 219 220gfio.o: gfio.c ghelpers.c 221 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gfio.c 222 223graph.o: graph.c graph.h 224 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c graph.c 225 226cairo_text_helpers.o: cairo_text_helpers.c cairo_text_helpers.h 227 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c cairo_text_helpers.c 228 229printing.o: printing.c printing.h 230 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c printing.c 231 232t/stest: $(T_SMALLOC_OBJS) 233 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS) 234 235t/ieee754: $(T_IEEE_OBJS) 236 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS) 237 238fio: $(FIO_OBJS) 239 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(FIO_OBJS) $(LIBS) $(LDFLAGS) 240 241gfio: $(GFIO_OBJS) 242 $(QUIET_LINK)$(CC) $(LIBS) -o gfio $(GFIO_OBJS) $(LIBS) $(GTK_LDFLAGS) 243 244t/genzipf: $(T_ZIPF_OBJS) 245 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS) $(LDFLAGS) 246 247t/axmap: $(T_AXMAP_OBJS) 248 $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_AXMAP_OBJS) $(LIBS) $(LDFLAGS) 249 250clean: FORCE 251 -rm -f .depend $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core gfio FIO-VERSION-FILE config-host.mak cscope.out *.d 252 253cscope: 254 @cscope -b -R 255 256install: $(PROGS) $(SCRIPTS) FORCE 257 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) 258 $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir) 259 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 260 $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1 261 $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1 262