2 AM_CFLAGS = -Wall -fno-strict-aliasing -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 \
9 CHECKFLAGS=-D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise \
10 -Wuninitialized -Wshadow -Wundef
11 DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
15 bindir = $(prefix)/bin
18 progs = btrfsctl btrfsck mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol \
21 # make C=1 to enable sparse
23 check=sparse $(CHECKFLAGS)
30 $(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
38 btrfsctl: $(objects) btrfsctl.o
39 gcc $(CFLAGS) -o btrfsctl btrfsctl.o $(objects) $(LDFLAGS) $(LIBS)
41 btrfs-vol: $(objects) btrfs-vol.o
42 gcc $(CFLAGS) -o btrfs-vol btrfs-vol.o $(objects) $(LDFLAGS) $(LIBS)
44 btrfs-show: $(objects) btrfs-show.o
45 gcc $(CFLAGS) -o btrfs-show btrfs-show.o $(objects) $(LDFLAGS) $(LIBS)
47 btrfsck: $(objects) btrfsck.o
48 gcc $(CFLAGS) -o btrfsck btrfsck.o $(objects) $(LDFLAGS) $(LIBS)
50 mkfs.btrfs: $(objects) mkfs.o
51 gcc $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS)
53 btrfs-debug-tree: $(objects) debug-tree.o
54 gcc $(CFLAGS) -o btrfs-debug-tree $(objects) debug-tree.o $(LDFLAGS) $(LIBS)
56 btrfstune: $(objects) btrfstune.o
57 gcc $(CFLAGS) -o btrfstune $(objects) btrfstune.o $(LDFLAGS) $(LIBS)
59 btrfs-image: $(objects) btrfs-image.o
60 gcc $(CFLAGS) -o btrfs-image $(objects) btrfs-image.o -lpthread -lz $(LDFLAGS) $(LIBS)
62 dir-test: $(objects) dir-test.o
63 gcc $(CFLAGS) -o dir-test $(objects) dir-test.o $(LDFLAGS) $(LIBS)
65 quick-test: $(objects) quick-test.o
66 gcc $(CFLAGS) -o quick-test $(objects) quick-test.o $(LDFLAGS) $(LIBS)
68 convert: $(objects) convert.o
69 gcc $(CFLAGS) -o btrfs-convert $(objects) convert.o -lext2fs $(LDFLAGS) $(LIBS)
72 rm -f $(progs) cscope.out *.o .*.d btrfs-convert
75 $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
76 $(INSTALL) $(progs) $(DESTDIR)$(bindir)
77 if [ -e btrfs-convert ]; then $(INSTALL) btrfs-convert $(DESTDIR)$(bindir); fi