From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id E67911B227 for ; Mon, 14 Jan 2019 12:35:30 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7D8952A8BF; Mon, 14 Jan 2019 06:35:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 14 Jan 2019 06:35:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=2FhzgPT7sp33mb6KBNGayM9h6jdLJA0kmVPjoZ7oj0o=; b=j7pwaFuHj4dw SagOdpg0kzDHOV7onFsvJbM4y6HxKc+6azll5Oezx6SVbbs4qc1pvolz4tYzw577 rOEbRkciSdsdoa9cbPVZ4UQOPRAfRJEveJxOoLoNVLSgigdmbXR2tfO+uWg7JW7O HvWRdmm9AOyZKXYtAyZA2G5H6KKkyCU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=2FhzgPT7sp33mb6KBNGayM9h6jdLJA0kmVPjoZ7oj 0o=; b=MXjA1/P8Y7ow41eUaHT8tecLpNmBV8xGsyQoLzeOCvezyInX4vpCTFoU8 Jxp1cp+TueujcPaopJIAKrJXNVhWV9o5ulIfgcWvBtAAS5FiPEN0ro4zo58rQ5pN +8oVWOsx+ymZAAyH5f5k/auiEWLiilx4GmpS1yJCFGHwzn+X3l7MdTiHeHzqAi8t XwJrEJZv74ed8kJTjXI/qBmFKGRMcRYaEHwPlUGBJ4VUJK/Yh2Cr45SJxBzO0rBK b6U1zSUhhCs0wRaB0vgc4WKtXwn9eOIbyR0OCbglwMetvh3ZCQMI10Id7CdKe8Sx SipqsiDYg4vBlAT/MKcbwbwzjFdhg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrgedugdefudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgjfh gggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceo thhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecuffhomhgrihhnpehvrghrshdrmh hkpdhhvghlphgvrhdrmhhknecukfhppeejjedrudefgedrvddtfedrudekgeenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvthenucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 325FB102DE; Mon, 14 Jan 2019 06:35:29 -0500 (EST) From: Thomas Monjalon To: Pavan Nikhilesh Bhagavatula , Jerin Jacob Kollanukkaran Cc: dev@dpdk.org, "Gavin.Hu@arm.com" , "bruce.richardson@intel.com" Date: Mon, 14 Jan 2019 12:35:28 +0100 Message-ID: <7520753.4oEUPZEzPD@xps> In-Reply-To: <20190109103915.29210-1-pbhagavatula@marvell.com> References: <20190106131933.7898-1-jerinj@marvell.com> <20190109103915.29210-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v4 1/5] 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: , X-List-Received-Date: Mon, 14 Jan 2019 11:35:31 -0000 09/01/2019 11:39, Pavan Nikhilesh Bhagavatula: > 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 > --- > --- /dev/null > +++ b/mk/rte.helper.mk > @@ -0,0 +1,12 @@ > +# 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) -Werror $(1) -c -x c /dev/null -o tmp$$ 2> /dev/null && rm -f tmp$$ && echo $(1) | xargs echo -n) > +endef What is tmp$$ ? If the command is interrupted in the middle, temp file is not cleaned. We could fix it with "trap". Is it possible to just avoid creating a temporary file?