Add support for multiple devices per filesystem
[platform/upstream/btrfs-progs.git] / Makefile
1 CC=gcc
2 AM_CFLAGS = -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
3 CFLAGS = -g -Werror
4 objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
5           root-tree.o dir-item.o hash.o file-item.o inode-item.o \
6           inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o \
7           volumes.o
8 #
9 CHECKFLAGS=-D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise \
10                 -Wuninitialized -Wshadow -Wundef
11 DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
12
13 INSTALL= install
14 prefix ?= /usr/local
15 bindir = $(prefix)/bin
16
17 progs = btrfsctl btrfsck mkfs.btrfs debug-tree
18
19 # make C=1 to enable sparse
20 ifdef C
21         check=sparse $(CHECKFLAGS)
22 else
23         check=ls
24 endif
25
26 .c.o:
27         $(check) $<
28         $(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
29
30
31 all: $(progs)
32
33 btrfsctl: btrfsctl.o
34         gcc $(CFLAGS) -o btrfsctl btrfsctl.o $(LDFLAGS)
35
36 btrfsck: $(objects) btrfsck.o bit-radix.o
37         gcc $(CFLAGS) -o btrfsck btrfsck.o $(objects) bit-radix.o $(LDFLAGS)
38
39 mkfs.btrfs: $(objects) mkfs.o utils.o
40         gcc $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o utils.o -luuid $(LDFLAGS)
41
42 debug-tree: $(objects) debug-tree.o
43         gcc $(CFLAGS) -o debug-tree $(objects) debug-tree.o -luuid $(LDFLAGS)
44
45 dir-test: $(objects) dir-test.o
46         gcc $(CFLAGS) -o dir-test $(objects) dir-test.o $(LDFLAGS)
47
48 quick-test: $(objects) quick-test.o
49         gcc $(CFLAGS) -o quick-test $(objects) quick-test.o $(LDFLAGS)
50
51 convert: $(objects) convert.o utils.o
52         gcc $(CFLAGS) -o btrfs-convert $(objects) convert.o utils.o -luuid -lext2fs $(LDFLAGS)
53
54 clean :
55         rm -f $(progs) cscope.out *.o .*.d btrfs-convert
56
57 install: $(progs)
58         $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
59         $(INSTALL) $(progs) $(DESTDIR)$(bindir)
60         if [ -e btrfs-convert ]; then $(INSTALL) btrfs-convert $(DESTDIR)$(bindir); fi
61
62 -include .*.d