btrfs-progs: Add a rule to build a static mkfs.btrfs
authorAntoine Sirinelli <antoine@monte-stello.com>
Mon, 11 Mar 2013 21:17:17 +0000 (21:17 +0000)
committerDavid Sterba <dsterba@suse.cz>
Tue, 12 Mar 2013 15:23:14 +0000 (16:23 +0100)
Static mkfs.btrfs can be used to "bootstrap" a system from a live CD
which does not provide mkfs.btrfs.

The executable produced is named mkfs.btrfs.static and built by invoking
the "static" make rule.

Signed-off-by: Antoine Sirinelli <antoine@monte-stello.com>
Makefile

index d102dee..55ff5b4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -86,7 +86,7 @@ all: version.h $(progs) manpages
 # NOTE: For static compiles, you need to have all the required libs
 #      static equivalent available
 #
-static: version.h $(libs) btrfs.static
+static: version.h $(libs) btrfs.static mkfs.btrfs.static
 
 version.h:
        $(Q)bash version.sh
@@ -143,6 +143,11 @@ mkfs.btrfs: $(objects) $(libs) mkfs.o
        @echo "    [LD]     $@"
        $(Q)$(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS) -lblkid
 
+mkfs.btrfs.static: $(static_objects) mkfs.static.o
+       @echo "    [LD]     $@"
+       $(Q)$(CC) $(STATIC_CFLAGS) -o mkfs.btrfs.static mkfs.static.o \
+               $(static_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
+
 btrfs-debug-tree: $(objects) $(libs) debug-tree.o
        @echo "    [LD]     $@"
        $(Q)$(CC) $(CFLAGS) -o btrfs-debug-tree $(objects) debug-tree.o $(LDFLAGS) $(LIBS)
@@ -204,7 +209,8 @@ 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 send-test btrfs.static btrfsck \
+             btrfs-zero-log btrfstune dir-test ioctl-test quick-test send-test btrfsck \
+             btrfs.static mkfs.btrfs.static \
              version.h \
              $(libs) $(lib_links)
        $(Q)$(MAKE) $(MAKEOPTS) -C man $@