Makefile revision 91f94d5b88b72c300be4f27ef6630e16af890db6
112cbb469ea5e559b241f6c31693554829e8b8400Jens AxboeDEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG 279e48f72dea1639bcbee310c354938287b6d5790Jens AxboeCPPFLAGS= -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \ 39b8365618309572d8fd2579c8ea3132db89f843fBruce Cran $(DEBUGFLAGS) 49b8365618309572d8fd2579c8ea3132db89f843fBruce CranOPTFLAGS= -O3 -g -ffast-math $(EXTFLAGS) 5c2019d39d690acae7eae9d6a105d2db5a1d9c632Bruce CranCFLAGS = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS) 6d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce CranLIBS = -lm -lz $(EXTLIBS) 7d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce CranPROGS = fio 8ebac4655dd3624f3296ff83be48e0cdc02852f1Jens AxboeSCRIPTS = fio_generate_plots 9ebac4655dd3624f3296ff83be48e0cdc02852f1Jens AxboeUNAME := $(shell uname) 10d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran 11d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranifneq ($(wildcard config-host.mak),) 129b8365618309572d8fd2579c8ea3132db89f843fBruce Cranall: 13d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Craninclude config-host.mak 14d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranconfig-host-mak: configure 15d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran @echo $@ is out-of-date, running configure 1691aea6ec78170ffeb64a2a374ba69bce4986b86fJens Axboe @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh 1791aea6ec78170ffeb64a2a374ba69bce4986b86fJens Axboeelse 18d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranconfig-host.mak: 19d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran @echo "Running configure for you..." 20d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran @./configure 21d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranall: 22d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Craninclude config-host.mak 23d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranendif 24d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran 25d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranifdef CONFIG_GFIO 26d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran PROGS += gfio 27d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranendif 2833c142be80a031dfd9ad4f8237b73f4741648fa1Jens Axboe 29d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce CranSOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \ 30d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \ 31d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran lib/rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \ 32d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \ 33d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran engines/mmap.c engines/sync.c engines/null.c engines/net.c \ 34d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \ 35d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran cconv.c lib/prio_tree.c json.c lib/zipf.c lib/axmap.c \ 36d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \ 37d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran lib/hweight.c 38d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran 39d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranifdef CONFIG_64BIT_LLP64 40d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran CFLAGS += -DBITS_PER_LONG=32 41d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranendif 42d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranifdef CONFIG_64BIT 43d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran CFLAGS += -DBITS_PER_LONG=64 44d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranendif 45d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranifdef CONFIG_32BIT 46d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran CFLAGS += -DBITS_PER_LONG=32 47d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranendif 48d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranifdef CONFIG_BIG_ENDIAN 49d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran CFLAGS += -DCONFIG_BIG_ENDIAN 50d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranendif 51d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranifdef CONFIG_LITTLE_ENDIAN 52d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran CFLAGS += -DCONFIG_LITTLE_ENDIAN 53d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranendif 54d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranifdef CONFIG_LIBAIO 55d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran CFLAGS += -DCONFIG_LIBAIO 56d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cran SOURCE += engines/libaio.c 57d015e398e49f1c8d425906b8c1a3861ecc4d851aBruce Cranendif 589b8365618309572d8fd2579c8ea3132db89f843fBruce Cranifdef CONFIG_RDMA 5979d16311c8d0c7188d73df77838fb1b4b6ff58dbJens Axboe CFLAGS += -DCONFIG_RDMA 604c3ecec4160909d7eba4acf1a07a8a0cd36a6365Jens Axboe SOURCE += engines/rdma.c 614c3ecec4160909d7eba4acf1a07a8a0cd36a6365Jens Axboeendif 624c3ecec4160909d7eba4acf1a07a8a0cd36a6365Jens Axboeifdef CONFIG_POSIXAIO 630b2d6a7a2bf9f49502b9c1161f376fff53727089Jens Axboe CFLAGS += -DCONFIG_POSIXAIO 644c3ecec4160909d7eba4acf1a07a8a0cd36a6365Jens Axboe SOURCE += engines/posixaio.c 654c3ecec4160909d7eba4acf1a07a8a0cd36a6365Jens Axboeendif 664c3ecec4160909d7eba4acf1a07a8a0cd36a6365Jens Axboeifdef CONFIG_LINUX_FALLOCATE 67c1d5725eaad49dbf5b3a05c27b0b3677af69f64cJens Axboe SOURCE += engines/falloc.c 68c1d5725eaad49dbf5b3a05c27b0b3677af69f64cJens Axboeendif 69c1d5725eaad49dbf5b3a05c27b0b3677af69f64cJens Axboeifdef CONFIG_LINUX_EXT4_MOVE_EXTENT 70d60e92d13e969b08dcdad940499ef081b07ac6f7Aaron Carroll SOURCE += engines/e4defrag.c 71c1d5725eaad49dbf5b3a05c27b0b3677af69f64cJens Axboeendif 729b8365618309572d8fd2579c8ea3132db89f843fBruce Cranifdef CONFIG_LINUX_SPLICE 739b8365618309572d8fd2579c8ea3132db89f843fBruce Cran CFLAGS += -DCONFIG_LINUX_SPLICE 74e52947d15cf0d7d31c30ccdc43450a10081976daDiego Elio Pettenò SOURCE += engines/splice.c 752f9ade3cb72218eb260f4f5e6914218bdcaa2bccJens Axboeendif 76e52947d15cf0d7d31c30ccdc43450a10081976daDiego Elio Pettenòifdef CONFIG_GUASI 774c3ecec4160909d7eba4acf1a07a8a0cd36a6365Jens Axboe CFLAGS += -DCONFIG_GUASI 780b2d6a7a2bf9f49502b9c1161f376fff53727089Jens Axboe SOURCE += engines/guasi.c 799b8365618309572d8fd2579c8ea3132db89f843fBruce Cranendif 800b2d6a7a2bf9f49502b9c1161f376fff53727089Jens Axboeifdef CONFIG_FUSION_AW 8106fecb4e2679b9783940721f78ea7201451ca55cJens Axboe CFLAGS += -DCONFIG_FUSION_AW 8206fecb4e2679b9783940721f78ea7201451ca55cJens Axboe SOURCE += engines/fusion-aw.c 8306fecb4e2679b9783940721f78ea7201451ca55cJens Axboeendif 84ebac4655dd3624f3296ff83be48e0cdc02852f1Jens Axboeifdef CONFIG_SOLARISAIO 85ebac4655dd3624f3296ff83be48e0cdc02852f1Jens Axboe CFLAGS += -DCONFIG_SOLARISAIO 860d29de831183dfd049c97a03008d425ce21e2fa4Jens Axboe SOURCE += engines/solarisaio.c 87ebac4655dd3624f3296ff83be48e0cdc02852f1Jens Axboeendif 88592ef98a623407437c1807bc29deaa87726de5b4Jens Axboe 89366badd3f5c92433b1972ac85e2b4ef46b441011Jens Axboeifndef CONFIG_STRSEP 90592ef98a623407437c1807bc29deaa87726de5b4Jens Axboe CFLAGS += -DCONFIG_STRSEP 91ebac4655dd3624f3296ff83be48e0cdc02852f1Jens Axboe SOURCE += lib/strsep.c 92ebac4655dd3624f3296ff83be48e0cdc02852f1Jens Axboeendif 93ebac4655dd3624f3296ff83be48e0cdc02852f1Jens Axboeifndef CONFIG_GETOPT_LONG_ONLY 94d60e92d13e969b08dcdad940499ef081b07ac6f7Aaron Carroll CFLAGS += -DCONFIG_GETOPT_LONG_ONLY 95d60e92d13e969b08dcdad940499ef081b07ac6f7Aaron Carroll SOURCE += lib/getopt_long.c 96ccd4f41bbee00837601693dd58589320cb3fa497Jens Axboeendif 97ebac4655dd3624f3296ff83be48e0cdc02852f1Jens Axboe 9806fecb4e2679b9783940721f78ea7201451ca55cJens Axboeifndef CONFIG_INET_ATON 9906fecb4e2679b9783940721f78ea7201451ca55cJens Axboe CFLAGS += -DCONFIG_INET_ATON 10006fecb4e2679b9783940721f78ea7201451ca55cJens Axboe SOURCE += lib/inet_aton.c 101endif 102ifdef CONFIG_CLOCK_GETTIME 103 CFLAGS += -DCONFIG_CLOCK_GETTIME 104endif 105ifdef CONFIG_POSIXAIO_FSYNC 106 CFLAGS += -DCONFIG_POSIXAIO_FSYNC 107endif 108ifdef CONFIG_FADVISE 109 CFLAGS += -DCONFIG_FADVISE 110endif 111ifdef CONFIG_CLOCK_MONOTONIC 112 CFLAGS += -DCONFIG_CLOCK_MONOTONIC 113endif 114ifdef CONFIG_CLOCK_MONOTONIC_PRECISE 115 CFLAGS += -DCONFIG_CLOCK_MONOTONIC_PRECISE 116endif 117ifdef CONFIG_GETTIMEOFDAY 118 CFLAGS += -DCONFIG_GETTIMEOFDAY 119endif 120ifdef CONFIG_SOCKLEN_T 121 CFLAGS += -DCONFIG_SOCKLEN_T 122endif 123ifdef CONFIG_SFAA 124 CFLAGS += -DCONFIG_SFAA 125endif 126ifdef CONFIG_FDATASYNC 127 CFLAGS += -DCONFIG_FDATASYNC 128endif 129ifdef CONFIG_3ARG_AFFINITY 130 CFLAGS += -DCONFIG_3ARG_AFFINITY 131endif 132ifdef CONFIG_2ARG_AFFINITY 133 CFLAGS += -DCONFIG_2ARG_AFFINITY 134endif 135ifdef CONFIG_SYNC_FILE_RANGE 136 CFLAGS += -DCONFIG_SYNC_FILE_RANGE 137endif 138ifdef CONFIG_LIBNUMA 139 CFLAGS += -DCONFIG_LIBNUMA 140endif 141ifdef CONFIG_TLS_THREAD 142 CFLAGS += -DCONFIG_TLS_THREAD 143endif 144ifdef CONFIG_POSIX_FALLOCATE 145 CFLAGS += -DCONFIG_POSIX_FALLOCATE 146endif 147ifdef CONFIG_LINUX_FALLOCATE 148 CFLAGS += -DCONFIG_LINUX_FALLOCATE 149endif 150 151ifeq ($(UNAME), Linux) 152 SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \ 153 engines/binject.c profiles/tiobench.c 154 LIBS += -lpthread -ldl 155 LDFLAGS += -rdynamic 156endif 157ifeq ($(UNAME), Android) 158 SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c 159 LIBS += -ldl 160 LDFLAGS += -rdynamic 161 CPPFLAGS += -DFIO_NO_HAVE_SHM_H 162endif 163ifeq ($(UNAME), SunOS) 164 LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket 165 CPPFLAGS += -D__EXTENSIONS__ 166endif 167ifeq ($(UNAME), FreeBSD) 168 LIBS += -lpthread -lrt 169 LDFLAGS += -rdynamic 170endif 171ifeq ($(UNAME), NetBSD) 172 LIBS += -lpthread -lrt 173 LDFLAGS += -rdynamic 174endif 175ifeq ($(UNAME), AIX) 176 LIBS += -lpthread -ldl -lrt 177 CPPFLAGS += -D_LARGE_FILES -D__ppc__ 178 LDFLAGS += -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000 179endif 180ifeq ($(UNAME), HP-UX) 181 LIBS += -lpthread -ldl -lrt 182 CFLAGS += -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE_EXTENDED 183endif 184ifeq ($(UNAME), Darwin) 185 LIBS += -lpthread -ldl 186endif 187ifneq (,$(findstring CYGWIN,$(UNAME))) 188 SOURCE := $(filter-out engines/mmap.c,$(SOURCE)) 189 SOURCE += engines/windowsaio.c os/windows/posix.c 190 LIBS += -lpthread -lpsapi -lws2_32 191 CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format 192endif 193 194OBJS = $(SOURCE:.c=.o) 195FIO_OBJS = $(OBJS) fio.o 196GFIO_OBJS = $(OBJS) gfio.o graph.o tickmarks.o ghelpers.o goptions.o gerror.o \ 197 gclient.o gcompat.o cairo_text_helpers.o printing.o 198 199T_SMALLOC_OBJS = t/stest.o 200T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o 201T_SMALLOC_PROGS = t/stest 202 203T_IEEE_OBJS = t/ieee754.o 204T_IEEE_OBJS += lib/ieee754.o 205T_IEEE_PROGS = t/ieee754 206 207T_ZIPF_OBS = t/genzipf.o 208T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o 209T_ZIPF_PROGS = t/genzipf 210 211T_AXMAP_OBJS = t/axmap.o 212T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o 213T_AXMAP_PROGS = t/axmap 214 215T_OBJS = $(T_SMALLOC_OBJS) 216T_OBJS += $(T_IEEE_OBJS) 217T_OBJS += $(T_ZIPF_OBJS) 218T_OBJS += $(T_AXMAP_OBJS) 219 220T_PROGS = $(T_SMALLOC_PROGS) 221T_PROGS += $(T_IEEE_PROGS) 222T_PROGS += $(T_ZIPF_PROGS) 223T_PROGS += $(T_AXMAP_PROGS) 224 225ifneq ($(findstring $(MAKEFLAGS),s),s) 226ifndef V 227 QUIET_CC = @echo ' ' CC $@; 228 QUIET_DEP = @echo ' ' DEP $@; 229endif 230endif 231 232INSTALL = install 233prefix = /usr/local 234bindir = $(prefix)/bin 235 236ifeq ($(UNAME), Darwin) 237mandir = /usr/share/man 238else 239mandir = $(prefix)/man 240endif 241 242all: .depend $(PROGS) $(SCRIPTS) FORCE 243 244.PHONY: all install clean 245.PHONY: FORCE cscope 246 247FIO-VERSION-FILE: FORCE 248 @$(SHELL) ./FIO-VERSION-GEN 249-include FIO-VERSION-FILE 250 251CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"' 252 253.c.o: .depend FORCE 254 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $< 255 256init.o: FIO-VERSION-FILE 257 $(QUIET_CC)$(CC) -o init.o -c $(CFLAGS) $(CPPFLAGS) -c init.c 258 259gcompat.o: gcompat.c gcompat.h 260 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gcompat.c 261 262goptions.o: goptions.c goptions.h 263 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c goptions.c 264 265ghelpers.o: ghelpers.c ghelpers.h 266 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c ghelpers.c 267 268gerror.o: gerror.c gerror.h 269 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gerror.c 270 271gclient.o: gclient.c gclient.h 272 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gclient.c 273 274gfio.o: gfio.c ghelpers.c 275 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gfio.c 276 277graph.o: graph.c graph.h 278 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c graph.c 279 280cairo_text_helpers.o: cairo_text_helpers.c cairo_text_helpers.h 281 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c cairo_text_helpers.c 282 283printing.o: printing.c printing.h 284 $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c printing.c 285 286t/stest: $(T_SMALLOC_OBJS) 287 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS) 288 289t/ieee754: $(T_IEEE_OBJS) 290 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS) 291 292fio: $(FIO_OBJS) 293 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(FIO_OBJS) $(LIBS) $(LDFLAGS) 294 295gfio: $(GFIO_OBJS) 296 $(QUIET_CC)$(CC) $(LIBS) -o gfio $(GFIO_OBJS) $(LIBS) $(GTK_LDFLAGS) 297 298t/genzipf: $(T_ZIPF_OBJS) 299 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_ZIPF_OBJS) $(LIBS) $(LDFLAGS) 300 301t/axmap: $(T_AXMAP_OBJS) 302 $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_AXMAP_OBJS) $(LIBS) $(LDFLAGS) 303 304.depend: $(SOURCE) 305 $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend 306 307$(PROGS): .depend 308 309clean: FORCE 310 -rm -f .depend $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core gfio FIO-VERSION-FILE config-host.mak config-host.ld cscope.out 311 312cscope: 313 @cscope -b -R 314 315install: $(PROGS) $(SCRIPTS) FORCE 316 $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) 317 $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir) 318 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 319 $(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1 320 $(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1 321 322ifneq ($(wildcard .depend),) 323include .depend 324endif 325 326 327