From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 36C0D1B3B0 for ; Mon, 7 Jan 2019 16:42:13 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x07Ffmvw026208; Mon, 7 Jan 2019 07:42:10 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=/tQBKn15m56iEZyKgpiy583FtaD85wF76tC2UO/OYRU=; b=c2BFzG6DHxswSJVnq+DosXByIX/7U43B4qawc5mxIWfZN7PeMbCPHNRSjQZh+mbG6APu eif35+ADzLF/RJA6Kwq9lugT7EXUARTgpEeJVLGHCvDFv8wPZkrT4ATUyi1t/gSStana IEQa5Wx5rzkL7q6WNGJSqYipkPwmQaYP8S8snCX4Ffj489MbBKZVIzyooqSULOr0gEzz mkF9eB9c+U9PlVmD5EzKncLrDKD6JBSSOAHEzpb86OLZNrzn+vop9Q8sGphSc2xvJ0OW Y06lSN05J9KxmjmtYJ0KY7wA3c3NU+um+AHcqidL/JR57uVvEj6SbA03IdMfG7+7qMYf /w== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2pv58srxtj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 07 Jan 2019 07:42:09 -0800 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; Mon, 7 Jan 2019 07:42:08 -0800 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (104.47.42.55) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 7 Jan 2019 07:42:08 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/tQBKn15m56iEZyKgpiy583FtaD85wF76tC2UO/OYRU=; b=N7uLj8xcnbBjR9ecfgR++LWVFqbV6loTrjkrwFyGcwh+xZeLoLENZHPYTRcKglEFMpPDdZCsFfuz5DtBH45PPJK/9WBIFwvwawZbjKccCS+naQF46/wV+7wyekpG0Ga0cNQyu4tkcWElpyG8blcXp8OoicD1w85tKrWHQxv7U8Q= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.14) by CY4PR1801MB2054.namprd18.prod.outlook.com (10.171.255.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Mon, 7 Jan 2019 15:42:06 +0000 Received: from CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::8d37:71d9:3b0c:ad00]) by CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::8d37:71d9:3b0c:ad00%2]) with mapi id 15.20.1495.011; Mon, 7 Jan 2019 15:42:06 +0000 From: Pavan Nikhilesh Bhagavatula To: Jerin Jacob Kollanukkaran , "Gavin.Hu@arm.com" , "bruce.richardson@intel.com" , "thomas@monjalon.net" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 1/6] mk: introduce helper to check valid compiler argument Thread-Index: AQHUpp+Knjqaxbd2wEush3jGyyVTnQ== Date: Mon, 7 Jan 2019 15:42:06 +0000 Message-ID: <20190107154129.24700-1-pbhagavatula@marvell.com> References: <20190106131933.7898-1-jerinj@marvell.com> In-Reply-To: <20190106131933.7898-1-jerinj@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR01CA0102.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::18) To CY4PR1801MB1863.namprd18.prod.outlook.com (2603:10b6:910:7a::14) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [111.93.218.67] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR1801MB2054; 20:kM0uSTHKfovOKq3X8i/5wBd/xqqxyseuHoZOgcvgCX6DUuvevoAZX5gwqHFPCqgnaMvGpsi4fjieTbIIzsI0r0RapL4MSl7s89trISUtTo2g4ye2erVRfE+nK+LLBsCQVOxWGVXC4kpKppbm7tZGRR/ZgZ6jHIUgx04BeBYXmio= x-ms-office365-filtering-correlation-id: 331d50a8-fbf3-456e-f127-08d674b6ad1d x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:CY4PR1801MB2054; x-ms-traffictypediagnostic: CY4PR1801MB2054: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(93006095)(93001095)(3002001)(3231475)(944501520)(52105112)(10201501046)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:CY4PR1801MB2054; BCL:0; PCL:0; RULEID:; SRVR:CY4PR1801MB2054; x-forefront-prvs: 0910AAF391 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(376002)(346002)(39860400002)(136003)(199004)(189003)(71190400001)(71200400001)(2906002)(68736007)(2501003)(105586002)(3846002)(6506007)(76176011)(6116002)(256004)(386003)(14454004)(52116002)(106356001)(6512007)(102836004)(478600001)(26005)(186003)(6436002)(86362001)(36756003)(305945005)(2201001)(446003)(476003)(8676002)(25786009)(53936002)(316002)(81166006)(66066001)(81156014)(110136005)(8936002)(5660300001)(4326008)(11346002)(6486002)(78486014)(97736004)(99286004)(486006)(2616005)(7736002)(1076003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB2054; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 329M3IGlxM39YwAPYRyzwWwBrlHbuyF8mQg0i3xtOtoS+Meu8pFYcjLOWi7EeX4kyHdovy74Yp86oW0dDJEpqQT8l2LqfC4e2YP6akWQMuE/Aui3x8nxn2+kIFF9vmPPkAcTgqEWkrLMrRPGMEjybkIEflwfvYWEZOUNZsmQ/XvCmVWfGvLATpqugX2Pqe8yY/8ggn2i/miKHOslRhM2bQMDm8y9cYL7VclrYOkH/e//pzxnG4Y37R0WmrW7iQ6LR7sx28LVJnYGmK75QqZRKtI/MVAsd0pc1ia0T3C+ZZOfPJM0qkqS1LIe5XJ7n1hF spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 331d50a8-fbf3-456e-f127-08d674b6ad1d X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2019 15:42:06.2358 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1801MB2054 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-07_07:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=852 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901070137 Subject: [dpdk-dev] [PATCH v2 1/6] 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, 07 Jan 2019 15:42:13 -0000 From: Jerin Jacob Kollanukkaran 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 +=3D $(call rte_cc_has_argument, -mcpu=3Docteontx2) This would allow adding -mcpu=3Docteontx2 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 --- mk/rte.helper.mk | 12 ++++++++++++ mk/target/generic/rte.vars.mk | 22 +++++++++++----------- 2 files changed, 23 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..2c5d5275e --- /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 +=3D $(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 + + 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. # =20 +# +# 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 =20 -# -# 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: # --=20 2.20.1