diff mbox

btrfs-progs: add Makefile rule for static build of btrfs-find-root

Message ID 1363103051-10207-1-git-send-email-hugo@carfax.org.uk (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Hugo Mills March 12, 2013, 3:44 p.m. UTC
From: Hugo Mills <h.r.mills@reading.ac.uk>

btrfs-find-root isn't yet integrated into the main btrfs tool, and is
an important recovery tool, so it deserves to be built as a static
binary.

Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
---
 Makefile |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

David Sterba March 12, 2013, 5:53 p.m. UTC | #1
On Tue, Mar 12, 2013 at 03:44:11PM +0000, Hugo Mills wrote:
> From: Hugo Mills <h.r.mills@reading.ac.uk>
> 
> btrfs-find-root isn't yet integrated into the main btrfs tool, and is
> an important recovery tool, so it deserves to be built as a static
> binary.

Thanks, I'll add this now as a separate target, though find-root might
end up merged into 'btrfs' eventually.

> +btrfs-find-root.static: $(static_objects) $(libs) find-root.static.o

I've noticed that the (newly added) mkfs.btrfs.static target does not
depend on $(libs) and this is correct, we don't need $(libs) for .static
targets.  I'll fix both btrfs.static and find-root here.

> +	@echo "    [LD]     $@"
> +	$(Q)$(CC) $(STATIC_CFLAGS) -o btrfs-find-root.static find-root.static.o $(static_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba March 15, 2013, 5:52 p.m. UTC | #2
On Tue, Mar 12, 2013 at 06:53:25PM +0100, David Sterba wrote:
> On Tue, Mar 12, 2013 at 03:44:11PM +0000, Hugo Mills wrote:
> > +btrfs-find-root.static: $(static_objects) $(libs) find-root.static.o
> 
> I've noticed that the (newly added) mkfs.btrfs.static target does not
> depend on $(libs) and this is correct

... well, it's partially correct, we don't need $(libs) but we need the
object files and possibly built with the same cflags as the rest of the
.static.o group. So far the build works if libbtrfs.a is built and the
final binary is linked against it. I finally made it to compile and link
the way it should IMHO be, patch will follow after cleaning.

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index d102dee..c519d21 100644
--- 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 btrfs-find-root.static
 
 version.h:
 	$(Q)bash version.sh
@@ -122,6 +122,10 @@  btrfs-find-root: $(objects) $(libs) find-root.o
 	@echo "    [LD]     $@"
 	$(Q)$(CC) $(CFLAGS) -o btrfs-find-root find-root.o $(objects) $(LDFLAGS) $(LIBS)
 
+btrfs-find-root.static: $(static_objects) $(libs) find-root.static.o
+	@echo "    [LD]     $@"
+	$(Q)$(CC) $(STATIC_CFLAGS) -o btrfs-find-root.static find-root.static.o $(static_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
+
 btrfsctl: $(objects) $(libs) btrfsctl.o
 	@echo "    [LD]     $@"
 	$(Q)$(CC) $(CFLAGS) -o btrfsctl btrfsctl.o $(objects) $(LDFLAGS) $(LIBS)