From patchwork Thu Jul 24 16:38:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tim.gore@intel.com X-Patchwork-Id: 4619191 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 96D569F37C for ; Thu, 24 Jul 2014 16:38:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3214201BC for ; Thu, 24 Jul 2014 16:38:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ACC6E2015D for ; Thu, 24 Jul 2014 16:38:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 232936E3DC; Thu, 24 Jul 2014 09:38:27 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CB896E3DC for ; Thu, 24 Jul 2014 09:38:25 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 24 Jul 2014 09:38:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,725,1400050800"; d="scan'208";a="578389865" Received: from tgore-linux.iwi.intel.com ([172.28.253.40]) by orsmga002.jf.intel.com with ESMTP; 24 Jul 2014 09:38:23 -0700 From: tim.gore@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 24 Jul 2014 17:38:22 +0100 Message-Id: <1406219902-17385-1-git-send-email-tim.gore@intel.com> X-Mailer: git-send-email 1.9.2 Cc: thomas.wood@intel.com Subject: [Intel-gfx] [PATCH v2] intel-gpu-tools: fix version.h creation in android X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 to differentiate between Android and linux builds. This is V2 of this patch based on Thomas Wood's suggestion. Signed-off-by: Tim Gore --- lib/Android.mk | 3 ++- lib/Makefile.am | 3 +++ lib/Makefile.sources | 20 +++++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/Android.mk b/lib/Android.mk index 6f444a0..5739c80 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 += \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 4d4efe4..9f6a021 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,3 +1,6 @@ +IGT_LIB_PATH := . +GPU_TOOLS_PATH := .. + include Makefile.sources noinst_LTLIBRARIES = libintel_tools.la diff --git a/lib/Makefile.sources b/lib/Makefile.sources index 2d971c5..96786e0 100644 --- a/lib/Makefile.sources +++ b/lib/Makefile.sources @@ -48,12 +48,14 @@ libintel_tools_la_SOURCES = \ $(NULL) .PHONY: version.h.tmp -version.h.tmp: + +$(IGT_LIB_PATH)/version.h.tmp: @touch $@ - @if test -d $(top_srcdir)/.git; then \ - if which git > /dev/null 2>&1; then git log -n 1 --oneline | \ + @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 \ @@ -61,12 +63,12 @@ version.h.tmp: echo '#define IGT_GIT_SHA1 "NOT-GIT"' >> $@ ; \ fi -version.h: version.h.tmp - @if ! cmp -s version.h.tmp version.h; then \ - echo "updating version.h"; \ - mv version.h.tmp version.h ;\ + +$(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 version.h.tmp ;\ + rm $(IGT_LIB_PATH)/version.h.tmp ; \ fi BUILT_SOURCES = version.h