2 AM_CFLAGS
= -Wall
-D_FILE_OFFSET_BITS
=64 -D_FORTIFY_SOURCE
=2
3 CFLAGS
= -g
-Werror
-Os
4 objects
= ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
5 root-tree.o dir-item.o file-item.o inode-item.o \
6 inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o \
7 volumes.o utils.o btrfs-list.o btrfslabel.o
10 CHECKFLAGS
=-D__linux__
-Dlinux
-D__STDC__
-Dunix
-D__unix__
-Wbitwise \
11 -Wuninitialized
-Wshadow
-Wundef
12 DEPFLAGS
= -Wp
,-MMD
,$(@D
)/.
$(@F
).d
,-MT
,$@
16 bindir = $(prefix)/bin
19 progs
= btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
23 # make C=1 to enable sparse
25 check=sparse
$(CHECKFLAGS
)
32 $(CC
) $(DEPFLAGS
) $(AM_CFLAGS
) $(CFLAGS
) -c
$<
35 all: version
$(progs
) manpages
40 btrfs
: $(objects
) btrfs.o btrfs_cmds.o
41 $(CC
) -lpthread
$(CFLAGS
) -o btrfs btrfs.o btrfs_cmds.o \
42 $(objects
) $(LDFLAGS
) $(LIBS
)
44 btrfsctl
: $(objects
) btrfsctl.o
45 $(CC
) $(CFLAGS
) -o btrfsctl btrfsctl.o
$(objects
) $(LDFLAGS
) $(LIBS
)
47 btrfs-vol
: $(objects
) btrfs-vol.o
48 $(CC
) $(CFLAGS
) -o btrfs-vol btrfs-vol.o
$(objects
) $(LDFLAGS
) $(LIBS
)
50 btrfs-show
: $(objects
) btrfs-show.o
51 $(CC
) $(CFLAGS
) -o btrfs-show btrfs-show.o
$(objects
) $(LDFLAGS
) $(LIBS
)
53 btrfsck
: $(objects
) btrfsck.o
54 $(CC
) $(CFLAGS
) -o btrfsck btrfsck.o
$(objects
) $(LDFLAGS
) $(LIBS
)
56 mkfs.btrfs
: $(objects
) mkfs.o
57 $(CC
) $(CFLAGS
) -o mkfs.btrfs
$(objects
) mkfs.o
$(LDFLAGS
) $(LIBS
)
59 btrfs-debug-tree
: $(objects
) debug-tree.o
60 $(CC
) $(CFLAGS
) -o btrfs-debug-tree
$(objects
) debug-tree.o
$(LDFLAGS
) $(LIBS
)
62 btrfs-zero-log
: $(objects
) btrfs-zero-log.o
63 $(CC
) $(CFLAGS
) -o btrfs-zero-log
$(objects
) btrfs-zero-log.o
$(LDFLAGS
) $(LIBS
)
65 btrfs-select-super
: $(objects
) btrfs-select-super.o
66 $(CC
) $(CFLAGS
) -o btrfs-select-super
$(objects
) btrfs-select-super.o
$(LDFLAGS
) $(LIBS
)
68 btrfstune
: $(objects
) btrfstune.o
69 $(CC
) $(CFLAGS
) -o btrfstune
$(objects
) btrfstune.o
$(LDFLAGS
) $(LIBS
)
71 btrfs-map-logical
: $(objects
) btrfs-map-logical.o
72 $(CC
) $(CFLAGS
) -o btrfs-map-logical
$(objects
) btrfs-map-logical.o
$(LDFLAGS
) $(LIBS
)
74 btrfs-image
: $(objects
) btrfs-image.o
75 $(CC
) $(CFLAGS
) -o btrfs-image
$(objects
) btrfs-image.o
-lpthread
-lz
$(LDFLAGS
) $(LIBS
)
77 dir-test
: $(objects
) dir-test.o
78 $(CC
) $(CFLAGS
) -o dir-test
$(objects
) dir-test.o
$(LDFLAGS
) $(LIBS
)
80 quick-test
: $(objects
) quick-test.o
81 $(CC
) $(CFLAGS
) -o quick-test
$(objects
) quick-test.o
$(LDFLAGS
) $(LIBS
)
83 convert
: $(objects
) convert.o
84 $(CC
) $(CFLAGS
) -o btrfs-convert
$(objects
) convert.o
-lext2fs
-lcom_err
$(LDFLAGS
) $(LIBS
)
86 ioctl-test
: $(objects
) ioctl-test.o
87 $(CC
) $(CFLAGS
) -o ioctl-test
$(objects
) ioctl-test.o
$(LDFLAGS
) $(LIBS
)
96 rm -f
$(progs
) cscope.out
*.o .
*.d btrfs-convert
99 install: $(progs
) install-man
100 $(INSTALL
) -m755
-d
$(DESTDIR
)$(bindir)
101 $(INSTALL
) $(progs
) $(DESTDIR
)$(bindir)
102 if
[ -e btrfs-convert
]; then
$(INSTALL
) btrfs-convert
$(DESTDIR
)$(bindir); fi