Support build rules which generate .o files.

webviewchromium has some build rules which use a custom tool to create
.o files from other input (i.e. they are not prebuilt and so can't be
included in LOCAL_PREBUILT_OBJ_FILES). Support adding .o files to
LOCAL_GENERATED_SOURCES and doing the right thing with them (including
them in the static/dynamic library or executable being built).

Bug: 7714333

Change-Id: I3b1d29eeff30aebeafe33398f9bef2eb6972d997
This commit is contained in:
Torne (Richard Coles) 2013-02-21 14:01:35 +00:00
parent eabb34fb90
commit aace2024d7
1 changed files with 11 additions and 2 deletions

View File

@ -499,6 +499,12 @@ endif
gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
###########################################################
## o: Include generated .o files in output.
###########################################################
gen_o_objects := $(filter %.o,$(LOCAL_GENERATED_SOURCES))
###########################################################
## C: Compile .c files to .o.
###########################################################
@ -624,7 +630,8 @@ all_objects := \
$(yacc_objects) \
$(lex_objects) \
$(proto_generated_objects) \
$(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
$(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES)) \
$(gen_o_objects)
LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
@ -632,7 +639,9 @@ ifndef LOCAL_SDK_VERSION
LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
endif
$(all_objects) : | $(LOCAL_GENERATED_SOURCES) $(import_includes)
# .o files need to be filtered out of LOCAL_GENERATED_SOURCES
# to avoid creating circular dependencies.
$(all_objects) : | $(filter-out %.o,$(LOCAL_GENERATED_SOURCES)) $(import_includes)
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
###########################################################