2 AM_CFLAGS
= -Wall
-D_FILE_OFFSET_BITS
=64 -D_FORTIFY_SOURCE
=2
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
8 cmds_objects
= cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
9 cmds-inspect.o cmds-balance.o
11 CHECKFLAGS
= -D__linux__
-Dlinux
-D__STDC__
-Dunix
-D__unix__
-Wbitwise \
12 -Wuninitialized
-Wshadow
-Wundef
13 DEPFLAGS
= -Wp
,-MMD
,$(@D
)/.
$(@F
).d
,-MT
,$@
17 bindir = $(prefix)/bin
21 progs
= btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
22 btrfs btrfs-map-logical restore find-root calc-size btrfs-corrupt-block
24 # make C=1 to enable sparse
26 check = sparse
$(CHECKFLAGS
)
33 $(CC
) $(DEPFLAGS
) $(AM_CFLAGS
) $(CFLAGS
) -c
$<
36 all: version
$(progs
) manpages
41 btrfs
: $(objects
) btrfs.o help.o common.o
$(cmds_objects
)
42 $(CC
) $(CFLAGS
) -o btrfs btrfs.o help.o common.o
$(cmds_objects
) \
43 $(objects
) $(LDFLAGS
) $(LIBS
) -lpthread
45 calc-size
: $(objects
) calc-size.o
46 gcc
$(CFLAGS
) -o calc-size calc-size.o
$(objects
) $(LDFLAGS
) $(LIBS
)
48 find-root
: $(objects
) find-root.o
49 gcc
$(CFLAGS
) -o find-root find-root.o
$(objects
) $(LDFLAGS
) $(LIBS
)
51 restore
: $(objects
) restore.o
52 gcc
$(CFLAGS
) -o restore restore.o
$(objects
) $(LDFLAGS
) $(LIBS
) $(RESTORE_LIBS
)
54 btrfsctl
: $(objects
) btrfsctl.o
55 $(CC
) $(CFLAGS
) -o btrfsctl btrfsctl.o
$(objects
) $(LDFLAGS
) $(LIBS
)
57 btrfs-vol
: $(objects
) btrfs-vol.o
58 $(CC
) $(CFLAGS
) -o btrfs-vol btrfs-vol.o
$(objects
) $(LDFLAGS
) $(LIBS
)
60 btrfs-show
: $(objects
) btrfs-show.o
61 $(CC
) $(CFLAGS
) -o btrfs-show btrfs-show.o
$(objects
) $(LDFLAGS
) $(LIBS
)
63 btrfsck
: $(objects
) btrfsck.o
64 $(CC
) $(CFLAGS
) -o btrfsck btrfsck.o
$(objects
) $(LDFLAGS
) $(LIBS
)
66 mkfs.btrfs
: $(objects
) mkfs.o
67 $(CC
) $(CFLAGS
) -o mkfs.btrfs
$(objects
) mkfs.o
$(LDFLAGS
) $(LIBS
)
69 btrfs-debug-tree
: $(objects
) debug-tree.o
70 $(CC
) $(CFLAGS
) -o btrfs-debug-tree
$(objects
) debug-tree.o
$(LDFLAGS
) $(LIBS
)
72 btrfs-zero-log
: $(objects
) btrfs-zero-log.o
73 $(CC
) $(CFLAGS
) -o btrfs-zero-log
$(objects
) btrfs-zero-log.o
$(LDFLAGS
) $(LIBS
)
75 btrfs-select-super
: $(objects
) btrfs-select-super.o
76 $(CC
) $(CFLAGS
) -o btrfs-select-super
$(objects
) btrfs-select-super.o
$(LDFLAGS
) $(LIBS
)
78 btrfstune
: $(objects
) btrfstune.o
79 $(CC
) $(CFLAGS
) -o btrfstune
$(objects
) btrfstune.o
$(LDFLAGS
) $(LIBS
)
81 btrfs-map-logical
: $(objects
) btrfs-map-logical.o
82 $(CC
) $(CFLAGS
) -o btrfs-map-logical
$(objects
) btrfs-map-logical.o
$(LDFLAGS
) $(LIBS
)
84 btrfs-corrupt-block
: $(objects
) btrfs-corrupt-block.o
85 $(CC
) $(CFLAGS
) -o btrfs-corrupt-block
$(objects
) btrfs-corrupt-block.o
$(LDFLAGS
) $(LIBS
)
87 btrfs-image
: $(objects
) btrfs-image.o
88 $(CC
) $(CFLAGS
) -o btrfs-image
$(objects
) btrfs-image.o
-lpthread
-lz
$(LDFLAGS
) $(LIBS
)
90 dir-test
: $(objects
) dir-test.o
91 $(CC
) $(CFLAGS
) -o dir-test
$(objects
) dir-test.o
$(LDFLAGS
) $(LIBS
)
93 quick-test
: $(objects
) quick-test.o
94 $(CC
) $(CFLAGS
) -o quick-test
$(objects
) quick-test.o
$(LDFLAGS
) $(LIBS
)
96 convert
: $(objects
) convert.o
97 $(CC
) $(CFLAGS
) -o btrfs-convert
$(objects
) convert.o
-lext2fs
-lcom_err
$(LDFLAGS
) $(LIBS
)
99 ioctl-test
: $(objects
) ioctl-test.o
100 $(CC
) $(CFLAGS
) -o ioctl-test
$(objects
) ioctl-test.o
$(LDFLAGS
) $(LIBS
)
109 rm -f
$(progs
) cscope.out
*.o .
*.d btrfs-convert btrfs-image btrfs-select-super \
110 btrfs-zero-log btrfstune dir-test ioctl-test quick-test version.h
113 install: $(progs
) install-man
114 $(INSTALL
) -m755
-d
$(DESTDIR
)$(bindir)
115 $(INSTALL
) $(progs
) $(DESTDIR
)$(bindir)
116 if
[ -e btrfs-convert
]; then
$(INSTALL
) btrfs-convert
$(DESTDIR
)$(bindir); fi