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 <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-02-24 13:57:12 +01:00
parent 2ae0b12df0
commit b5e7979ad2

View File

@ -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 = <list of 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)