OSDN Git Service

Support build rules which generate .o files.
authorTorne (Richard Coles) <torne@google.com>
Thu, 21 Feb 2013 14:01:35 +0000 (14:01 +0000)
committerTorne (Richard Coles) <torne@google.com>
Tue, 5 Mar 2013 10:35:57 +0000 (10:35 +0000)
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

core/binary.mk

index 18f67fe..dd68fee 100644 (file)
@@ -500,6 +500,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)
 
 ###########################################################