am 46e9beca: core: Add support for static libraries to include other whole static libs.

Merge commit '46e9beca50057bd4ff375b35fd5958c05ce5bcb7'

* commit '46e9beca50057bd4ff375b35fd5958c05ce5bcb7':
  core: Add support for static libraries to include other whole static libs.
This commit is contained in:
Dima Zavin 2009-05-28 12:31:35 -07:00 committed by The Android Open Source Project
commit 0c72f970b0
3 changed files with 20 additions and 2 deletions

View File

@ -267,7 +267,6 @@ full_static_java_libs := \
JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/javalib.jar)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE))
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
@ -356,6 +355,8 @@ $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
# Tell the module and all of its sub-modules who it is.
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(LOCAL_MODULE)

View File

@ -904,12 +904,28 @@ endef
## Commands for running ar
###########################################################
define extract-and-include-whole-static-libs
$(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \
@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(lib)]"; \
ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(lib)))_objs;\
rm -rf $$ldir; \
mkdir -p $$ldir; \
filelist=; \
for f in `$(TARGET_AR) t $(lib)`; do \
$(TARGET_AR) p $(lib) $$f > $$ldir/$$f; \
filelist="$$filelist $$ldir/$$f"; \
done ; \
$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $$filelist;\
)
endef
# Explicitly delete the archive first so that ar doesn't
# try to add to an existing archive.
define transform-o-to-static-lib
@mkdir -p $(dir $@)
@echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
@rm -f $@
$(extract-and-include-whole-static-libs)
@echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
$(hide) $(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $^
endef

View File

@ -25,5 +25,6 @@ $(all_objects) : TARGET_GLOBAL_CFLAGS :=
$(all_objects) : TARGET_GLOBAL_CPPFLAGS :=
endif
$(LOCAL_BUILT_MODULE): $(built_whole_libraries)
$(LOCAL_BUILT_MODULE): $(all_objects)
$(transform-o-to-static-lib)