From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (EUR03-DB5-obe.outbound.protection.outlook.com [40.107.4.66]) by mx.groups.io with SMTP id smtpd.web11.7139.1580827385820204532 for ; Tue, 04 Feb 2020 06:43:06 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=AGM77XvR; spf=pass (domain: arm.com, ip: 40.107.4.66, mailfrom: pierre.gondois@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mVt4+P37wyuN/VYoXZgxlvaudC2a+OHGv9cbx6GZHxg=; b=AGM77XvRmMSvJSbIupV3M6OEB9phFuAO5S5xT67tMUHEJzmNMUYfehzmLpD4KW3hFibk++RHRr24ZaC2J1Pue5bzJCRtbPlIPBNHdNxEPbECBoWxXMy6Dzyt1kQQuPYSXSAEV1EmmHaP39jEwATQ798lzfFAklztaRRtjntu5q4= Received: from VI1PR08CA0166.eurprd08.prod.outlook.com (2603:10a6:800:d1::20) by DB6PR0801MB1624.eurprd08.prod.outlook.com (2603:10a6:4:38::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.29; Tue, 4 Feb 2020 14:43:03 +0000 Received: from VE1EUR03FT019.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::205) by VI1PR08CA0166.outlook.office365.com (2603:10a6:800:d1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.34 via Frontend Transport; Tue, 4 Feb 2020 14:43:03 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT019.mail.protection.outlook.com (10.152.18.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.18 via Frontend Transport; Tue, 4 Feb 2020 14:43:02 +0000 Received: ("Tessian outbound d1ceabc7047e:v42"); Tue, 04 Feb 2020 14:43:01 +0000 X-CR-MTA-TID: 64aa7808 Received: from 8540d7b8500b.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 81E2C9E6-43B1-4E72-BF8A-CB33F2792579.1; Tue, 04 Feb 2020 14:42:56 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8540d7b8500b.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 04 Feb 2020 14:42:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I7TJzR2mLZZruaGsA1LISz0hWTlbmbNr/XvHYSUNk27W9/N0/ZHCB8jvay8rm8wGN6Om0sblQ4sJSQhzhWbecLRzwP4W0TgZoGB2BL4ouFWuBrAvXJxcnnxejpClyj2FkUT9LQdW8ufi5UoUrnTdmnt+5zJw4nfsPJNyDhE3vDrUBGGOamaziZHpTfKS5WXfwaOfKBbptOyuiWvPbKyWrXmy0pudVPAJrvRon+AV+71E/OuGuGuqCrB7AZvznMag02eGAn8dtMriwO+g/a9PZlH8pN56he9+jd/ZUA43Zr6IM4WVrJ6Is6J+rRPjj8ws9oSE5HaPnVUWGfkV4s+ngA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mVt4+P37wyuN/VYoXZgxlvaudC2a+OHGv9cbx6GZHxg=; b=eDwM1Lt5PO4pjYJ2iR+eEQjC7u2i/XWXfZmJeVMKCcXeQjrBq2wxPhEld1hCjG58gE5BiXLWTLzQdAy9wkFx+C4N+B7DQuFQ0PMlplVR1PH1XkZ6OvIRIsQvDTpwZpVII/jKOFhMO1WaprZtpvdIOm+UoLlf/I5yTpz9HyteGrbALqCuB3tuBzgaR9LXavZE65tLwBJck6nGiciY8v8Ha4LWUNr5wXJFN7QaBwr9HoZ6JmqLqyNWTYq5iXeWPBx35tW8WmiBm/TmJwF/VvIPV4sx0t4GDjBvgr1eusk6GZy9riGjN1fHk+Og848xBxkFzqjTjFY5PnMh8Ukzz7IDZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mVt4+P37wyuN/VYoXZgxlvaudC2a+OHGv9cbx6GZHxg=; b=AGM77XvRmMSvJSbIupV3M6OEB9phFuAO5S5xT67tMUHEJzmNMUYfehzmLpD4KW3hFibk++RHRr24ZaC2J1Pue5bzJCRtbPlIPBNHdNxEPbECBoWxXMy6Dzyt1kQQuPYSXSAEV1EmmHaP39jEwATQ798lzfFAklztaRRtjntu5q4= Received: from DB7PR08MB3113.eurprd08.prod.outlook.com (52.134.111.149) by DB7PR08MB4588.eurprd08.prod.outlook.com (20.178.45.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.27; Tue, 4 Feb 2020 14:42:55 +0000 Received: from DB7PR08MB3113.eurprd08.prod.outlook.com ([fe80::6d14:b899:9fc4:d248]) by DB7PR08MB3113.eurprd08.prod.outlook.com ([fe80::6d14:b899:9fc4:d248%4]) with mapi id 15.20.2686.034; Tue, 4 Feb 2020 14:42:55 +0000 From: "PierreGondois" To: "devel@edk2.groups.io" , "liming.gao@intel.com" CC: "Feng, Bob C" , Sami Mujawar , nd Subject: Re: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise makefile generation Thread-Topic: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise makefile generation Thread-Index: AQHV21LZIWlSWt9oC0Si+qo5O8MNF6gK7xJwgAAeWgCAAAeIkA== Date: Tue, 4 Feb 2020 14:42:54 +0000 Message-ID: References: <15F0315032D95F8E.2867@groups.io> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: befe7a63-bad0-4f53-b330-2ed9a8947bbc.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Pierre.Gondois@arm.com; x-originating-ip: [217.140.106.52] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f192ae9e-a120-4bbc-2adc-08d7a98089c3 X-MS-TrafficTypeDiagnostic: DB7PR08MB4588:|DB7PR08MB4588:|DB6PR0801MB1624: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:2449;OLM:2449; x-forefront-prvs: 03030B9493 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(136003)(346002)(376002)(39860400002)(366004)(396003)(199004)(189003)(8936002)(81156014)(2906002)(81166006)(110136005)(5660300002)(54906003)(7696005)(26005)(6506007)(186003)(53546011)(8676002)(316002)(86362001)(478600001)(966005)(52536014)(55016002)(9686003)(30864003)(71200400001)(33656002)(66946007)(76116006)(4326008)(64756008)(66446008)(66556008)(66476007)(559001)(579004)(460985005);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR08MB4588;H:DB7PR08MB3113.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 35mfoLtM3x8RHDw7Sk8SH/5knOLX9vlLA/R4cYpMK9d0VTCGPkQe46iVj16pCYV2s+X2hsJjRyPAs9mjRgcUVxkKqAeK7uMXQbi/tDEz1pxwpI8e4bMiZ/iRSZ9tkbtgZjwf9c1CFNSdOL78hw9zcmoXXflOwwc+QRuWnO5dES/mDyZwLDxOK/R5klnd8aOv+0mme70yb0AOHGVfsdXfpsnDegItCxJdB5t5lRxqoeFlLaO5xoaJ11lqTP055OjBOCWUW0Sieu6eafT3Qc7Dqd0fjqTPx2KcQUPIXnI9v6cYnJycEwc+FHMBiq4WBI/tEER6vJGNtK8IXeSCpdj9+NG/uiJyRUYB1AWEJq0NAQacvXuXvfwrLrIIwp84lq7dkYokF/FrIlX9tNLc8iny2AIiRF2YWA7KZXIIenCOYvJQ+k/1EyckOdvh1PySKW1sFK1ChIaVcm1bY3DJ5be2w6bMuhoS7xBQ0off2PwPGlPcZiwWXVTCbLgDK0pzQSzr9XbKarM7cw5GEaqPfuiJ6stbxOtKsj/AroeC13VsrKvWzeztmQRMz7OPFwXdT6a+ x-ms-exchange-antispam-messagedata: BZXdKXa7/u0pn4ZTpralIa6XyY8PlEcUmWktZnOim0KZI+sAhpkwlY5QRxHLpFMqhdvb6A7qAm7ca9eC6U8uCW+goH0Kg6A+pGmyUUHC7gIp9JwaitrJM0MAG3liVSNcG7Dnk1AR3zrwidmRX0i3uA== MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB4588 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pierre.Gondois@arm.com; Return-Path: Pierre.Gondois@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT019.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(396003)(39860400002)(346002)(189003)(199004)(70586007)(186003)(70206006)(55016002)(9686003)(478600001)(8676002)(2906002)(81166006)(8936002)(33656002)(81156014)(5660300002)(336012)(966005)(26826003)(30864003)(52536014)(356004)(4326008)(86362001)(54906003)(110136005)(316002)(6506007)(7696005)(36906005)(26005)(53546011)(460985005);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0801MB1624;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:Pass;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;MX:1;A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 8737bc83-0722-4c79-da20-08d7a980852c X-Forefront-PRVS: 03030B9493 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1YovltnpHAkiZXw9ibGDOXc4pgY7fU/hF3VVM9rD/kG8mt2HJ1kh61d/meFGgMRwHE9EzcTMFgXbAoLbM4gl+HZlAYJGXTCIuRBWrkFFnvsjblBsi+Ym/SCLCwTLVbeid05e7cxMC4a2hDJSleFKiqQrOYrQjhuGwBgndHzBqefoxIKUo8MUB4ZDi4a7/bDYepXSa1Qn6GTpLG+UzPNsWzD+FORrQzJ+XHCa8dVnytEVWBNH6K1NXbmotSWcFZBuSPBzUonElPVTwYnvr/fdqDjeRLborO2hZlkrQ/qC0Xa2Am9o63ll77XtVUg6YrEt/gNOshjTMrn1W+8qMMsHMrDGF6TQeSuKg1jXTF9Orcj+o4qlH2KwwyTP6OwtODGTkQxaYxfV9tLwSSAqVv2BM99X2IIfGPPgaQfWSPjwT17cyFyv8ofkNBFp5daIkYTprNkqVul2gIRQulofxQBafbITM5xsknL8hKWwBrwfT3C4M+6OSuR4fYRSKqL2SAKJQdCZtEttw49Efu2QX0KI0Mq6nOwrSsDlDIoP781VS5MGa/DRg+XToQzg1VjM8DB0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2020 14:43:02.6850 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f192ae9e-a120-4bbc-2adc-08d7a98089c3 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1624 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello Liming, > I think below three configurations are common. With this patch, they ca= n work fine, right? [1] Windows - GCC - GNUmake [2] Windows - VS2017 - nmake [3] Linux - GCC5 - GNUmake I tested the following setups: * On AARCH64 - DEBUG build - [ShellPkg], configurations [1], [2] and [3]= are working well. * On [IA32|X64] - DEBUG build - [ShellPkg], configurations [2] and [3] a= re working well. * On [IA32|X64] - DEBUG build - [ShellPkg], configuration [1] fails bec= ause of unsupported compiler options from mingw-gcc. These compiler issues = are not related with the patch. This configuration could not work before th= is patch and making this configuration works is beyond the scope of this pa= tch. > And, do you mean Windows - GCC - GNUmake is still blocked by the change = "0c3e8e9947a6c13b4327dd11b20acb95441701cf BaseTools: Enhance Basetool for i= ncremental build"? We are mainly using the configuration [1] to build edk2 for AARCH64. We be= lieve the change introduced by 0c3e8e9947a6c13b4327dd11b20acb95441701cf mad= e our build stop working. This patch would allow it to work again. Regards, Pierre -----Original Message----- From: devel@edk2.groups.io On Behalf Of Liming Gao = via Groups.Io Sent: 04 February 2020 13:50 To: devel@edk2.groups.io; Pierre Gondois Cc: Feng, Bob C ; Sami Mujawar ; nd Subject: Re: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise makefile g= eneration Pierre: I think below three configurations are common. With this patch, they can= work fine, right? And, do you mean Windows - GCC - GNUmake is still blo= cked by the change "0c3e8e9947a6c13b4327dd11b20acb95441701cf BaseTools: Enh= ance Basetool for incremental build"? > Windows - GCC - GNUmake > Windows - VS2017 - nmake > Linux - GCC5 - GNUmake Thanks Liming > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of=20 > PierreGondois > Sent: Tuesday, February 4, 2020 8:03 PM > To: devel@edk2.groups.io; Pierre Gondois > Cc: Feng, Bob C ; Gao, Liming=20 > ; Sami Mujawar ; nd=20 > > Subject: Re: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise=20 > makefile generation >=20 > Hello Liming and Bob, > To answer Liming's questions, I am building the DynamicTablesPkg with=20 > the patch with the AARCH64-DEBUG and the following > configurations: > Windows - GCC - GNUmake > Windows - GCC - nmake > Windows - VS2017 - GNUmake > Windows - VS2017 - nmake > Linux - GCC5 - GNUmake > For the record, when building with the Windows-VS2017-GNUmake configurat= ion, the *_*_*_MAKE_FLAG(S) variable is set to "/nologo". > As this is a nmake specific flag, it has to be removed when using=20 > GNUmake. Some warning flags also need to be slightly modified when build= ing with VS2017. > To modify the type of make tool to use (GNUmake or nmake), I modify the = following variable in Conf/tools_def.txt: > *_[GCC5|VS2017]_*_MAKE_PATH =3D [nmake|GNUmake] >=20 > I am building the ShellPkg with the patch and a small modification on=20 > how nasm files are added for IA32 and X64 for the following > configurations: > Windows - VS2017 - GNUmake > Windows - VS2017 - nmake > Linux - GCC - GNUmake >=20 > Unfortunately, the gcc compiler available on windows doesn't provide all= the options of the one available on linux. For instances: > * When building ShellPkg-DEBUG build-X64 -Windows-GCC-[nmake], the "-mc= model=3Dsmall" option provided is not supported. > * When building ShellPkg-DEBUG build-IA32-Windows-GCC-[nmake], the "-m,= elf_i386" option provided is not supported. > These issues are related to the compiler and not to the patch. >=20 > The Windows-GCC-GNUmake configuration is very important for Arm. This=20 > configuration was working fine until patch "0c3e8e9947a6c13b4327dd11b20a= cb95441701cf BaseTools: Enhance Basetool for incremental build" was merged = in edk2. >=20 > Regards, > Pierre >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of=20 > PierreGondois via Groups.Io > Sent: 04 February 2020 12:01 > To: devel@edk2.groups.io > Cc: Pierre Gondois ; bob.c.feng@intel.com;=20 > liming.gao@intel.com; Sami Mujawar ; Pierre=20 > Gondois ; nd > Subject: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise makefile=20 > generation >=20 > From: Pierre Gondois >=20 > The GenMake.py script tests the platform environment to determine the=20 > type of makefile that needs to be generated. If a Windows build host is = detected, the makefile generated is of Nmake type. Otherwise a GNUmake type= is generated. >=20 > Furthermore, the ___MAKE_PATH > option in tools_def.template defines the make tool to use. > E.g.: for VS2017 this is configured to use Nmake, cf. > *_VS2017_*_MAKE_PATH =3D DEF(VS2017_BIN_HOST)\nmake.exe while for GCC5 i= t is setup to use GNU make. > *_GCC5_*_MAKE_PATH =3D DEF(GCC_HOST_PREFIX)make >=20 > This prevents using the GCC compiler toolchain on a Windows build host. >=20 > To address this issue this patch introduces 2 factors to determine the g= enerated makefile output. > 1. Platform -> to determine shell commands used > in makefile. > 2. MakeTool -> to determine the type of makefile > that needs to be generated. >=20 > Signed-off-by: Pierre Gondois > Signed-off-by: Sami Mujawar > --- >=20 > The changes can be seen at=20 > https://github.com/PierreARM/edk2/tree/720_BaseTools_Rationalise_makef > ile_generation_v2 >=20 > Notes: > v2: > - Rebase on latest master [Pierre] >=20 > BaseTools/Source/Python/AutoGen/GenMake.py | 122 ++++++++++----= ------ > BaseTools/Source/Python/AutoGen/IncludesAutoGen.py | 34 +++--- > BaseTools/Source/Python/build/build.py | 7 +- > 3 files changed, 88 insertions(+), 75 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py=20 > b/BaseTools/Source/Python/AutoGen/GenMake.py > index=20 > ba199c1aa73dc46856b41c13e07e3d9770081acd..f49c765c791d57c06fcccf7059b3 > 7a018dc68ae6 100755 > --- a/BaseTools/Source/Python/AutoGen/GenMake.py > +++ b/BaseTools/Source/Python/AutoGen/GenMake.py > @@ -2,6 +2,7 @@ > # Create makefile for MS nmake and GNU make # # Copyright (c) 2007=20 > - 2020, Intel Corporation. All rights reserved.
> +# Copyright (c) 2020, ARM Limited. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent # >=20 > @@ -52,13 +53,6 @@ gIncludeMacroConversion =3D { > "EFI_PPI_DEPENDENCY" : gPpiDefinition, > } >=20 > -## default makefile type > -gMakeType =3D "" > -if sys.platform =3D=3D "win32": > - gMakeType =3D "nmake" > -else: > - gMakeType =3D "gmake" > - >=20 > ## BuildFile class > # > @@ -77,6 +71,13 @@ class BuildFile(object): > "gmake" : "GNUmakefile" > } >=20 > + # Get Makefile name. > + def getMakefileName(self): > + if not self._FileType: > + return _DEFAULT_FILE_NAME_ > + else: > + return self._FILE_NAME_[self._FileType] > + > ## Fixed header string for makefile > _MAKEFILE_HEADER =3D '''# > # DO NOT EDIT > @@ -106,7 +107,7 @@ class BuildFile(object): > # $(RD) remove dir command > # > _SHELL_CMD_ =3D { > - "nmake" : { > + "win32" : { > "CP" : "copy /y", > "MV" : "move /y", > "RM" : "del /f /q", > @@ -114,7 +115,7 @@ class BuildFile(object): > "RD" : "rmdir /s /q", > }, >=20 > - "gmake" : { > + "posix" : { > "CP" : "cp -f", > "MV" : "mv -f", > "RM" : "rm -f", > @@ -125,35 +126,35 @@ class BuildFile(object): >=20 > ## directory separator > _SEP_ =3D { > - "nmake" : "\\", > - "gmake" : "/" > + "win32" : "\\", > + "posix" : "/" > } >=20 > ## directory creation template > _MD_TEMPLATE_ =3D { > - "nmake" : 'if not exist %(dir)s $(MD) %(dir)s', > - "gmake" : "$(MD) %(dir)s" > + "win32" : 'if not exist %(dir)s $(MD) %(dir)s', > + "posix" : "$(MD) %(dir)s" > } >=20 > ## directory removal template > _RD_TEMPLATE_ =3D { > - "nmake" : 'if exist %(dir)s $(RD) %(dir)s', > - "gmake" : "$(RD) %(dir)s" > + "win32" : 'if exist %(dir)s $(RD) %(dir)s', > + "posix" : "$(RD) %(dir)s" > } > ## cp if exist > _CP_TEMPLATE_ =3D { > - "nmake" : 'if exist %(Src)s $(CP) %(Src)s %(Dst)s', > - "gmake" : "test -f %(Src)s && $(CP) %(Src)s %(Dst)s" > + "win32" : 'if exist %(Src)s $(CP) %(Src)s %(Dst)s', > + "posix" : "test -f %(Src)s && $(CP) %(Src)s %(Dst)s" > } >=20 > _CD_TEMPLATE_ =3D { > - "nmake" : 'if exist %(dir)s cd %(dir)s', > - "gmake" : "test -e %(dir)s && cd %(dir)s" > + "win32" : 'if exist %(dir)s cd %(dir)s', > + "posix" : "test -e %(dir)s && cd %(dir)s" > } >=20 > _MAKE_TEMPLATE_ =3D { > - "nmake" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(fil= e)s', > - "gmake" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(f= ile)s' > + "win32" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(fil= e)s', > + "posix" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(f= ile)s' > } >=20 > _INCLUDE_CMD_ =3D { > @@ -169,22 +170,30 @@ class BuildFile(object): > # > def __init__(self, AutoGenObject): > self._AutoGenObject =3D AutoGenObject > - self._FileType =3D gMakeType >=20 > - ## Create build file > + MakePath =3D AutoGenObject.BuildOption.get('MAKE', {}).get('PAT= H') > + if not MakePath: > + self._FileType =3D "" > + elif "nmake" in MakePath: > + self._FileType =3D "nmake" > + else: > + self._FileType =3D "gmake" > + > + if sys.platform =3D=3D "win32": > + self._Platform =3D "win32" > + else: > + self._Platform =3D "posix" > + > + ## Create build file. > # > - # @param FileType Type of build file. Only nmake and gmake ar= e supported now. > + # Only nmake and gmake are supported. > # > - # @retval TRUE The build file is created or re-created suc= cessfully > - # @retval FALSE The build file exists and is the same as th= e one to be generated > + # @retval TRUE The build file is created or re-created succ= essfully > + # @retval FALSE The build file exists and is the same as the= one to be generated > # > - def Generate(self, FileType=3DgMakeType): > - if FileType not in self._FILE_NAME_: > - EdkLogger.error("build", PARAMETER_INVALID, "Invalid build = type [%s]" % FileType, > - ExtraData=3D"[%s]" % str(self._AutoGenObjec= t)) > - self._FileType =3D FileType > + def Generate(self): > FileContent =3D self._TEMPLATE_.Replace(self._TemplateDict) > - FileName =3D self._FILE_NAME_[FileType] > + FileName =3D self.getMakefileName() > if not os.path.exists(os.path.join(self._AutoGenObject.MakeFile= Dir, "deps.txt")): > with open(os.path.join(self._AutoGenObject.MakeFileDir, "de= ps.txt"),"w+") as fd: > fd.write("") > @@ -203,7 +212,7 @@ class BuildFile(object): > # @retval list The directory creation command list > # > def GetCreateDirectoryCommand(self, DirList): > - return [self._MD_TEMPLATE_[self._FileType] % {'dir':Dir} for Di= r in DirList] > + return [self._MD_TEMPLATE_[self._Platform] % {'dir':Dir} for=20 > + Dir in DirList] >=20 > ## Return a list of directory removal command string > # > @@ -212,7 +221,7 @@ class BuildFile(object): > # @retval list The directory removal command list > # > def GetRemoveDirectoryCommand(self, DirList): > - return [self._RD_TEMPLATE_[self._FileType] % {'dir':Dir} for Di= r in DirList] > + return [self._RD_TEMPLATE_[self._Platform] % {'dir':Dir} for=20 > + Dir in DirList] >=20 > def PlaceMacro(self, Path, MacroDefinitions=3DNone): > if Path.startswith("$("): > @@ -462,11 +471,8 @@ cleanlib: > # Compose a dict object containing information used to do replaceme= nt in template > @property > def _TemplateDict(self): > - if self._FileType not in self._SEP_: > - EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefi= le type [%s]" % self._FileType, > - ExtraData=3D"[%s]" % str(self._AutoGenObjec= t)) > MyAgo =3D self._AutoGenObject > - Separator =3D self._SEP_[self._FileType] > + Separator =3D self._SEP_[self._Platform] >=20 > # break build if no source files and binary files are found > if len(MyAgo.SourceFileList) =3D=3D 0 and len(MyAgo.BinaryFileL= ist) =3D=3D 0: > @@ -628,10 +634,10 @@ cleanlib: >=20 > BcTargetList =3D [] >=20 > - MakefileName =3D self._FILE_NAME_[self._FileType] > + MakefileName =3D self.getMakefileName() > LibraryMakeCommandList =3D [] > for D in self.LibraryBuildDirectoryList: > - Command =3D self._MAKE_TEMPLATE_[self._FileType] % {"file":= os.path.join(D, MakefileName)} > + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 > + {"file":os.path.join(D, MakefileName)} > LibraryMakeCommandList.append(Command) >=20 > package_rel_dir =3D MyAgo.SourceDir @@ -683,8 +689,8 @@ cleanli= b: > "separator" : Separator, > "module_tool_definitions" : ToolsDef, >=20 > - "shell_command_code" : list(self._SHELL_CMD_[self._F= ileType].keys()), > - "shell_command" : list(self._SHELL_CMD_[self._F= ileType].values()), > + "shell_command_code" : list(self._SHELL_CMD_[self._P= latform].keys()), > + "shell_command" : list(self._SHELL_CMD_[self._P= latform].values()), >=20 > "module_entry_point" : ModuleEntryPoint, > "image_entry_point" : ImageEntryPoint, > @@ -721,7 +727,7 @@ cleanlib: > self.ResultFileList.append(Dst) > if '%s :' %(Dst) not in self.BuildTargetList: > self.BuildTargetList.append("%s :" %(Dst)) > - self.BuildTargetList.append('\t' + self._CP_TEM= PLATE_[self._FileType] %{'Src': Src, 'Dst': Dst}) > + self.BuildTargetList.append('\t' +=20 > + self._CP_TEMPLATE_[self._Platform] %{'Src': Src, 'Dst': Dst}) >=20 > FfsCmdList =3D Cmd[0] > for index, Str in enumerate(FfsCmdList): > @@ -1222,7 +1228,7 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\ > # Compose a dict object containing information used to do replaceme= nt in template > @property > def _TemplateDict(self): > - Separator =3D self._SEP_[self._FileType] > + Separator =3D self._SEP_[self._Platform] > MyAgo =3D self._AutoGenObject > if self._FileType not in MyAgo.CustomMakefile: > EdkLogger.error('build', OPTION_NOT_SUPPORTED, "No custom= =20 > makefile for %s" % self._FileType, @@ -1252,7 +1258,7 @@ ${BEGIN}\t-@${c= reate_directory_command}\n${END}\ > ToolsDef.append("%s_%s =3D %s" % (Tool, Attr, MyAgo= .BuildOption[Tool][Attr])) > ToolsDef.append("") >=20 > - MakefileName =3D self._FILE_NAME_[self._FileType] > + MakefileName =3D self.getMakefileName() > MakefileTemplateDict =3D { > "makefile_header" : self._FILE_HEADER_[self._File= Type], > "makefile_path" : os.path.join("$(MODULE_BUILD_= DIR)", MakefileName), > @@ -1285,8 +1291,8 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\ > "separator" : Separator, > "module_tool_definitions" : ToolsDef, >=20 > - "shell_command_code" : list(self._SHELL_CMD_[self._F= ileType].keys()), > - "shell_command" : list(self._SHELL_CMD_[self._F= ileType].values()), > + "shell_command_code" : list(self._SHELL_CMD_[self._P= latform].keys()), > + "shell_command" : list(self._SHELL_CMD_[self._P= latform].values()), >=20 > "create_directory_command" : self.GetCreateDirectoryComman= d(self.IntermediateDirectoryList), > "custom_makefile_content" : CustomMakefile > @@ -1413,7 +1419,7 @@ cleanlib: > # Compose a dict object containing information used to do replaceme= nt in template > @property > def _TemplateDict(self): > - Separator =3D self._SEP_[self._FileType] > + Separator =3D self._SEP_[self._Platform] >=20 > MyAgo =3D self._AutoGenObject > if "MAKE" not in MyAgo.ToolDefinition or "PATH" not in MyAgo.To= olDefinition["MAKE"]: > @@ -1424,13 +1430,13 @@ cleanlib: > self.ModuleBuildDirectoryList =3D self.GetModuleBuildDirectoryL= ist() > self.LibraryBuildDirectoryList =3D=20 > self.GetLibraryBuildDirectoryList() >=20 > - MakefileName =3D self._FILE_NAME_[self._FileType] > + MakefileName =3D self.getMakefileName() > LibraryMakefileList =3D [] > LibraryMakeCommandList =3D [] > for D in self.LibraryBuildDirectoryList: > D =3D self.PlaceMacro(D, {"BUILD_DIR":MyAgo.BuildDir}) > Makefile =3D os.path.join(D, MakefileName) > - Command =3D self._MAKE_TEMPLATE_[self._FileType] % {"file":= Makefile} > + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 > + {"file":Makefile} > LibraryMakefileList.append(Makefile) > LibraryMakeCommandList.append(Command) > self.LibraryMakeCommandList =3D LibraryMakeCommandList @@ -1440= ,7 +1446,7 @@ cleanlib: > for D in self.ModuleBuildDirectoryList: > D =3D self.PlaceMacro(D, {"BUILD_DIR":MyAgo.BuildDir}) > Makefile =3D os.path.join(D, MakefileName) > - Command =3D self._MAKE_TEMPLATE_[self._FileType] % {"file":= Makefile} > + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 > + {"file":Makefile} > ModuleMakefileList.append(Makefile) > ModuleMakeCommandList.append(Command) >=20 > @@ -1460,8 +1466,8 @@ cleanlib: >=20 > "toolchain_tag" : MyAgo.ToolChain, > "build_target" : MyAgo.BuildTarget, > - "shell_command_code" : list(self._SHELL_CMD_[self._F= ileType].keys()), > - "shell_command" : list(self._SHELL_CMD_[self._F= ileType].values()), > + "shell_command_code" : list(self._SHELL_CMD_[self._P= latform].keys()), > + "shell_command" : list(self._SHELL_CMD_[self._P= latform].values()), > "build_architecture_list" : MyAgo.Arch, > "architecture" : MyAgo.Arch, > "separator" : Separator, > @@ -1519,7 +1525,7 @@ class TopLevelMakefile(BuildFile): > # Compose a dict object containing information used to do replaceme= nt in template > @property > def _TemplateDict(self): > - Separator =3D self._SEP_[self._FileType] > + Separator =3D self._SEP_[self._Platform] >=20 > # any platform autogen object is ok because we just need common= information > MyAgo =3D self._AutoGenObject > @@ -1575,10 +1581,10 @@ class TopLevelMakefile(BuildFile): > else: > ExtraOption +=3D " --pcd " + pcdname + '=3D' + pcd[3] >=20 > - MakefileName =3D self._FILE_NAME_[self._FileType] > + MakefileName =3D self.getMakefileName() > SubBuildCommandList =3D [] > for A in MyAgo.ArchList: > - Command =3D self._MAKE_TEMPLATE_[self._FileType] % {"file":= os.path.join("$(BUILD_DIR)", A, MakefileName)} > + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 > + {"file":os.path.join("$(BUILD_DIR)", A, MakefileName)} > SubBuildCommandList.append(Command) >=20 > MakefileTemplateDict =3D { > @@ -1593,8 +1599,8 @@ class TopLevelMakefile(BuildFile): >=20 > "toolchain_tag" : MyAgo.ToolChain, > "build_target" : MyAgo.BuildTarget, > - "shell_command_code" : list(self._SHELL_CMD_[self._F= ileType].keys()), > - "shell_command" : list(self._SHELL_CMD_[self._F= ileType].values()), > + "shell_command_code" : list(self._SHELL_CMD_[self._P= latform].keys()), > + "shell_command" : list(self._SHELL_CMD_[self._P= latform].values()), > 'arch' : list(MyAgo.ArchList), > "build_architecture_list" : ','.join(MyAgo.ArchList), > "separator" : Separator, > diff --git a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py=20 > b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py > index=20 > 1ca1798907ef9b46a17d8938bb2f673d5ade662f..ca9e02d19b4afad82241abb8e158 > 45731cabd22f 100644 > --- a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py > +++ b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py > @@ -2,6 +2,7 @@ > # Build cache intermediate result and state # # Copyright (c) 2019=20 > - 2020, Intel Corporation. All rights reserved.
> +# Copyright (c) 2020, ARM Limited. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent # from=20 > Common.caching import cached_property @@ -12,20 +13,6 @@ from=20 > Common.Misc import SaveFileOnChange, PathClass from Common.Misc import = TemplateString import sys gIsFileMap =3D {} -if sys.platform =3D=3D "win3= 2": > - _INCLUDE_DEPS_TEMPLATE =3D TemplateString(''' > -${BEGIN} > -!IF EXIST(${deps_file}) > -!INCLUDE ${deps_file} > -!ENDIF > -${END} > - ''') > -else: > - _INCLUDE_DEPS_TEMPLATE =3D TemplateString(''' > -${BEGIN} > --include ${deps_file} > -${END} > - ''') >=20 > DEP_FILE_TAIL =3D "# Updated \n" >=20 > @@ -59,6 +46,25 @@ class IncludesAutoGen(): >=20 > def CreateDepsInclude(self): > deps_file =3D {'deps_file':self.deps_files} > + > + MakePath =3D self.module_autogen.BuildOption.get('MAKE', {}).ge= t('PATH') > + if not MakePath: > + EdkLogger.error("build", PARAMETER_MISSING, Message=3D"No M= ake path available.") > + elif "nmake" in MakePath: > + _INCLUDE_DEPS_TEMPLATE =3D TemplateString(''' > + ${BEGIN} > + !IF EXIST(${deps_file}) > + !INCLUDE ${deps_file} > + !ENDIF > + ${END} > + ''') > + else: > + _INCLUDE_DEPS_TEMPLATE =3D TemplateString(''' > + ${BEGIN} > + -include ${deps_file} > + ${END} > + ''') > + > try: > deps_include_str =3D _INCLUDE_DEPS_TEMPLATE.Replace(deps_fi= le) > except Exception as e: > diff --git a/BaseTools/Source/Python/build/build.py=20 > b/BaseTools/Source/Python/build/build.py > index=20 > 1e47e382cba94dc6fba7d8ecad2bc924b02cea1d..8e6625ae42afe5ed5fddbdb72ef5 > e8ca044609b4 100755 > --- a/BaseTools/Source/Python/build/build.py > +++ b/BaseTools/Source/Python/build/build.py > @@ -4,6 +4,7 @@ > # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.
> # Copyright (c) 2007 - 2020, Intel Corporation. All rights=20 > reserved.
# Copyright (c) 2018, Hewlett Packard Enterprise=20 > Development, L.P.
> +# Copyright (c) 2020, ARM Limited. All rights reserved.
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -1251,7 +1252,7 @= @ class Build(): > (AutoGenObject.BuildTarget, AutoGenObje= ct.ToolChain, AutoGenObject.Arch), > ExtraData=3Dstr(AutoGenObject)) >=20 > - makefile =3D GenMake.BuildFile(AutoGenObject)._FILE_NAME_[GenMa= ke.gMakeType] > + makefile =3D GenMake.BuildFile(AutoGenObject).getMakefileName() >=20 > # run > if Target =3D=3D 'run': > @@ -2040,10 +2041,10 @@ class Build(): > ModuleBuildDirectoryList =3D=20 > data_pipe.Get("ModuleBuildDirectoryList") >=20 > for m_build_dir in LibraryBuildDirectoryList: > - if not os.path.exists(os.path.join(m_build_dir,GenMake.= BuildFile._FILE_NAME_[GenMake.gMakeType])): > + if not os.path.exists(os.path.join(m_build_dir,GenMake.= BuildFile.getMakefileName())): > return None > for m_build_dir in ModuleBuildDirectoryList: > - if not os.path.exists(os.path.join(m_build_dir,GenMake.= BuildFile._FILE_NAME_[GenMake.gMakeType])): > + if not os.path.exists(os.path.join(m_build_dir,GenMake.= BuildFile.getMakefileName())): > return None > Wa =3D WorkSpaceInfo( > workspacedir,active_p,target,toolchain,archlist > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20 >=20 >=20 >=20 >=20 >=20 >=20