From e7b3e2c62eddf9c31062fa8a0c9a31e1ef749afd Mon Sep 17 00:00:00 2001 From: Jack Palevich Date: Mon, 4 May 2009 14:32:44 -0700 Subject: [PATCH] Extend build system to compile generated "C" files. Until now only generated assembly or C++ files would be compiled. This patch extends the build system to compile generated C files as well. The new rule is modeled on the existing rules for compiling generated C++ files and the existing rule for compiling ordinary C files. --- core/binary.mk | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/binary.mk b/core/binary.mk index 0f35d3f0cf..3c721ba223 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -211,6 +211,23 @@ $(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(PR -include $(c_objects:%.o=%.P) endif +########################################################### +## C: Compile generated .c files to .o. +########################################################### + +gen_c_sources := $(filter %.c,$(LOCAL_GENERATED_SOURCES)) +gen_c_objects := $(gen_c_sources:%.c=%.o) + +ifneq ($(strip $(gen_c_objects)),) +# Compile all generated files as thumb. +# TODO: support compiling certain generated files as arm. +$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) +$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) +$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(PRIVATE_ADDITIONAL_DEPENDENCIES) + $(transform-$(PRIVATE_HOST)c-to-o) +-include $(gen_c_objects:%.o=%.P) +endif + ########################################################### ## AS: Compile .S files to .o. ########################################################### @@ -248,6 +265,7 @@ all_objects := \ $(gen_cpp_objects) \ $(gen_asm_objects) \ $(c_objects) \ + $(gen_c_objects) \ $(yacc_objects) \ $(lex_objects) \ $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))