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 D2935A0096 for ; Wed, 10 Apr 2019 18:14:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4FDA57CB0; Wed, 10 Apr 2019 18:14:40 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id CE3F26904 for ; Wed, 10 Apr 2019 18:14:38 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id t16so1729700plo.0 for ; Wed, 10 Apr 2019 09:14:38 -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=mjrkgDUjnSPd4d3YJatc1tdp5kQu5uueRLD+Y19dAr8=; b=Vz198Vzv4/vwdBwRncZXmT4m9qiAJy1QfkIPlbJo84PR09HQamm8CImfbFmqCp5OSL XijsiTY+6VhCYrWrOOveHWxzFbw3XMKkT7FjZpbMLOLS/HgLRMfK3Lr/DFwMcUDImtMl pYnf30zIqoaDnEoJYV4XqbjGJc9ev2sM4p8vmFSZzAGqHHH/xushScTtKCiG7Bi+WsI6 VFqCR3dlov8TTn1W1CZGA2duiwqwmMPTzg8bU7w/QX/A06HVXnE0l/pS8RZ2+8ByEUv+ DRu2v3JwShtyf4PjQYz1ZxOFZGnuYv+QTfqCanHlcLME5HwzDpjSztCFEngjXFo3gFWP R9bA== 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=mjrkgDUjnSPd4d3YJatc1tdp5kQu5uueRLD+Y19dAr8=; b=c5hTsEoyX7FqwegDUHOe+uM8pggnDDcokQmWjlssHR3Siz3i77p+UDYLTlcVtbxLbZ dqgenolG8H27+NoRtBejsdLt75EYe4zKByukSMMNUf9/0Tk+S3Z8r+bD4n7hwxqS8F4g KL7KyooMlE8/OfHab3pfw+VMZcoNP+KWbTZnZU9x70I05UQGxqVnCPG76OVoOdfp9lns pUfbAKIx19BMXmC8JQVQ6wvaszFaM9OdzPA9ACgJeGn1pkZVtcEAIpoqzDzXvSs9mbNr yoBThBgc/dFh5ExEC3NVucr/Quv6Q3rieiTFBpdOuh1ChwP1AluCwN54Y1YBYwe7HZHX 6EkA== X-Gm-Message-State: APjAAAUzajpQMDnPt5sNRY1Cz/xIdYH/Y36qerfmA68LGKcYiKEZ0WzQ HFF6EHHruTsnGh5In93zn60= X-Google-Smtp-Source: APXvYqx+dzXn3mW+UDBIaVUGb2YICIit4TNMRPQg+AGIROeV5Vlw4aVbUhsiwF7K9w4G9iV0BO0g6w== X-Received: by 2002:a17:902:9004:: with SMTP id a4mr45350224plp.223.1554912877378; Wed, 10 Apr 2019 09:14:37 -0700 (PDT) Received: from jerin.caveonetworks.com ([122.178.209.229]) by smtp.gmail.com with ESMTPSA id s79sm88447577pfa.31.2019.04.10.09.14.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 09:14:35 -0700 (PDT) From: jerinjacobk@gmail.com X-Google-Original-From: jerinj@marvell.com To: Thomas Monjalon Cc: dev@dpdk.org, yskoh@mellanox.com, Jerin Jacob , Pavan Nikhilesh Date: Wed, 10 Apr 2019 21:43:57 +0530 Message-Id: <20190410161400.9361-1-jerinj@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190406142737.20091-1-jerinj@marvell.com> References: <20190406142737.20091-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v8 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190410161357.x1C2U7w04MZ6la1TIHgTxFojmSKCS5lOZWdR4e14PJw@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: 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