From patchwork Sat Apr 6 14:27:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob X-Patchwork-Id: 52368 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9DAFA3576; Sat, 6 Apr 2019 16:28:25 +0200 (CEST) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id 392BD34F3 for ; Sat, 6 Apr 2019 16:28:24 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id w25so3454008pfi.9 for ; Sat, 06 Apr 2019 07:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5+XZ9MpJ57nnOoZqvrcM9a7WTriq2hN1jRkmPvgLpd0=; b=BjnuTRMIN318k+8c6YJnHIbpITZUqbC8v2S7+VpqeCgqQ2kAA/PFqbFjtEa6z6BIny tCXDnjIo2o0yQ7JDUO9AOKMwu2EauCzMpMYxlr4Bszbm6PRenpPEn0Sy4jG2m8OupMiu RYjlc6TNDtMTfwCdw9G59kWXDVYDojDtuQnWlFCERQoYyji012QanttSlzp4LKwliDnc Oe4LpjMAQk99dHlc5MFErei28TfX9Edy6QZuBLOROLSahTV9dyQlB+jkrZr7ut6pkpor YrdpAKwMcaxDqcguE4BpIfivs9W1Ee8FB4D2Yr1JLm+63rIWlmhjg2x/vW6pf7qD9FH+ 38Zg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=5+XZ9MpJ57nnOoZqvrcM9a7WTriq2hN1jRkmPvgLpd0=; b=mdqsUgfQG1Xt33uZZnpqUXCfV0p9R/0Z2RC+z6T2x7KIml1Pzv3oEKe3rXEkEiu9Rw V+fi2OoMTwhgPDCLXpO4IOTfuTNFvriv9YVANWp1uEegDQ1l0OYT3tEfyYRFPSGQp3tn GrZrFhqMtVf5JUAWGgWgGS9nXhOrSeaLnnfPS+70jIz/aRrqr5Da+fO3uqeiPeCIwDzo voltgsNaljXx4M5ln3qc/iHUldRB9PMx3Z9er0x7he/MdCHzeaZTcfz00mAaFZvCU+eZ PxJy44dXbTdXe/tKKEyCzjjTL+rQbodmLNPErfQlRub5qif7tOjShZd5TF5lSLAtyFGi ULbw== X-Gm-Message-State: APjAAAXWg9PmMs/+/ItHArtRb10XWU6FiBKtLJgnCiO0dKrlHyCU/0Ye oEsykek9YGGzniXP2gHCDOHBgR3BND8= X-Google-Smtp-Source: APXvYqxxY/cFZL5LvxKEAhJ43Oj937Llhpg8xdvzohS0uFITUa3jYvmeIvd9+/LjN7PPlQuw3cPbTg== X-Received: by 2002:aa7:9a89:: with SMTP id w9mr11546360pfi.213.1554560903178; Sat, 06 Apr 2019 07:28:23 -0700 (PDT) Received: from jerin.caveonetworks.com ([223.226.40.87]) by smtp.gmail.com with ESMTPSA id o5sm84199008pfa.135.2019.04.06.07.28.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Apr 2019 07:28:22 -0700 (PDT) From: jerinjacobk@gmail.com X-Google-Original-From: jerinj@marvell.com To: Thomas Monjalon Cc: dev@dpdk.org, Jerin Jacob , Pavan Nikhilesh Date: Sat, 6 Apr 2019 19:57:34 +0530 Message-Id: <20190406142737.20091-1-jerinj@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190318164949.2357-1-jerinj@marvell.com> References: <20190318164949.2357-1-jerinj@marvell.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 1/4] mk: introduce helper to check valid compiler argument X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jerin Jacob Introduce rte_cc_has_argument() Makefile helper to check a given argument is support by the compiler. Example Usage: include $(RTE_SDK)/mk/rte.helper.mk MACHINE_CFLAGS += $(call rte_cc_has_argument, -mcpu=octeontx2) This would allow adding -mcpu=octeontx2 in MACHINE_CFLAGS if it is only supported by the compiler. The use case for such scheme is to enable the mcpu optimization if the compiler supports else it needs to compile the source code without any errors. This patch also moves inclusion of toolchain's rte.vars.mk to before the machine's rte.vars.mk inclusion to make correct CC available for the cross compile case. Signed-off-by: Jerin Jacob Signed-off-by: Pavan Nikhilesh --- Change history of this series: v7 Changes: - Updated cross compile config files align with "build: improve pcap dependency handling" changeset to fix build issue with meson - Some compiler needs the following depended patch to compile with meson http://patches.dpdk.org/patch/52367/ v6 Changes: - Rework to change the config files to sync with "mk: use linux and freebsd in config names" - Fix the following error with latest gcc by fixing the mcpu type cc1: error: switch -mcpu=armv8.2-a conflicts with -march=armv8-a switch v5 Changes: - Fix incorrect meson flag parsing(Phil Yang) - Squash meson cross build patch(5/5) into configuration update patches for thunderx2(3/5) and octeontx2(4/5)(Thomas) - Changed octeontx2's march as armv8-a and added the extension required instead of armv8-2a(Phil Yang) - Improved rte_cc_has_argument() implementaion by removing the temp file(Thomas) v4 Changes: - Fix incorrect signoff marrvell -> marvell. v3 Changes: - Squash meson build support into config support for thunderx2/octeontx2. v2 Changes: - Add meson build support. --- mk/rte.helper.mk | 10 ++++++++++ mk/target/generic/rte.vars.mk | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 mk/rte.helper.mk diff --git a/mk/rte.helper.mk b/mk/rte.helper.mk new file mode 100644 index 000000000..6e7fd03d7 --- /dev/null +++ b/mk/rte.helper.mk @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Marvell International Ltd + +# rte_cc_has_argument +# Usage: MACHINE_CFLAGS += $(call rte_cc_has_argument, -mno-avx512f) +# Return the argument if the argument is supported by the compiler. +# +define rte_cc_has_argument + $(shell $(CC) -E $(1) -xc /dev/null 1>/dev/null 2>/dev/null && echo $(1)) +endef diff --git a/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk index dd149acc9..25a578ad7 100644 --- a/mk/target/generic/rte.vars.mk +++ b/mk/target/generic/rte.vars.mk @@ -7,6 +7,17 @@ # executive environment. # +# +# toolchain: +# +# - define CC, LD, AR, AS, ... +# - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value) +# - may override any previously defined variable +# +include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.vars.mk + # # machine: # @@ -45,17 +56,6 @@ endif # include $(RTE_SDK)/mk/arch/$(RTE_ARCH)/rte.vars.mk -# -# toolchain: -# -# - define CC, LD, AR, AS, ... -# - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value) -# - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value) -# - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value) -# - may override any previously defined variable -# -include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.vars.mk - # # exec-env: #