btrfs-progs: build: split LIBS

Not all the build targets use all libs listed in LIBS, separate the
common and compression ones.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2017-01-27 18:34:51 +01:00
parent c439152191
commit 839d857c7e
1 changed files with 11 additions and 8 deletions

View File

@ -75,14 +75,17 @@ CFLAGS = @CFLAGS@ \
LDFLAGS = @LDFLAGS@ \ LDFLAGS = @LDFLAGS@ \
-rdynamic -L$(TOPDIR) $(EXTRA_LDFLAGS) -rdynamic -L$(TOPDIR) $(EXTRA_LDFLAGS)
LIBS = @UUID_LIBS@ @BLKID_LIBS@ @ZLIB_LIBS@ @LZO2_LIBS@ -L. -pthread LIBS_BASE = @UUID_LIBS@ @BLKID_LIBS@ -L. -pthread
LIBBTRFS_LIBS = $(LIBS) LIBS_COMP = @ZLIB_LIBS@ @LZO2_LIBS@
LIBS = $(LIBS_BASE)
LIBBTRFS_LIBS = $(LIBS_BASE)
# Static compilation flags # Static compilation flags
STATIC_CFLAGS = $(CFLAGS) -ffunction-sections -fdata-sections STATIC_CFLAGS = $(CFLAGS) -ffunction-sections -fdata-sections
STATIC_LDFLAGS = -static -Wl,--gc-sections STATIC_LDFLAGS = -static -Wl,--gc-sections
STATIC_LIBS = @UUID_LIBS_STATIC@ @BLKID_LIBS_STATIC@ \ STATIC_LIBS_BASE = @UUID_LIBS_STATIC@ @BLKID_LIBS_STATIC@ -L. -pthread
@ZLIB_LIBS_STATIC@ @LZO2_LIBS_STATIC@ -L. -pthread STATIC_LIBS_COMP = @ZLIB_LIBS_STATIC@ @LZO2_LIBS_STATIC@
STATIC_LIBS = $(STATIC_LIBS_BASE)
# don't use FORTIFY with sparse because glibc with FORTIFY can # don't use FORTIFY with sparse because glibc with FORTIFY can
# generate so many sparse errors that sparse stops parsing, # generate so many sparse errors that sparse stops parsing,
@ -365,12 +368,12 @@ btrfs-%: $(objects) $(libs_static) btrfs-%.o $(standalone_deps)
btrfs: $(objects) btrfs.o $(cmds_objects) $(libs_static) btrfs: $(objects) btrfs.o $(cmds_objects) $(libs_static)
@echo " [LD] $@" @echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o btrfs btrfs.o $(cmds_objects) \ $(Q)$(CC) $(CFLAGS) -o btrfs btrfs.o $(cmds_objects) \
$(objects) $(libs_static) $(LDFLAGS) $(LIBS) $(objects) $(libs_static) $(LDFLAGS) $(LIBS) $(LIBS_COMP)
btrfs.static: $(static_objects) btrfs.static.o $(static_cmds_objects) $(static_libbtrfs_objects) btrfs.static: $(static_objects) btrfs.static.o $(static_cmds_objects) $(static_libbtrfs_objects)
@echo " [LD] $@" @echo " [LD] $@"
$(Q)$(CC) $(STATIC_CFLAGS) -o btrfs.static btrfs.static.o $(static_cmds_objects) \ $(Q)$(CC) $(STATIC_CFLAGS) -o btrfs.static btrfs.static.o $(static_cmds_objects) \
$(static_objects) $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS) $(static_objects) $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS) $(STATIC_LIBS_COMP)
# For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck' # For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck'
btrfsck: btrfs btrfsck: btrfs
@ -403,12 +406,12 @@ btrfstune.static: $(static_objects) btrfstune.static.o $(static_libbtrfs_objects
btrfs-image: $(objects) $(libs_static) image/main.o btrfs-image: $(objects) $(libs_static) image/main.o
@echo " [LD] $@" @echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -I$(TOPDIR)/image -o btrfs-image $(objects) image/main.o $(libs_static) $(LDFLAGS) $(LIBS) $(Q)$(CC) $(CFLAGS) -I$(TOPDIR)/image -o btrfs-image $(objects) image/main.o $(libs_static) $(LDFLAGS) $(LIBS) $(LIBS_COMP)
btrfs-image.static: $(static_objects) image/main.static.o $(static_libbtrfs_objects) btrfs-image.static: $(static_objects) image/main.static.o $(static_libbtrfs_objects)
@echo " [LD] $@" @echo " [LD] $@"
$(Q)$(CC) $(STATIC_CFLAGS) -o $@ image/main.static.o $(static_objects) \ $(Q)$(CC) $(STATIC_CFLAGS) -o $@ image/main.static.o $(static_objects) \
$(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS) $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS) $(STATIC_LIBS_COMP)
btrfs-convert: $(objects) $(libs_static) $(convert_objects) btrfs-convert: $(objects) $(libs_static) $(convert_objects)
@echo " [LD] $@" @echo " [LD] $@"