OSDN Git Service

build: Fix including WHOLE_STATIC_LIBRARIES in static libraries
authorColin Cross <ccross@android.com>
Tue, 4 May 2010 22:42:22 +0000 (15:42 -0700)
committerEd Heyl <edheyl@google.com>
Wed, 5 May 2010 01:09:56 +0000 (18:09 -0700)
Static libraries that include other static libraries were being incorrectly
built with .a files inside the top level .a file, as well as the .o files
that were extracted from the component .a files.  This patch fixes the
final ar call to only add .o files to the archive.

Change-Id: Ic1ff025129e3c379fa56b4da2f09e9f16ea3c4fb

core/definitions.mk

index 5768c6d..a80ae9b 100644 (file)
@@ -949,7 +949,7 @@ endef
 
 define extract-and-include-target-whole-static-libs
 $(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \
-       @echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(lib)]"; \
+       $(hide) echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(lib)]"; \
        ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(lib)))_objs;\
        rm -rf $$ldir; \
        mkdir -p $$ldir; \
@@ -969,7 +969,8 @@ define transform-o-to-static-lib
 @rm -f $@
 $(extract-and-include-target-whole-static-libs)
 @echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
-$(hide) echo $^ | xargs $(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@
+$(hide) echo $(filter %.o, $^) | \
+    xargs $(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@
 endef
 
 ###########################################################