Skip to content
Snippets Groups Projects
Commit e4c8388e authored by Stephen Hines's avatar Stephen Hines
Browse files

Fix build rules for BuildVariables.inc in llvm-config.

Our previous rules didn't actually construct this file in the appropriate
location. It instead was creating it inside of the source tree. We now
use a custom build rule to create the proper file and include it from an
intermediate build object directory.

Change-Id: I571387a647e95e2053fc2520bcb8151cbaec422e
parent c6a4f5e8
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,3 @@ tools/lld
tools/polly
# Sphinx build tree, if building in-source dir.
docs/_build
# Ignore the generated BuildVariables.inc.
tools/llvm-config/BuildVariables.inc
......@@ -2,44 +2,47 @@ LOCAL_PATH := $(call my-dir)
LLVM_ROOT_PATH := $(LOCAL_PATH)/../..
#===---------------------------------------------------------------===
# llvm-config command line tool
#===---------------------------------------------------------------===
llvm_config_SRC_FILES := \
llvm-config.cpp \
llvm_config_STATIC_LIBRARIES := \
libLLVMCore \
libLLVMSupport \
llvm_config_LOCAL_INCLUDES := \
BuildVariables.inc \
LibraryDependencies.inc
llvm_config_DEPENDENCIES := \
$(LOCAL_PATH)/BuildVariables.inc.in
include $(CLEAR_VARS)
BUILD_VARIABLES_IN := $(LOCAL_PATH)/BuildVariables.inc.in
BUILD_VARIABLES_OUT := $(LOCAL_PATH)/BuildVariables.inc
llvm_config_SRC_FILES := \
llvm-config.cpp
BuildVariables.inc:
sed -e 's/@ANDROID_BUILD_TOP@/$(subst /,\/,$(ANDROID_BUILD_TOP))/' < $(BUILD_VARIABLES_IN) > $(BUILD_VARIABLES_OUT)
llvm_config_STATIC_LIBRARIES := \
libLLVMCore \
libLLVMSupport
LOCAL_MODULE := llvm-config
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_IS_HOST_MODULE := true
# Create BuildVariables.inc dynamically from BuildVariables.inc.in
generated_sources := $(call local-generated-sources-dir)
GEN := $(addprefix $(generated_sources)/, \
BuildVariables.inc \
)
$(GEN) : PRIVATE_PATH := $(LOCAL_PATH)
$(GEN) : PRIVATE_CUSTOM_TOOL = sed -e 's/@ANDROID_BUILD_TOP@/$(subst /,\/,$(ANDROID_BUILD_TOP))/' < $< > $@
$(GEN) : $(LOCAL_PATH)/BuildVariables.inc.in
$(GEN): $(generated_sources)/%.inc : $(LOCAL_PATH)/%.inc.in
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
LOCAL_C_INCLUDES := $(generated_sources)
LOCAL_SRC_FILES := $(llvm_config_SRC_FILES)
LOCAL_STATIC_LIBRARIES := $(llvm_config_STATIC_LIBRARIES)
LOCAL_INCLUDES := $(llvm_config_LOCAL_INCLUDES)
LOCAL_ADDITIONAL_DEPENDENCIES := $(llvm_config_DEPENDENCIES)
LOCAL_LDLIBS += -lpthread -lm -ldl
LOCAL_ADDITIONAL_DEPENDENCIES := \
$(LOCAL_PATH)/Android.mk \
$(LOCAL_GENERATED_SOURCES)
include $(LLVM_ROOT_PATH)/llvm.mk
include $(LLVM_HOST_BUILD_MK)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment