btrfs-progs: dump-super: add missing long option bytenr to getopt
[platform/upstream/btrfs-progs.git] / Makefile
index fdc63c3..7d35245 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@
 #                  abort   - call abort() on first error (dumps core)
 #                  all     - shortcut for all of the above
 #                  asan    - enable address sanitizer compiler feature
+#                  tsan    - enable thread sanitizer compiler feature
 #                  ubsan   - undefined behaviour sanitizer compiler feature
 #                  bcheck  - extended build checks
 #   W=123          build with warnings (default: off)
@@ -58,6 +59,7 @@ TOPDIR := $(shell pwd)
 
 # Common build flags
 CFLAGS = $(SUBST_CFLAGS) \
+        -std=gnu90 \
         -include config.h \
         -DBTRFS_FLAT_INCLUDES \
         -D_XOPEN_SOURCE=700  \
@@ -92,10 +94,10 @@ CHECKER_FLAGS := -include $(check_defs) -D__CHECKER__ \
 objects = ctree.o disk-io.o kernel-lib/radix-tree.o extent-tree.o print-tree.o \
          root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
          extent-cache.o extent_io.o volumes.o utils.o repair.o \
-         qgroup.o raid56.o free-space-cache.o kernel-lib/list_sort.o props.o \
+         qgroup.o free-space-cache.o kernel-lib/list_sort.o props.o \
          kernel-shared/ulist.o qgroup-verify.o backref.o string-table.o task-utils.o \
          inode.o file.o find-root.o free-space-tree.o help.o send-dump.o \
-         fsfeatures.o messages.o
+         fsfeatures.o kernel-lib/tables.o kernel-lib/raid56.o
 cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
               cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
               cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
@@ -104,12 +106,12 @@ cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
               cmds-inspect-dump-super.o cmds-inspect-tree-stats.o cmds-fi-du.o \
               mkfs/common.o
 libbtrfs_objects = send-stream.o send-utils.o kernel-lib/rbtree.o btrfs-list.o \
-                  kernel-lib/crc32c.o \
+                  kernel-lib/crc32c.o messages.o \
                   uuid-tree.o utils-lib.o rbtree-utils.o
 libbtrfs_headers = send-stream.h send-utils.h send.h kernel-lib/rbtree.h btrfs-list.h \
               kernel-lib/crc32c.h kernel-lib/list.h kerncompat.h \
-              kernel-lib/radix-tree.h kernel-lib/sizes.h extent-cache.h \
-              extent_io.h ioctl.h ctree.h btrfsck.h version.h
+              kernel-lib/radix-tree.h kernel-lib/sizes.h kernel-lib/raid56.h \
+              extent-cache.h extent_io.h ioctl.h ctree.h btrfsck.h version.h
 convert_objects = convert/main.o convert/common.o convert/source-fs.o \
                  convert/source-ext2.o
 mkfs_objects = mkfs/main.o mkfs/common.o
@@ -157,6 +159,11 @@ ifneq (,$(findstring asan,$(D)))
   DEBUG_CFLAGS_INTERNAL += -fsanitize=address
 endif
 
+ifneq (,$(findstring tsan,$(D)))
+  DEBUG_CFLAGS_INTERNAL += -fsanitize=thread -fPIE
+  LD_FLAGS += -fsanitize=thread -ltsan -pie
+endif
+
 ifneq (,$(findstring ubsan,$(D)))
   DEBUG_CFLAGS_INTERNAL += -fsanitize=undefined
 endif
@@ -272,11 +279,12 @@ test-convert: btrfs btrfs-convert
        $(Q)bash tests/convert-tests.sh
 
 test-check: test-fsck
-test-fsck: btrfs btrfs-image btrfs-corrupt-block mkfs.btrfs
+test-fsck: btrfs btrfs-image btrfs-corrupt-block mkfs.btrfs btrfstune
        @echo "    [TEST]   fsck-tests.sh"
        $(Q)bash tests/fsck-tests.sh
 
-test-misc: btrfs btrfs-image btrfs-corrupt-block mkfs.btrfs btrfstune fssum
+test-misc: btrfs btrfs-image btrfs-corrupt-block mkfs.btrfs btrfstune fssum \
+               btrfs-zero-log btrfs-find-root btrfs-select-super
        @echo "    [TEST]   misc-tests.sh"
        $(Q)bash tests/misc-tests.sh
 
@@ -314,6 +322,16 @@ version.h: version.sh version.h.in configure.ac
        @echo "    [SH]     $@"
        $(Q)bash ./config.status --silent $@
 
+mktables: kernel-lib/mktables.c
+       @echo "    [CC]     $@"
+       $(Q)$(CC) $(CFLAGS) $< -o $@
+
+# the target can be regenerated manually using mktables, but a local copy is
+# kept so the build process is simpler
+kernel-lib/tables.c:
+       @echo "    [TABLE]  $@"
+       $(Q)./mktables > $@ || ($(RM) -f $@ && exit 1)
+
 libbtrfs: $(libs_shared) $(lib_links)
 
 $(libs_shared): $(libbtrfs_objects) $(lib_links) send.h
@@ -446,7 +464,7 @@ test-ioctl: ioctl-test ioctl-test-32 ioctl-test-64
        $(Q)./ioctl-test-32 > ioctl-test-32.log
        $(Q)./ioctl-test-64 > ioctl-test-64.log
 
-library-test: library-test.c messages.o $(libs_shared)
+library-test: library-test.c $(libs_shared)
        @echo "    [TEST PREP]  $@"$(eval TMPD=$(shell mktemp -d))
        $(Q)mkdir -p $(TMPD)/include/btrfs && \
        cp $(libbtrfs_headers) $(TMPD)/include/btrfs && \
@@ -456,7 +474,7 @@ library-test: library-test.c messages.o $(libs_shared)
        @echo "    [TEST CLEAN] $@"
        $(Q)$(RM) -rf -- $(TMPD)
 
-library-test.static: library-test.c messages.static.o $(libs_static)
+library-test.static: library-test.c $(libs_static)
        @echo "    [TEST PREP]  $@"$(eval TMPD=$(shell mktemp -d))
        $(Q)mkdir -p $(TMPD)/include/btrfs && \
        cp $(libbtrfs_headers) $(TMPD)/include/btrfs && \
@@ -502,11 +520,12 @@ clean: $(CLEANDIRS)
        @echo "Cleaning"
        $(Q)$(RM) -f -- $(progs) *.o *.o.d \
                kernel-lib/*.o kernel-lib/*.o.d \
+               kernel-shared/*.o kernel-shared/*.o.d \
                image/*.o image/*.o.d \
                convert/*.o convert/*.o.d \
                mkfs/*.o mkfs/*.o.d \
              dir-test ioctl-test quick-test library-test library-test-static \
-             btrfs.static mkfs.btrfs.static fssum \
+              mktables btrfs.static mkfs.btrfs.static fssum \
              $(check_defs) \
              $(libs) $(lib_links) \
              $(progs_static) $(progs_extra)