Btrfs-progs: fall back to the v1 ioctl if the new balance ioctl fails
[btrfs-progs-unstable/devel.git] / Makefile
blobcd5f7f12ce36bdf1d763d34e2a96f8d2aa5cf1cb
1 CC = gcc
2 AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
3 CFLAGS = -g -O0
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,$@
15 INSTALL = install
16 prefix ?= /usr/local
17 bindir = $(prefix)/bin
18 LIBS=-luuid
19 RESTORE_LIBS=-lz
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
25 ifdef C
26 check = sparse $(CHECKFLAGS)
27 else
28 check = ls
29 endif
31 .c.o:
32 $(check) $<
33 $(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
36 all: version $(progs) manpages
38 version:
39 bash version.sh
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)
102 manpages:
103 cd man; make
105 install-man:
106 cd man; make install
108 clean :
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
111 cd man; make clean
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
118 -include .*.d