1 ########################################################### 2 ## Generate clang/Basic/Version.inc 3 ########################################################### 4 ifeq ($(LOCAL_MODULE_CLASS),) 5 LOCAL_MODULE_CLASS := STATIC_LIBRARIES 6 endif 7 8 intermediates := $(call local-intermediates-dir) 9 10 LLVMVersion := $(shell grep PACKAGE_VERSION $(LLVM_ROOT_PATH)/host/include/llvm/Config/config.h | sed -e 's/\#define PACKAGE_VERSION "\(.*\)"/\1/g') 11 12 # Compute the Clang version from the LLVM version, unless specified explicitly. 13 # (Copy from include/clang/Basic/Makefile) 14 CLANG_VERSION := $(subst svn,,$(LLVMVersion)) 15 CLANG_VERSION_COMPONENTS := $(subst ., ,$(CLANG_VERSION)) 16 CLANG_VERSION_MAJOR := $(word 1,$(CLANG_VERSION_COMPONENTS)) 17 CLANG_VERSION_MINOR := $(word 2,$(CLANG_VERSION_COMPONENTS)) 18 CLANG_VERSION_PATCHLEVEL := $(word 3,$(CLANG_VERSION_COMPONENTS)) 19 ifeq ($(CLANG_VERSION_PATCHLEVEL),) 20 CLANG_HAS_VERSION_PATCHLEVEL := 0 21 else 22 CLANG_HAS_VERSION_PATCHLEVEL := 1 23 endif 24 25 LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Basic/Version.inc 26 $(intermediates)/include/clang/Basic/Version.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Version.inc.in 27 @echo "Updating Clang version info." 28 @mkdir -p $(dir $@) 29 $(hide) sed -e "s#@CLANG_VERSION@#$(CLANG_VERSION)#g" \ 30 -e "s#@CLANG_VERSION_MAJOR@#$(CLANG_VERSION_MAJOR)#g" \ 31 -e "s#@CLANG_VERSION_MINOR@#$(CLANG_VERSION_MINOR)#g" \ 32 -e "s#@CLANG_VERSION_PATCHLEVEL@#$(CLANG_VERSION_PATCHLEVEL)#g" \ 33 -e "s#@CLANG_HAS_VERSION_PATCHLEVEL@#$(CLANG_HAS_VERSION_PATCHLEVEL)#g" \ 34 $< > $@ 35 36