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 6D1484C6C for ; Mon, 14 Jan 2019 13:08:51 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 056612AF5D; Mon, 14 Jan 2019 07:08:51 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 14 Jan 2019 07:08:51 -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=wqO9AGLc/2TExDODMuODCcYN3eBhbxtMCPuehjzaIu0=; b=Jl0il46h8Vn+ GQMESkS53oeFnj8f0XOUXyrw2YSVuRa7jMzzdtAl4owujBwhTL0aphSp94lbVwMS hJqQoUDIutMLSnwxeFnoh1iXVgKf17w9lmHrvs42Zz4tQbrLxtnYBaZpJ2qiGI/+ QyjACoGhOx66pBJDD5kJ/i6BAgMI6Vw= 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=wqO9AGLc/2TExDODMuODCcYN3eBhbxtMCPuehjzaI u0=; b=I5sYYOsKl37eXsVZUvpZ0ImXcMcTHjHD1AP/bJuER604CbnLfN8uuUqiV X3EvuKD2waSlQ+m8kQ3thORgeimb+pAM6g/YulO0SWTHWMlZEEPoN+5dK4wjzie0 JfFsUIurTzkyc18nmRVoKU0HMWGMkoHgUqaWYQUyZh8DytM0ENdvdMR4Hg+YkZ4M ej4qfFvEEaHE11/dSBHP4zazwYpbmhI3zqIzTAL+vD1eCmuHbfPfzYTTHToOMuPa tAjbutbLmxiNe1G3sdl2j3gXl6e9C2s2Jom0JDt9cQxAUSVPlP2niywkZcjk51p2 nRfUGbny+tnWYsQNbNWA5qi+2ZIug== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrgedugdefjecutefuodetggdotefrodftvf 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 65960E4598; Mon, 14 Jan 2019 07:08:49 -0500 (EST) From: Thomas Monjalon To: Jerin Jacob Kollanukkaran Cc: Pavan Nikhilesh Bhagavatula , "Gavin.Hu@arm.com" , "bruce.richardson@intel.com" , "dev@dpdk.org" Date: Mon, 14 Jan 2019 13:08:48 +0100 Message-ID: <1575046.QJcQsNME09@xps> In-Reply-To: References: <20190106131933.7898-1-jerinj@marvell.com> <7520753.4oEUPZEzPD@xps> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [EXT] Re: [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 12:08:51 -0000 14/01/2019 12:56, Jerin Jacob Kollanukkaran: > On Mon, 2019-01-14 at 12:35 +0100, Thomas Monjalon wrote: > > ------------------------------------------------------------------- > > --- > > 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$$ ? > > It is created per process with pid value. I see. The file is in current directory with name tmp + PID. > > If the command is interrupted in the middle, temp file is not > > cleaned. > > Yes. I think we can move to RTE_OUTPUT. Even it is not cleaned > then it is file, I think, that would be easiest solution. > > > We could fix it with "trap". > > Can we do it in Makefile? Yes, it is just one more command separated with ; > > Is it possible to just avoid creating a temporary file? > > I tried it but gcc creates one. It does not create a file in my test. A better command is: $(CC) -E $(1) -xc /dev/null >/dev/null Then you can just check the return value. If you want rte_cc_has_argument returns a string or empty as true/false, you can do this: $(CC) -E $(1) -xc /dev/null >/dev/null && echo $(1)