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
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 gcc
$(CFLAGS
) -o btrfs btrfs.o btrfs_cmds.o \
42 $(objects
) $(LDFLAGS
) $(LIBS
)
44 btrfsctl
: $(objects
) btrfsctl.o
45 gcc
$(CFLAGS
) -o btrfsctl btrfsctl.o
$(objects
) $(LDFLAGS
) $(LIBS
)
47 btrfs-vol
: $(objects
) btrfs-vol.o
48 gcc
$(CFLAGS
) -o btrfs-vol btrfs-vol.o
$(objects
) $(LDFLAGS
) $(LIBS
)
50 btrfs-show
: $(objects
) btrfs-show.o
51 gcc
$(CFLAGS
) -o btrfs-show btrfs-show.o
$(objects
) $(LDFLAGS
) $(LIBS
)
53 btrfsck
: $(objects
) btrfsck.o
54 gcc
$(CFLAGS
) -o btrfsck btrfsck.o
$(objects
) $(LDFLAGS
) $(LIBS
)
56 mkfs.btrfs
: $(objects
) mkfs.o
57 gcc
$(CFLAGS
) -o mkfs.btrfs
$(objects
) mkfs.o
$(LDFLAGS
) $(LIBS
)
59 btrfs-debug-tree
: $(objects
) debug-tree.o
60 gcc
$(CFLAGS
) -o btrfs-debug-tree
$(objects
) debug-tree.o
$(LDFLAGS
) $(LIBS
)
62 btrfstune
: $(objects
) btrfstune.o
63 gcc
$(CFLAGS
) -o btrfstune
$(objects
) btrfstune.o
$(LDFLAGS
) $(LIBS
)
65 btrfs-map-logical
: $(objects
) btrfs-map-logical.o
66 gcc
$(CFLAGS
) -o btrfs-map-logical
$(objects
) btrfs-map-logical.o
$(LDFLAGS
) $(LIBS
)
68 btrfs-image
: $(objects
) btrfs-image.o
69 gcc
$(CFLAGS
) -o btrfs-image
$(objects
) btrfs-image.o
-lpthread
-lz
$(LDFLAGS
) $(LIBS
)
71 dir-test
: $(objects
) dir-test.o
72 gcc
$(CFLAGS
) -o dir-test
$(objects
) dir-test.o
$(LDFLAGS
) $(LIBS
)
74 quick-test
: $(objects
) quick-test.o
75 gcc
$(CFLAGS
) -o quick-test
$(objects
) quick-test.o
$(LDFLAGS
) $(LIBS
)
77 convert
: $(objects
) convert.o
78 gcc
$(CFLAGS
) -o btrfs-convert
$(objects
) convert.o
-lext2fs
$(LDFLAGS
) $(LIBS
)
80 ioctl-test
: $(objects
) ioctl-test.o
81 gcc
$(CFLAGS
) -o ioctl-test
$(objects
) ioctl-test.o
$(LDFLAGS
) $(LIBS
)
90 rm -f
$(progs
) cscope.out
*.o .
*.d btrfs-convert
93 install: $(progs
) install-man
94 $(INSTALL
) -m755
-d
$(DESTDIR
)$(bindir)
95 $(INSTALL
) $(progs
) $(DESTDIR
)$(bindir)
96 if
[ -e btrfs-convert
]; then
$(INSTALL
) btrfs-convert
$(DESTDIR
)$(bindir); fi