Move memalign to lib/
[fio.git] / Makefile
index 7fe7d4d196881193f0943b8d93a51fdc2b775204..7686eb85a5b9d31d176ae026b550abc6bf4e5d30 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,12 +22,16 @@ endif
 
 DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
 CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFIO_INTERNAL $(DEBUGFLAGS)
-OPTFLAGS= -O3 -g -ffast-math
+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)
 
+ifndef CONFIG_FIO_NO_OPT
+  CFLAGS += -O3
+endif
+
 ifdef CONFIG_GFIO
   PROGS += gfio
 endif
@@ -35,14 +39,15 @@ endif
 SOURCE :=      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 \
                lib/rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \
-               lib/num2str.c lib/ieee754.c engines/cpu.c \
+               lib/num2str.c lib/ieee754.c lib/strntol.c engines/cpu.c \
                engines/mmap.c engines/sync.c engines/null.c engines/net.c \
-               memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \
-               cconv.c lib/prio_tree.c json.c lib/zipf.c lib/axmap.c \
-               lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \
+               server.c client.c iolog.c backend.c libfio.c flow.c \
+               cconv.c lib/prio_tree.c lib/zipf.c lib/axmap.c lib/pattern.c \
+               lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c json.c \
                lib/hweight.c lib/getrusage.c idletime.c td_error.c \
                profiles/tiobench.c profiles/act.c io_u_queue.c filelock.c \
                lib/tp.c lib/bloom.c lib/gauss.c lib/mountcheck.c workqueue.c \
+               lib/output_buffer.c lib/memalign.c \
                $(patsubst $(SRCDIR)/%,%,$(wildcard $(SRCDIR)/crc/*.c))
 
 ifdef CONFIG_LIBHDFS
@@ -100,6 +105,9 @@ endif
 ifndef CONFIG_STRCASESTR
   SOURCE += lib/strcasestr.c
 endif
+ifndef CONFIG_STRLCAT
+  SOURCE += lib/strlcat.c
+endif
 ifndef CONFIG_GETOPT_LONG_ONLY
   SOURCE += lib/getopt_long.c
 endif
@@ -194,7 +202,8 @@ T_IEEE_OBJS += lib/ieee754.o
 T_IEEE_PROGS = t/ieee754
 
 T_ZIPF_OBS = t/genzipf.o
-T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o lib/gauss.o 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
 T_ZIPF_PROGS = t/fio-genzipf
 
 T_AXMAP_OBJS = t/axmap.o
@@ -213,8 +222,8 @@ 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 \
-               memalign.o lib/bloom.o t/debug.o crc/xxhash.o crc/murmur3.o \
-               crc/crc32c.o crc/crc32c-intel.o crc/fnv.o
+               lib/memalign.o lib/bloom.o t/debug.o crc/xxhash.o \
+               crc/murmur3.o crc/crc32c.o crc/crc32c-intel.o crc/fnv.o
 T_DEDUPE_PROGS = t/fio-dedupe
 
 T_OBJS = $(T_SMALLOC_OBJS)
@@ -229,6 +238,7 @@ ifneq (,$(findstring CYGWIN,$(CONFIG_TARGET_OS)))
     T_DEDUPE_OBJS += os/windows/posix.o lib/hweight.o
     T_SMALLOC_OBJS += os/windows/posix.o lib/hweight.o
     T_LFSR_TEST_OBJS += os/windows/posix.o lib/hweight.o
+    T_ZIPF_OBJS += lib/strcasestr.o
 endif
 
 T_TEST_PROGS = $(T_SMALLOC_PROGS)
@@ -314,7 +324,14 @@ parse.o: lex.yy.o y.tab.o
 endif
 
 init.o: init.c FIO-VERSION-FILE
+       @mkdir -p $(dir $@)
        $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
+       @$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SRCDIR)/$*.c > $*.d
+       @mv -f $*.d $*.d.tmp
+       @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
+       @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
+               sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
+       @rm -f $*.d.tmp
 
 gcompat.o: gcompat.c gcompat.h
        $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c $<