From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id DAC66A0096 for ; Sat, 13 Apr 2019 22:19:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E4825F72; Sat, 13 Apr 2019 22:19:56 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id C4C765F62 for ; Sat, 13 Apr 2019 22:19:54 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3DKJrQ9019165; Sat, 13 Apr 2019 13:19:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=/TRA5ZekUlcwbZ5fVN5zkuekbsk4OYcibnRSRi7Gh4k=; b=hSgLq5rwGkU/WyOwgGwRyqoZt0b1paQP121+EAKVDZ7/FvFmyy5HW6PGWN9WPD+quzPq InpIutc4/yNiG/+lU/tkWkTMqYaf6wrCUax/SALbJ6y9iy5njScHx/mnkSxOjPu6qIVZ tMN08ct19Z6YulkNjIe3pckXzAX62jkd/6coXHdsxz3upCfL2wU/14uVLVzvHY7UHel2 Hzi82vrEBltGS6C9PHJ4HnjlQlqZh2hlaMZsmFged/wv6BM/JFRuuhg+GSflYsHnawfe vpJvmKie53Rr77NKpmomPdcVer3+vaofdOnnUoHVrdWhvWE1SvMoqveQRNZLcX458aIx Bg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2rud4nhb55-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 13 Apr 2019 13:19:53 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sat, 13 Apr 2019 13:19:52 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Sat, 13 Apr 2019 13:19:52 -0700 Received: from jerin-lab.marvell.com (unknown [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 4651F3F703F; Sat, 13 Apr 2019 13:19:51 -0700 (PDT) From: To: , Thomas Monjalon CC: , Jerin Jacob , Pavan Nikhilesh Date: Sun, 14 Apr 2019 01:49:43 +0530 Message-ID: <20190413201946.36566-1-jerinj@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190413190121.15416-1-jerinj@marvell.com> References: <20190413190121.15416-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-13_06:, , signatures=0 Subject: [dpdk-dev] [PATCH v10 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" Message-ID: <20190413201943.qnkczaVi5zUObeyReM2_cuerduJUnQfTynhbNpcetUc@z> 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: v10 Changes: - Fix the following checkpatch warning http://mails.dpdk.org/archives/test-report/2019-April/080453.html v9 Changes: - Remove compiler version check as it is now done using cc.has_argument(). v8 Changes: - Remove redudant lists (rebase aritfacts). (Yongseok Koh) 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: # -- 2.21.0