Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp2807469ybn; Thu, 26 Sep 2019 18:18:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqz02IGG6CKHxmfNMefMnvX3aq5hi+332WrXcKhQnzzmdQ7BYL4lqsIbo8LMAK23MvWccMQh X-Received: by 2002:a50:b501:: with SMTP id y1mr1865735edd.167.1569547126991; Thu, 26 Sep 2019 18:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569547126; cv=none; d=google.com; s=arc-20160816; b=w7uioCmJJuGqO5ORfOjujdk6ackAz5PqXBLamNSQ60p4m3l6h85Q+FeXUbTSkblONg pfupa3EuXIUNMMKrzFn+aAHG7PxoE6nGXvij6lr/5u/w80as6Up69yZfQj04vZ8nmrAF XinDlgjRYXmibASaqlaQEqzzAiFjgxYKAOeTINwY/zRAMDCfDmJVyX+c1phz7oNX6STo JMyfECdZizWsBrZFdNU9/Hc5dAmykFoX9B7yQ9a6BgPROrhUiZ/8du3wcFmzfa/0WIVI QQE+g5zwiWeqkV1HrTIUpZBIML7NZ9NcNV2O13m43hJZv/Tk7vyX/wcPhmqBnOZ481JI +vGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8j9rA1WD839oUqijh+Vh8zZRtr0Ej8NqAU1MM5cNTJc=; b=wM1sESx5Hjntr9kb7WxwBGrZ+dYbMi5ouTXlsnX89c71Kp/d4j0o+1jKZm6iYoJK0L WQm/bCLo+dRzyewSWMscnGXKAET6kovPma3x9ASrx/10iKY7VFjlO2zhTNnSPTFlvWEu 9KgZMLCT7ovZYoQil05yC7WakJShDVSn8d9pgf/EOLcTe4xKfBpatrzLeQNAt20pYxvU zTTp/sv2g122GNQzLOjXiRsKjVjlMIpHbgkGUVm4qW9Plx3d0uU8dce5OgHU7o5hQANG zD8Ivqhsr//P9uiSZtoMw7IwRV9+0LESRZYMkaaVdZyNE2iSo1NKEynbUgjEC2nKGYyt TInA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=dX6f3lPv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16si1974489ejc.73.2019.09.26.18.18.22; Thu, 26 Sep 2019 18:18:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=dX6f3lPv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727542AbfI0BNs (ORCPT + 99 others); Thu, 26 Sep 2019 21:13:48 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:39311 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbfI0BNs (ORCPT ); Thu, 26 Sep 2019 21:13:48 -0400 Received: by mail-io1-f68.google.com with SMTP id a1so11836774ioc.6 for ; Thu, 26 Sep 2019 18:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8j9rA1WD839oUqijh+Vh8zZRtr0Ej8NqAU1MM5cNTJc=; b=dX6f3lPvSg9p2xx0kSYYtSRW/JjhIx4eA1YpglOO+6kZKvxeJICogR/PdXk9SyluNE d/qt5V5/PUpkaX+OSSVc5kSdh/AmzoxZ5aMrEr4rEgwa7fil0v9ZZX4A34BfhjiZdyLo xxSwfEFenWsZrSvfYTJwR5aDCJitIxqWKE8tw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8j9rA1WD839oUqijh+Vh8zZRtr0Ej8NqAU1MM5cNTJc=; b=Rre+E2SYU3AXNv/Ytl6pd17wwjfu6weud6z15nViOwoDvGq+Ye5LvNI4HGnXXDSlGI oNYIip7YFg86BVFkxNAly8lH+w/YMoJ/08mLudn/8oQOtx/23A/g6ThlxS1gkwSEbYau NKg1HoGptMJmnZ8NJdoJAzTmdxTu1Ibw1QI8KMCYctx0n8ywTyPMWYo1w7YR4yrPRK7B xq8ZlSx0UMCipCra+loned8fwD/HIA3p5P7kEkARC+Zkfp0b1dC68P8q6MeLxH/2nyD2 zkMBb4//+2coaPf6dxzOcF6ZA8n0cpySmsc18jRzQ6iNeQhFc/pgF3xRWxElGsLesWcq +UEw== X-Gm-Message-State: APjAAAU+hpwRXxrIMUaYIVvq0uiWyt32Km8l7pz6ZoYjsG0pTotFqPoU XGMZVu2gLdUVWEM71LS7QxlA7Q== X-Received: by 2002:a02:1cc5:: with SMTP id c188mr6360952jac.26.1569546827184; Thu, 26 Sep 2019 18:13:47 -0700 (PDT) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id h70sm1907469iof.48.2019.09.26.18.13.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 18:13:46 -0700 (PDT) From: Shuah Khan To: ast@kernel.org, daniel@iogearbox.net, kafai@fb.com, songliubraving@fb.com, yhs@fb.com Cc: Shuah Khan , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree Date: Thu, 26 Sep 2019 19:13:44 -0600 Message-Id: <20190927011344.4695-1-skhan@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org make TARGETS=bpf kselftest fails with: Makefile:127: tools/build/Makefile.include: No such file or directory When the bpf tool make is invoked from tools Makefile, srctree is cleared and the current logic check for srctree equals to empty string to determine srctree location from CURDIR. When the build in invoked from selftests/bpf Makefile, the srctree is set to "." and the same logic used for srctree equals to empty is needed to determine srctree. Check building_out_of_srctree undefined as the condition for both cases to fix "make TARGETS=bpf kselftest" build failure. Signed-off-by: Shuah Khan --- tools/bpf/Makefile | 6 +++++- tools/lib/bpf/Makefile | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile index fbf5e4a0cb9c..5d1995fd369c 100644 --- a/tools/bpf/Makefile +++ b/tools/bpf/Makefile @@ -12,7 +12,11 @@ INSTALL ?= install CFLAGS += -Wall -O2 CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include -ifeq ($(srctree),) +# This will work when bpf is built in tools env. where srctree +# isn't set and when invoked from selftests build, where srctree +# is set to ".". building_out_of_srctree is undefined for in srctree +# builds +ifndef building_out_of_srctree srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) endif diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index c6f94cffe06e..20772663d3e1 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -8,7 +8,11 @@ LIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION))) MAKEFLAGS += --no-print-directory -ifeq ($(srctree),) +# This will work when bpf is built in tools env. where srctree +# isn't set and when invoked from selftests build, where srctree +# is a ".". building_out_of_srctree is undefined for in srctree +# builds +ifndef building_out_of_srctree srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) srctree := $(patsubst %/,%,$(dir $(srctree))) -- 2.20.1