Add rollback support for the converter
[platform/upstream/btrfs-progs.git] / Makefile
1 CC=gcc
2 AM_CFLAGS = -Wall -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
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_map.o \
7 #
8 CHECKFLAGS=-D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise \
9                 -Wuninitialized -Wshadow -Wundef
10 DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
11
12 INSTALL= install
13 prefix ?= /usr/local
14 bindir = $(prefix)/bin
15
16 progs = btrfsctl btrfsck mkfs.btrfs debug-tree
17
18 # make C=1 to enable sparse
19 ifdef C
20         check=sparse $(CHECKFLAGS)
21 else
22         check=ls
23 endif
24
25 .c.o:
26         $(check) $<
27         $(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
28
29
30 all: $(progs)
31
32 btrfsctl: btrfsctl.o
33         gcc $(CFLAGS) -o btrfsctl btrfsctl.o $(LDFLAGS)
34
35 btrfsck: $(objects) btrfsck.o bit-radix.o
36         gcc $(CFLAGS) -o btrfsck btrfsck.o $(objects) bit-radix.o $(LDFLAGS)
37
38 mkfs.btrfs: $(objects) mkfs.o utils.o
39         gcc $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o utils.o -luuid $(LDFLAGS)
40
41 debug-tree: $(objects) debug-tree.o
42         gcc $(CFLAGS) -o debug-tree $(objects) debug-tree.o -luuid $(LDFLAGS)
43
44 dir-test: $(objects) dir-test.o
45         gcc $(CFLAGS) -o dir-test $(objects) dir-test.o $(LDFLAGS)
46
47 quick-test: $(objects) quick-test.o
48         gcc $(CFLAGS) -o quick-test $(objects) quick-test.o $(LDFLAGS)
49
50 convert: $(objects) convert.o utils.o
51         gcc $(CFLAGS) -o btrfs-convert $(objects) convert.o utils.o -luuid -lext2fs $(LDFLAGS)
52
53 clean :
54         rm -f $(progs) cscope.out *.o .*.d btrfs-convert
55
56 install: $(progs)
57         $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
58         $(INSTALL) $(progs) $(DESTDIR)$(bindir)
59
60 -include .*.d