btrfs-progs: build btrsfck to keep compatibility
authorDavid Sterba <dsterba@suse.cz>
Tue, 12 Feb 2013 16:39:44 +0000 (17:39 +0100)
committerDavid Sterba <dsterba@suse.cz>
Tue, 12 Feb 2013 22:46:12 +0000 (23:46 +0100)
The command 'btrfsck' is commonly used and we should build it by
default.

Signed-off-by: David Sterba <dsterba@suse.cz>
Makefile

index 039f0dc..7a679d0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 CC = gcc
+LN = ln
 AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
 CFLAGS = -g -O1
 objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
@@ -35,7 +36,7 @@ endif
 
 MAKEOPTS = --no-print-directory Q=$(Q)
 
-progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol \
+progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
        btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
        btrfs-find-root btrfs-restore btrfstune btrfs-show-super
 
@@ -110,6 +111,11 @@ btrfs-show: $(objects) btrfs-show.o
        @echo "    [LD]     $@"
        $(Q)$(CC) $(CFLAGS) -o btrfs-show btrfs-show.o $(objects) $(LDFLAGS) $(LIBS)
 
+# For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck'
+btrfsck: btrfs
+       @echo "    [LN]     $@"
+       $(Q)$(LN) -f btrfs btrfsck
+
 mkfs.btrfs: $(objects) mkfs.o
        @echo "    [LD]     $@"
        $(Q)$(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS) -lblkid
@@ -171,7 +177,7 @@ install-man:
 clean :
        @echo "Cleaning"
        $(Q)rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \
-             btrfs-zero-log btrfstune dir-test ioctl-test quick-test btrfs.static \
+             btrfs-zero-log btrfstune dir-test ioctl-test quick-test btrfs.static btrfsck \
              version.h
        $(Q)$(MAKE) $(MAKEOPTS) -C man $@