X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=Makefile;h=d7e5fca73082e715bfc898c41602ce514cbc94b7;hp=262ceeaa4ae44d5a2a6f83550ab1ecccf661c06d;hb=de5ed0e4d398bc9d4576f9b2b82d7686989c27e1;hpb=cbb15e42804b46917834be2e34a76a57e6553957 diff --git a/Makefile b/Makefile index 262ceeaa..d7e5fca7 100644 --- a/Makefile +++ b/Makefile @@ -4,59 +4,67 @@ endif VPATH := $(SRCDIR) -ifneq ($(wildcard config-host.mak),) -all: -include config-host.mak -config-host-mak: configure - @echo $@ is out-of-date, running configure - @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh -else -config-host.mak: +all: fio + +config-host.mak: configure + @if [ ! -e "$@" ]; then \ + echo "Running configure ..."; \ + ./configure; \ + else \ + echo "$@ is out-of-date, running configure"; \ + sed -n "/.*Configured with/s/[^:]*: //p" "$@" | sh; \ + fi + ifneq ($(MAKECMDGOALS),clean) - @echo "Running configure for you..." - @./configure -endif -all: include config-host.mak endif -DEBUGFLAGS = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG +DEBUGFLAGS = -DFIO_INC_DEBUG CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFIO_INTERNAL $(DEBUGFLAGS) OPTFLAGS= -g -ffast-math CFLAGS = -std=gnu99 -Wwrite-strings -Wall -Wdeclaration-after-statement $(OPTFLAGS) $(EXTFLAGS) $(BUILD_CFLAGS) -I. -I$(SRCDIR) LIBS += -lm $(EXTLIBS) PROGS = fio -SCRIPTS = $(addprefix $(SRCDIR)/,tools/fio_generate_plots tools/plot/fio2gnuplot tools/genfio tools/fiologparser.py tools/fio_latency2csv.py tools/hist/fiologparser_hist.py) +SCRIPTS = $(addprefix $(SRCDIR)/,tools/fio_generate_plots tools/plot/fio2gnuplot tools/genfio tools/fiologparser.py tools/hist/fiologparser_hist.py tools/fio_jsonplus_clat2csv) ifndef CONFIG_FIO_NO_OPT - CFLAGS += -O3 + CFLAGS += -O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 +endif +ifdef CONFIG_BUILD_NATIVE + CFLAGS += -march=native endif ifdef CONFIG_GFIO PROGS += gfio endif -SOURCE := $(patsubst $(SRCDIR)/%,%,$(wildcard $(SRCDIR)/crc/*.c)) \ - $(patsubst $(SRCDIR)/%,%,$(wildcard $(SRCDIR)/lib/*.c)) \ +SOURCE := $(sort $(patsubst $(SRCDIR)/%,%,$(wildcard $(SRCDIR)/crc/*.c)) \ + $(patsubst $(SRCDIR)/%,%,$(wildcard $(SRCDIR)/lib/*.c))) \ gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \ - eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \ + eta.c verify.c memory.c io_u.c parse.c fio_sem.c rwlock.c \ + pshared.c options.c \ smalloc.c filehash.c profile.c debug.c engines/cpu.c \ engines/mmap.c engines/sync.c engines/null.c engines/net.c \ + engines/ftruncate.c engines/filecreate.c \ server.c client.c iolog.c backend.c libfio.c flow.c cconv.c \ gettime-thread.c helpers.c json.c idletime.c td_error.c \ profiles/tiobench.c profiles/act.c io_u_queue.c filelock.c \ - workqueue.c rate-submit.c optgroup.c helper_thread.c + workqueue.c rate-submit.c optgroup.c helper_thread.c \ + steadystate.c zone-dist.c ifdef CONFIG_LIBHDFS HDFSFLAGS= -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -I $(FIO_LIBHDFS_INCLUDE) - HDFSLIB= -Wl,-rpath $(JAVA_HOME)/jre/lib/$(FIO_HDFS_CPU)/server -L$(JAVA_HOME)/jre/lib/$(FIO_HDFS_CPU)/server -ljvm $(FIO_LIBHDFS_LIB)/libhdfs.a + HDFSLIB= -Wl,-rpath $(JAVA_HOME)/jre/lib/$(FIO_HDFS_CPU)/server -L$(JAVA_HOME)/jre/lib/$(FIO_HDFS_CPU)/server $(FIO_LIBHDFS_LIB)/libhdfs.a -ljvm CFLAGS += $(HDFSFLAGS) SOURCE += engines/libhdfs.c endif -ifdef CONFIG_64BIT_LLP64 - CFLAGS += -DBITS_PER_LONG=32 +ifdef CONFIG_LIBISCSI + CFLAGS += $(LIBISCSI_CFLAGS) + LIBS += $(LIBISCSI_LIBS) + SOURCE += engines/libiscsi.c endif + ifdef CONFIG_64BIT CFLAGS += -DBITS_PER_LONG=64 endif @@ -84,18 +92,22 @@ endif ifdef CONFIG_GUASI SOURCE += engines/guasi.c endif -ifdef CONFIG_FUSION_AW - SOURCE += engines/fusion-aw.c -endif ifdef CONFIG_SOLARISAIO SOURCE += engines/solarisaio.c endif ifdef CONFIG_WINDOWSAIO SOURCE += engines/windowsaio.c endif +ifdef CONFIG_RADOS + SOURCE += engines/rados.c +endif ifdef CONFIG_RBD SOURCE += engines/rbd.c endif +ifdef CONFIG_HTTP + SOURCE += engines/http.c +endif +SOURCE += oslib/asprintf.c ifndef CONFIG_STRSEP SOURCE += oslib/strsep.c endif @@ -105,6 +117,9 @@ endif ifndef CONFIG_STRLCAT SOURCE += oslib/strlcat.c endif +ifndef CONFIG_HAVE_STRNDUP + SOURCE += oslib/strndup.c +endif ifndef CONFIG_GETOPT_LONG_ONLY SOURCE += oslib/getopt_long.c endif @@ -130,15 +145,24 @@ endif ifdef CONFIG_LINUX_DEVDAX SOURCE += engines/dev-dax.c endif +ifdef CONFIG_LIBPMEM + SOURCE += engines/libpmem.c +endif +ifdef CONFIG_IME + SOURCE += engines/ime.c +endif +ifdef CONFIG_LINUX_BLKZONED + SOURCE += zbd.c +endif ifeq ($(CONFIG_TARGET_OS), Linux) SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \ - engines/binject.c oslib/linux-dev-lookup.c + oslib/linux-dev-lookup.c engines/io_uring.c LIBS += -lpthread -ldl LDFLAGS += -rdynamic endif ifeq ($(CONFIG_TARGET_OS), Android) - SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c \ + SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c profiles/tiobench.c \ oslib/linux-dev-lookup.c LIBS += -ldl LDFLAGS += -rdynamic @@ -178,10 +202,9 @@ ifeq ($(CONFIG_TARGET_OS), Darwin) LIBS += -lpthread -ldl endif ifneq (,$(findstring CYGWIN,$(CONFIG_TARGET_OS))) - SOURCE := $(filter-out engines/mmap.c,$(SOURCE)) SOURCE += os/windows/posix.c LIBS += -lpthread -lpsapi -lws2_32 - CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format -static + CFLAGS += -DPSAPI_VERSION=1 -Ios/windows/posix/include -Wno-format endif OBJS := $(SOURCE:.c=.o) @@ -199,7 +222,8 @@ endif -include $(OBJS:.o=.d) T_SMALLOC_OBJS = t/stest.o -T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o t/debug.o t/arch.o +T_SMALLOC_OBJS += gettime.o fio_sem.o pshared.o smalloc.o t/log.o t/debug.o \ + t/arch.o T_SMALLOC_PROGS = t/stest T_IEEE_OBJS = t/ieee754.o @@ -208,7 +232,8 @@ T_IEEE_PROGS = t/ieee754 T_ZIPF_OBS = t/genzipf.o T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/pattern.o lib/zipf.o \ - lib/strntol.o lib/gauss.o t/genzipf.o oslib/strcasestr.o + lib/strntol.o lib/gauss.o t/genzipf.o oslib/strcasestr.o \ + oslib/strndup.o T_ZIPF_PROGS = t/fio-genzipf T_AXMAP_OBJS = t/axmap.o @@ -216,12 +241,13 @@ T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o T_AXMAP_PROGS = t/axmap T_LFSR_TEST_OBJS = t/lfsr-test.o -T_LFSR_TEST_OBJS += lib/lfsr.o gettime.o t/log.o t/debug.o t/arch.o +T_LFSR_TEST_OBJS += lib/lfsr.o gettime.o fio_sem.o pshared.o \ + t/log.o t/debug.o t/arch.o T_LFSR_TEST_PROGS = t/lfsr-test T_GEN_RAND_OBJS = t/gen-rand.o T_GEN_RAND_OBJS += t/log.o t/debug.o lib/rand.o lib/pattern.o lib/strntol.o \ - oslib/strcasestr.o + oslib/strcasestr.o oslib/strndup.o T_GEN_RAND_PROGS = t/gen-rand ifeq ($(CONFIG_TARGET_OS), Linux) @@ -231,20 +257,27 @@ T_BTRACE_FIO_PROGS = t/fio-btrace2fio endif T_DEDUPE_OBJS = t/dedupe.o -T_DEDUPE_OBJS += lib/rbtree.o t/log.o mutex.o smalloc.o gettime.o crc/md5.o \ - lib/memalign.o lib/bloom.o t/debug.o crc/xxhash.o t/arch.o \ - crc/murmur3.o crc/crc32c.o crc/crc32c-intel.o crc/fnv.o +T_DEDUPE_OBJS += lib/rbtree.o t/log.o fio_sem.o pshared.o smalloc.o gettime.o \ + crc/md5.o lib/memalign.o lib/bloom.o t/debug.o crc/xxhash.o \ + t/arch.o crc/murmur3.o crc/crc32c.o crc/crc32c-intel.o \ + crc/crc32c-arm64.o crc/fnv.o T_DEDUPE_PROGS = t/fio-dedupe -T_VS_OBJS = t/verify-state.o t/log.o crc/crc32c.o crc/crc32c-intel.o t/debug.o +T_VS_OBJS = t/verify-state.o t/log.o crc/crc32c.o crc/crc32c-intel.o crc/crc32c-arm64.o t/debug.o T_VS_PROGS = t/fio-verify-state T_PIPE_ASYNC_OBJS = t/read-to-pipe-async.o T_PIPE_ASYNC_PROGS = t/read-to-pipe-async +T_IOU_RING_OBJS = t/io_uring.o +T_IOU_RING_PROGS = t/io_uring + T_MEMLOCK_OBJS = t/memlock.o T_MEMLOCK_PROGS = t/memlock +T_TT_OBJS = t/time-test.o +T_TT_PROGS = t/time-test + T_OBJS = $(T_SMALLOC_OBJS) T_OBJS += $(T_IEEE_OBJS) T_OBJS += $(T_ZIPF_OBJS) @@ -256,6 +289,8 @@ T_OBJS += $(T_DEDUPE_OBJS) T_OBJS += $(T_VS_OBJS) T_OBJS += $(T_PIPE_ASYNC_OBJS) T_OBJS += $(T_MEMLOCK_OBJS) +T_OBJS += $(T_TT_OBJS) +T_OBJS += $(T_IOU_RING_OBJS) ifneq (,$(findstring CYGWIN,$(CONFIG_TARGET_OS))) T_DEDUPE_OBJS += os/windows/posix.o lib/hweight.o @@ -275,6 +310,23 @@ T_PROGS += $(T_VS_PROGS) PROGS += $(T_PROGS) +ifdef CONFIG_HAVE_CUNIT +UT_OBJS = unittests/unittest.o +UT_OBJS += unittests/lib/memalign.o +UT_OBJS += unittests/lib/strntol.o +UT_OBJS += unittests/oslib/strlcat.o +UT_OBJS += unittests/oslib/strndup.o +UT_TARGET_OBJS = lib/memalign.o +UT_TARGET_OBJS += lib/strntol.o +UT_TARGET_OBJS += oslib/strlcat.o +UT_TARGET_OBJS += oslib/strndup.o +UT_PROGS = unittests/unittest +else +UT_OBJS = +UT_TARGET_OBJS = +UT_PROGS = +endif + ifneq ($(findstring $(MAKEFLAGS),s),s) ifndef V QUIET_CC = @echo ' ' CC $@; @@ -301,9 +353,9 @@ mandir = $(prefix)/man sharedir = $(prefix)/share/fio endif -all: $(PROGS) $(T_TEST_PROGS) $(SCRIPTS) FORCE +all: $(PROGS) $(T_TEST_PROGS) $(UT_PROGS) $(SCRIPTS) FORCE -.PHONY: all install clean +.PHONY: all install clean test .PHONY: FORCE cscope FIO-VERSION-FILE: FORCE @@ -318,8 +370,13 @@ override CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"' @$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SRCDIR)/$*.c > $*.d @mv -f $*.d $*.d.tmp @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d +ifeq ($(CONFIG_TARGET_OS), NetBSD) + @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | tr -cs "[:graph:]" "\n" | \ + sed -e 's/^ *//' -e '/^$$/ d' -e 's/$$/:/' >> $*.d +else @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -w 1 | \ sed -e 's/^ *//' -e 's/$$/:/' >> $*.d +endif @rm -f $*.d.tmp ifdef CONFIG_ARITHMETIC @@ -357,8 +414,13 @@ init.o: init.c FIO-VERSION-FILE @$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SRCDIR)/$*.c > $*.d @mv -f $*.d $*.d.tmp @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d +ifeq ($(CONFIG_TARGET_OS), NetBSD) + @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | tr -cs "[:graph:]" "\n" | \ + sed -e 's/^ *//' -e '/^$$/ d' -e 's/$$/:/' >> $*.d +else @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -w 1 | \ sed -e 's/^ *//' -e 's/$$/:/' >> $*.d +endif @rm -f $*.d.tmp gcompat.o: gcompat.c gcompat.h @@ -388,6 +450,10 @@ cairo_text_helpers.o: cairo_text_helpers.c cairo_text_helpers.h printing.o: printing.c printing.h $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c $< +t/io_uring.o: os/linux/io_uring.h +t/io_uring: $(T_IOU_RING_OBJS) + $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IOU_RING_OBJS) $(LIBS) + t/read-to-pipe-async: $(T_PIPE_ASYNC_OBJS) $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_PIPE_ASYNC_OBJS) $(LIBS) @@ -429,8 +495,17 @@ t/fio-dedupe: $(T_DEDUPE_OBJS) t/fio-verify-state: $(T_VS_OBJS) $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_VS_OBJS) $(LIBS) +t/time-test: $(T_TT_OBJS) + $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_TT_OBJS) $(LIBS) + +ifdef CONFIG_HAVE_CUNIT +unittests/unittest: $(UT_OBJS) $(UT_TARGET_OBJS) + $(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(UT_OBJS) $(UT_TARGET_OBJS) -lcunit +endif + clean: FORCE - @rm -f .depend $(FIO_OBJS) $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) $(T_TEST_PROGS) core.* core gfio FIO-VERSION-FILE *.d lib/*.d oslib/*.d crc/*.d engines/*.d profiles/*.d t/*.d config-host.mak config-host.h y.tab.[ch] lex.yy.c exp/*.[do] lexer.h + @rm -f .depend $(FIO_OBJS) $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(UT_OBJS) $(PROGS) $(T_PROGS) $(T_TEST_PROGS) core.* core gfio unittests/unittest FIO-VERSION-FILE *.[do] lib/*.d oslib/*.[do] crc/*.d engines/*.[do] profiles/*.[do] t/*.[do] unittests/*.[do] unittests/*/*.[do] config-host.mak config-host.h y.tab.[ch] lex.yy.c exp/*.[do] lexer.h + @rm -rf doc/output distclean: clean FORCE @rm -f cscope.out fio.pdf fio_generate_plots.pdf fio2gnuplot.pdf fiologparser_hist.pdf @@ -447,7 +522,8 @@ doc: tools/plot/fio2gnuplot.1 @man -t tools/plot/fio2gnuplot.1 | ps2pdf - fio2gnuplot.pdf @man -t tools/hist/fiologparser_hist.py.1 | ps2pdf - fiologparser_hist.pdf -test: +test: fio + ./fio --minimal --thread --exitall_on_error --runtime=1s --name=nulltest --ioengine=null --rw=randrw --iodepth=2 --norandommap --random_generator=tausworthe64 --size=16T --name=verifyfstest --filename=fiotestfile.tmp --unlink=1 --rw=write --verify=crc32c --verify_state_save=0 --size=16K install: $(PROGS) $(SCRIPTS) tools/plot/fio2gnuplot.1 FORCE $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)