From: tim.gore@intel.com Subject: [PATCH] intel-gpu-tools: fix version.h creation in android Date: Thu, 24 Jul 2014 15:40:30 +0100 Message-ID: <1406212830-22393-1-git-send-email-tim.gore@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 031F56E0D1 for ; Thu, 24 Jul 2014 07:40:32 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org Cc: thomas.wood@intel.com List-Id: intel-gfx@lists.freedesktop.org From: Tim Gore commit 743dc7997aa9f5210055896940d87c88983dcda6 breaks the build under Android because version.h is not created. This happens because the android make executes from the ANDROID_BUILD_TOP directory rather than from the directory containing the source files, so we need Android specific make instructions to generate version.h Signed-off-by: Tim Gore --- lib/Android.mk | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/Android.mk b/lib/Android.mk index 6f444a0..d6b181d 100644 --- a/lib/Android.mk +++ b/lib/Android.mk @@ -1,6 +1,7 @@ LOCAL_PATH := $(call my-dir) GPU_TOOLS_PATH := $(LOCAL_PATH)/.. +IGT_LIB_PATH := $(LOCAL_PATH) # FIXME: autogenerate this info # $(GPU_TOOLS_PATH)/config.h: @@ -13,7 +14,7 @@ include $(LOCAL_PATH)/Makefile.sources include $(CLEAR_VARS) LOCAL_GENERATED_SOURCES := \ - $(GPU_TOOLS_PATH)/lib/version.h \ + $(IGT_LIB_PATH)/version.h \ $(GPU_TOOLS_PATH)/config.h LOCAL_C_INCLUDES += \ @@ -45,5 +46,30 @@ endif LOCAL_SRC_FILES := $(filter-out $(skip_lib_list),$(libintel_tools_la_SOURCES)) +.PHONY: version.h.tmp + +$(IGT_LIB_PATH)/version.h.tmp: + @touch $@ + @if test -d $(GPU_TOOLS_PATH)/.git; then \ + if which git > /dev/null 2>&1; then cd $(@D); \ + git log -n 1 --oneline | \ + sed 's/^\([^ ]*\) .*/#define IGT_GIT_SHA1 "g\1"/' \ + >> $(@F) ; \ + else \ + echo '#define IGT_GIT_SHA1 "NO-GIT"' >> $@ ; \ + fi \ + else \ + echo '#define IGT_GIT_SHA1 "NOT-GIT"' >> $@ ; \ + fi + + +$(IGT_LIB_PATH)/version.h: $(IGT_LIB_PATH)/version.h.tmp + @if ! cmp -s $(IGT_LIB_PATH)/version.h.tmp $(IGT_LIB_PATH)/version.h; then \ + mv $(IGT_LIB_PATH)/version.h.tmp $(IGT_LIB_PATH)/version.h ; \ + else \ + rm $(IGT_LIB_PATH)/version.h.tmp ; \ + fi + + include $(BUILD_STATIC_LIBRARY) -- 1.9.2