From b5e7979ad27146d8f225b3bc7866c1b17942b6a0 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 24 Feb 2016 13:57:12 +0100 Subject: [PATCH] btrfs-progs: build: extend per-binary objects The standalone utilities could share object files with the main utility, add a way to specify additional object files in a similar way to the extra libs. The variable name must match the binary plus _objects suffix and s/-/_/ . Signed-off-by: David Sterba --- Makefile.in | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index f950b07..574fbd6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -70,13 +70,13 @@ objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \ extent-cache.o extent_io.o volumes.o utils.o repair.o \ qgroup.o raid6.o free-space-cache.o list_sort.o props.o \ ulist.o qgroup-verify.o backref.o string-table.o task-utils.o \ - inode.o file.o find-root.o free-space-tree.o help.o \ - cmds-inspect-dump-tree.o cmds-inspect-dump-super.o + inode.o file.o find-root.o free-space-tree.o help.o cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \ cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \ cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \ cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \ - cmds-property.o cmds-fi-usage.o + cmds-property.o cmds-fi-usage.o cmds-inspect-dump-tree.o \ + cmds-inspect-dump-super.o libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o \ uuid-tree.o utils-lib.o rbtree-utils.o libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \ @@ -126,6 +126,8 @@ endif # specify btrfs_foo_libs = ; see $($(subst...)) rules below btrfs_convert_libs = @EXT2FS_LIBS@ @COM_ERR_LIBS@ btrfs_fragments_libs = -lgd -lpng -ljpeg -lfreetype +btrfs_debug_tree_objects = cmds-inspect-dump-tree.o +btrfs_show_super_objects = cmds-inspect-dump-super.o SUBDIRS = BUILDDIRS = $(patsubst %,build-%,$(SUBDIRS)) @@ -252,12 +254,15 @@ $(lib_links): btrfs-%.static: $(static_objects) btrfs-%.static.o $(static_libbtrfs_objects) @echo " [LD] $@" $(Q)$(CC) $(STATIC_CFLAGS) -o $@ $@.o $(static_objects) \ + $($(subst -,_,$(subst .static,,$@)-objects)) \ $(static_libbtrfs_objects) $(STATIC_LDFLAGS) \ $($(subst -,_,$(subst .static,,$@)-libs)) $(STATIC_LIBS) btrfs-%: $(objects) $(libs_static) btrfs-%.o @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) -o $@ $(objects) $@.o $(libs_static) \ + $(Q)$(CC) $(CFLAGS) -o $@ $(objects) $@.o \ + $($(subst -,_,$@-objects)) \ + $(libs_static) \ $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs)) btrfs: $(objects) btrfs.o $(cmds_objects) $(libs_static) -- 2.7.4