aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--tools/llvm-config/Android.mk45
2 files changed, 24 insertions, 24 deletions
diff --git a/.gitignore b/.gitignore
index b59a311..eeebe0d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
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)