aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-07-19 03:44:24 -0700
committerStephen Hines <srhines@google.com>2014-07-21 00:46:55 -0700
commite4c8388e2bc283d5dd0b185317307f0d31782e56 (patch)
tree2d2db5ebcf79d429d4a7a5584edf71ae3a57659f /tools
parentc6a4f5e819217e1e12c458aed8e7b122e23a3a58 (diff)
downloadexternal_llvm-e4c8388e2bc283d5dd0b185317307f0d31782e56.zip
external_llvm-e4c8388e2bc283d5dd0b185317307f0d31782e56.tar.gz
external_llvm-e4c8388e2bc283d5dd0b185317307f0d31782e56.tar.bz2
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
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-config/Android.mk45
1 files changed, 24 insertions, 21 deletions
diff --git a/tools/llvm-config/Android.mk b/tools/llvm-config/Android.mk
index bdc409d..ac97e0b 100644
--- a/tools/llvm-config/Android.mk
+++ b/tools/llvm-config/Android.mk
@@ -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)