From patchwork Tue Apr 26 16:27:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 8940831 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C80229F441 for ; Tue, 26 Apr 2016 16:28:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 007BE20121 for ; Tue, 26 Apr 2016 16:28:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45C102022D for ; Tue, 26 Apr 2016 16:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752698AbcDZQ1U (ORCPT ); Tue, 26 Apr 2016 12:27:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53151 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546AbcDZQ1S (ORCPT ); Tue, 26 Apr 2016 12:27:18 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5061F46292; Tue, 26 Apr 2016 16:27:18 +0000 (UTC) Received: from firesoul.localdomain (ovpn-200-34.brq.redhat.com [10.40.200.34]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3QGRHjg024034; Tue, 26 Apr 2016 12:27:17 -0400 Received: from [192.168.42.3] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id E4DAE30065C64; Tue, 26 Apr 2016 18:27:16 +0200 (CEST) Subject: [net-next PATCH V2 2/5] samples/bpf: Makefile verify LLVM compiler avail and bpf target is supported From: Jesper Dangaard Brouer To: netdev@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, bblanco@plumgrid.com, Jesper Dangaard Brouer , naveen.n.rao@linux.vnet.ibm.com, borkmann@iogearbox.net, alexei.starovoitov@gmail.com Date: Tue, 26 Apr 2016 18:27:16 +0200 Message-ID: <20160426162716.22962.36473.stgit@firesoul> In-Reply-To: <20160426162650.22962.20516.stgit@firesoul> References: <20160426162650.22962.20516.stgit@firesoul> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Make compiling samples/bpf more user friendly, by detecting if LLVM compiler tool 'llc' is available, and also detect if the 'bpf' target is available in this version of LLVM. Signed-off-by: Jesper Dangaard Brouer Acked-by: Alexei Starovoitov --- samples/bpf/Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 5bae9536f100..45859c99f573 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -85,6 +85,24 @@ HOSTLOADLIBES_test_overhead += -lelf -lrt # make samples/bpf/ LLC=~/git/llvm/build/bin/llc LLC ?= llc +# Verify LLVM compiler is available and bpf target is supported +.PHONY: verify_cmd_llc verify_target_bpf + +verify_cmd_llc: + @if ! (which "${LLC}" > /dev/null 2>&1); then \ + echo "*** ERROR: Cannot find LLVM tool 'llc' (${LLC})" ;\ + exit 1; \ + else true; fi + +verify_target_bpf: verify_cmd_llc + @if ! (${LLC} -march=bpf -mattr=help > /dev/null 2>&1); then \ + echo "*** ERROR: LLVM (${LLC}) does not support 'bpf' target" ;\ + echo " NOTICE: LLVM version >= 3.7.1 required" ;\ + exit 2; \ + else true; fi + +$(src)/*.c: verify_target_bpf + # asm/sysreg.h - inline assembly used by it is incompatible with llvm. # But, there is no easy way to fix it, so just exclude it since it is # useless for BPF samples.