From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.53]) by mx.groups.io with SMTP id smtpd.web09.5190.1580817788099515965 for ; Tue, 04 Feb 2020 04:03:09 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=io/KK4WW; spf=pass (domain: arm.com, ip: 40.107.7.53, 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=MEVsanop6dm2NKMeExbSuqf6ChPmTmnF3hfnq2mcD1E=; b=io/KK4WWwNC0gJy5SA9F5YTG5zfOqIIAPWXg5tefz4BdZ+mtFPSTSiTA6liHBxwzs7MlpjOwn0fZqkOel4SZOSgrixJBsa30QqLW7uB0xUdr6RLOyl2bDn7xw404Tr+dptKHNLhuIjBx2t/zqLOi2mao5wZbStJRkh2pHTwjsN4= Received: from HE1PR0802CA0013.eurprd08.prod.outlook.com (2603:10a6:3:bd::23) by AM5PR0801MB1633.eurprd08.prod.outlook.com (2603:10a6:203:3c::12) 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 12:03:05 +0000 Received: from VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::207) by HE1PR0802CA0013.outlook.office365.com (2603:10a6:3:bd::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.30 via Frontend Transport; Tue, 4 Feb 2020 12:03:05 +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 VE1EUR03FT055.mail.protection.outlook.com (10.152.19.158) 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 12:03:04 +0000 Received: ("Tessian outbound 62d9cfe08e54:v42"); Tue, 04 Feb 2020 12:03:04 +0000 X-CR-MTA-TID: 64aa7808 Received: from 7595e2a0fbd7.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FE707FBA-E393-464B-B3CC-6E5FA52B65DA.1; Tue, 04 Feb 2020 12:02:59 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7595e2a0fbd7.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 04 Feb 2020 12:02:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjkJRkFHolO/G/xJFi4U0+ZJKwq+nj2EqXOg+/2sc3wcdSuUUdkoqFIlVlK5ocs+uU5EZdB4QhEGLCTzUGOyk6TLLEVwiYEUuQlKlLpMoQMdmCIn++kRkx/3vaYLj/omvyL6n1KRv0eLTzBJ2IfHtO6VuyjJGMAn7sxLJDxm/pCnYFi0wwz89wX5as87t7P2JrM6YuNJ4AXW1ucAD6wUHUMa2r+LjzR33cqiVfrsUOcWSzax84PkPUX7veK8HgijWRNcGdjUKq1u2QOJ9HVElYgWkGGjUsmhao3ykmA2S+XDHEhIbRf10JgBwbF6lIsISejFiRAhqjXOSKvkc4BhSg== 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=MEVsanop6dm2NKMeExbSuqf6ChPmTmnF3hfnq2mcD1E=; b=EldFQasJTpaM6a+iQFNqX8ATllQ/yRpuCKWcYOCteD0YkPOMPqXC4YW/2DrQtonuT7DyuwdHo4Xl2EUcssmCl0Y2JcsyrB+hem4l0Pv40e1RJd2/pKBO7PhtBqfa7edrw3bAy6PEbD3ViUgPTgFaWKmmJ0jLeinFCc4p7wCNP2XpPZeKHsvzeY6lSfbnX+KJpAXbhnoUPfTdyDtThrmRkxNdLgtedt5Dp27XKhv3rLlP/FU9iimB9MuN1sevQa9387Ygg6nEvNB0vc3HB7Db+tO/QcQfEq3Q6VDiycgxpGEpy+p6Xx/vFrcD8Boo9e+BjxkgIEYgrLwIdMvnfrPO9w== 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=MEVsanop6dm2NKMeExbSuqf6ChPmTmnF3hfnq2mcD1E=; b=io/KK4WWwNC0gJy5SA9F5YTG5zfOqIIAPWXg5tefz4BdZ+mtFPSTSiTA6liHBxwzs7MlpjOwn0fZqkOel4SZOSgrixJBsa30QqLW7uB0xUdr6RLOyl2bDn7xw404Tr+dptKHNLhuIjBx2t/zqLOi2mao5wZbStJRkh2pHTwjsN4= Received: from DB7PR08MB3113.eurprd08.prod.outlook.com (52.134.111.149) by DB7PR08MB3084.eurprd08.prod.outlook.com (52.135.128.159) 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 12:02:56 +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 12:02:56 +0000 From: "PierreGondois" To: "devel@edk2.groups.io" , Pierre Gondois CC: "bob.c.feng@intel.com" , "liming.gao@intel.com" , 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+qo5O8MNF6gK7xJw Date: Tue, 4 Feb 2020 12:02:55 +0000 Message-ID: References: <15F0315032D95F8E.2867@groups.io> In-Reply-To: <15F0315032D95F8E.2867@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: bb23bd23-551c-4721-86e1-e2f94f4667e5.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: 61d2a573-8af8-4ff8-575e-08d7a96a30f6 X-MS-TrafficTypeDiagnostic: DB7PR08MB3084:|DB7PR08MB3084:|AM5PR0801MB1633: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:1303;OLM:1303; x-forefront-prvs: 03030B9493 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(346002)(136003)(366004)(376002)(396003)(199004)(189003)(33656002)(7696005)(64756008)(5660300002)(71200400001)(2906002)(66946007)(66446008)(110136005)(54906003)(76116006)(66556008)(66476007)(4326008)(30864003)(478600001)(52536014)(316002)(6506007)(186003)(53546011)(81166006)(81156014)(8676002)(26005)(966005)(9686003)(86362001)(55016002)(8936002)(579004)(460985005);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR08MB3084;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: +ORE6t0hGLE96Vs7XO1+vZENBSgZKoUnkr/n2hYl6tUUulQmM0FcZyXvm4HBRt3rXeia3SbNzBFAprAwNYFESfOYsfxwy+JXq7nOnMrhblyXLaosxM8HvFYYELRLiVqLs/IWUvOMLegFqhe3bl+O9urHvdatMf0pZ22gFMwmuZr3x9jf0dan0phNxebnQGj8i7D1756WzfhWd7hmA0JqTgPubtLvoMxNv6HaXpKrcNv08tXBLtdvjL3xP/Mt1siku6lymgiPAZAsLmiNYzLDMhp8gOMQqzMwF1RMuWeJuxn5Dr6zaAd7bsQH6qFd9bwPX6ByRPmukc9WJWwOWwy3KL/6hF8vdKdaLAd1FOPbtoCYSgVWhy1d+4lydXfDTRGFsBynElGX2HKqvExD3pAsxOatPannSFnL1YwDlXQhvqbZB5Y1ezwomNwABc444aCqC2tidFdEJi9cHhSa58jAiLsvXMJTOyd8h6yzs6oMGfTaIveb5HkjaXKW/9gylAoL0gHP84BZJbbMn7G6K/1RpK68oo/N2AFcVl+UmyrWpT3Q+fVTht/JAX8F0+kmIRsO x-ms-exchange-antispam-messagedata: cxpxfDsAmyf6a5kIy7b8l0usCproYme/vnoFs8Zh6yWohLZu68q83UX/mpIfqWlFInbNSfI+nQrsvnvy23JO0889a9jaKmv3Ew7SN427fm+lme0QyWsZg55oRIMIOFMSXALLoFDX5QzKPrh3LPEuDQ== MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3084 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: VE1EUR03FT055.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)(39860400002)(376002)(346002)(396003)(136003)(199004)(189003)(6506007)(53546011)(2906002)(186003)(26005)(316002)(52536014)(7696005)(81166006)(8936002)(81156014)(8676002)(70586007)(33656002)(70206006)(356004)(478600001)(9686003)(86362001)(55016002)(336012)(966005)(30864003)(5660300002)(54906003)(110136005)(26826003)(4326008)(36906005)(460985005);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0801MB1633;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:Pass;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;A:1;MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 98f30ad8-b55f-4881-f35e-08d7a96a2bbc X-Forefront-PRVS: 03030B9493 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bSNY0KMK8zs9iqH4DI8N4QKPjEC9G5w1mt2be2iA9bvZmv5er86ko1MJPSzXr9RmBX27zrFc7nEO2lTd5K4EUATmaMg6BMuWSHe/OCiraewgolTRAyr39aI9GIBxRk9FwGplBKZ786J3NRMzu0qwFiBC17zbF6CA1qvF8SVCfrmLE9UA/goKwL99aYK3jn0G4Iqmnr+0TE1Wp915iUMGlhAMylQoA/27KtDBzDqk/lnMoO0MyzG+pDGbFnVCJwQPgkwtgsNdwGIGQIcrwdQvug1DWvesejYKIftmLQ1Txm5ZBOpfbSnkPSzy6Oy1ysMGnynVYHIEi/WGT65Z9wtuAs0eI7KJZe+ttNyvbqxmJgpUZjugUBsOv6MWb2xOL7/PyiW5ZEh28QRze+fgsLT5KQbtH8AzYkQYOERQl0dNdbMgCQLPcDiWtmIaUTU9rKQP/5757NqVLNT11e9xkXT/LSjz4rLvircTQKzh227gFKwxVS0IqHYJCKYAK/QvZ5hDl8IEJ4XCHzevyDkOfNBAT13Omsn7TOVA+Ic7h/qBmRimHPtKreaYf85rxOty65UA X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2020 12:03:04.7711 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 61d2a573-8af8-4ff8-575e-08d7a96a30f6 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: AM5PR0801MB1633 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello Liming and Bob, To answer Liming's questions, I am building the DynamicTablesPkg with 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 configuratio= n, the *_*_*_MAKE_FLAG(S) variable is set to "/nologo". As this is a nmake = specific flag, it has to be removed when using GNUmake. Some warning flags = also need to be slightly modified when building with VS2017. To modify the type of make tool to use (GNUmake or nmake), I modify the fo= llowing variable in Conf/tools_def.txt: *_[GCC5|VS2017]_*_MAKE_PATH =3D [nmake|GNUmake] I am building the ShellPkg with the patch and a small modification on how = nasm files are added for IA32 and X64 for the following configurations: Windows - VS2017 - GNUmake Windows - VS2017 - nmake Linux - GCC - GNUmake Unfortunately, the gcc compiler available on windows doesn't provide all t= he options of the one available on linux. For instances: * When building ShellPkg-DEBUG build-X64 -Windows-GCC-[nmake], the "-mcmo= del=3Dsmall" option provided is not supported. * When building ShellPkg-DEBUG build-IA32-Windows-GCC-[nmake], the "-m,el= f_i386" option provided is not supported. These issues are related to the compiler and not to the patch. The Windows-GCC-GNUmake configuration is very important for Arm. This conf= iguration was working fine until patch "0c3e8e9947a6c13b4327dd11b20acb95441= 701cf BaseTools: Enhance Basetool for incremental build" was merged in edk2= . Regards, Pierre -----Original Message----- From: devel@edk2.groups.io On Behalf Of PierreGondo= is via Groups.Io Sent: 04 February 2020 12:01 To: devel@edk2.groups.io Cc: Pierre Gondois ; bob.c.feng@intel.com; liming.= gao@intel.com; Sami Mujawar ; Pierre Gondois ; nd Subject: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise makefile gener= ation From: Pierre Gondois The GenMake.py script tests the platform environment to determine the type= of makefile that needs to be generated. If a Windows build host is detecte= d, the makefile generated is of Nmake type. Otherwise a GNUmake type is gen= erated. 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 it = is setup to use GNU make. *_GCC5_*_MAKE_PATH =3D DEF(GCC_HOST_PREFIX)make This prevents using the GCC compiler toolchain on a Windows build host. To address this issue this patch introduces 2 factors to determine the gen= erated makefile output. 1. Platform -> to determine shell commands used in makefile. 2. MakeTool -> to determine the type of makefile that needs to be generated. Signed-off-by: Pierre Gondois Signed-off-by: Sami Mujawar --- The changes can be seen at https://github.com/PierreARM/edk2/tree/720_Base= Tools_Rationalise_makefile_generation_v2 Notes: v2: - Rebase on latest master [Pierre] 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(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source= /Python/AutoGen/GenMake.py index ba199c1aa73dc46856b41c13e07e3d9770081acd..f49c765c791d57c06fcccf7059= b37a018dc68ae6 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= 20, 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 %(file)= s', - "gmake" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(fil= e)s' + "win32" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)= s', + "posix" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(fil= e)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('PATH'= ) + 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 are = supported now. + # Only nmake and gmake are supported. # - # @retval TRUE The build file is created or re-created succe= ssfully - # @retval FALSE The build file exists and is the same as the = one to be generated + # @retval TRUE The build file is created or re-created succes= sfully + # @retval FALSE The build file exists and is the same as the o= ne to be generated # - def Generate(self, FileType=3DgMakeType): - if FileType not in self._FILE_NAME_: - EdkLogger.error("build", PARAMETER_INVALID, "Invalid build ty= pe [%s]" % FileType, - ExtraData=3D"[%s]" % str(self._AutoGenObject)= ) - 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.MakeFileDi= r, "deps.txt")): with open(os.path.join(self._AutoGenObject.MakeFileDir, "deps= .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 Dir = 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 Dir = 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 replacement= in template @property def _TemplateDict(self): - if self._FileType not in self._SEP_: - EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefile= type [%s]" % self._FileType, - ExtraData=3D"[%s]" % str(self._AutoGenObject)= ) 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.BinaryFileLis= t) =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 @@ cleanlib: "separator" : Separator, "module_tool_definitions" : ToolsDef, =20 - "shell_command_code" : list(self._SHELL_CMD_[self._Fil= eType].keys()), - "shell_command" : list(self._SHELL_CMD_[self._Fil= eType].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Pla= tform].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Pla= tform].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_TEMPL= ATE_[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 replacement= 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 mak= efile for %s" % self._FileType, @@ -1252,7 +1258,7 @@ ${BEGIN}\t-@${create_= directory_command}\n${END}\ ToolsDef.append("%s_%s =3D %s" % (Tool, Attr, MyAgo.B= uildOption[Tool][Attr])) ToolsDef.append("") =20 - MakefileName =3D self._FILE_NAME_[self._FileType] + MakefileName =3D self.getMakefileName() MakefileTemplateDict =3D { "makefile_header" : self._FILE_HEADER_[self._FileTy= pe], "makefile_path" : os.path.join("$(MODULE_BUILD_DI= R)", 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._Fil= eType].keys()), - "shell_command" : list(self._SHELL_CMD_[self._Fil= eType].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Pla= tform].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Pla= tform].values()), =20 "create_directory_command" : self.GetCreateDirectoryCommand(= self.IntermediateDirectoryList), "custom_makefile_content" : CustomMakefile @@ -1413,7 +1419,7 @@ cleanlib: # Compose a dict object containing information used to do replacement= 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.Tool= Definition["MAKE"]: @@ -1424,13 +1430,13 @@ cleanlib: self.ModuleBuildDirectoryList =3D self.GetModuleBuildDirectoryLis= t() self.LibraryBuildDirectoryList =3D self.GetLibraryBuildDirectoryL= ist() =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":Ma= kefile} + 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":Ma= kefile} + 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._Fil= eType].keys()), - "shell_command" : list(self._SHELL_CMD_[self._Fil= eType].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Pla= tform].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Pla= tform].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 replacement= 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 i= nformation 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._Fil= eType].keys()), - "shell_command" : list(self._SHELL_CMD_[self._Fil= eType].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Pla= tform].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Pla= tform].values()), 'arch' : list(MyAgo.ArchList), "build_architecture_list" : ','.join(MyAgo.ArchList), "separator" : Separator, diff --git a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py b/BaseTool= s/Source/Python/AutoGen/IncludesAutoGen.py index 1ca1798907ef9b46a17d8938bb2f673d5ade662f..ca9e02d19b4afad82241abb8e1= 5845731cabd22f 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= 20, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # from Common.caching im= port cached_property @@ -12,20 +13,6 @@ from Common.Misc import SaveFileOnC= hange, PathClass from Common.Misc import TemplateString import sys gIsFi= leMap =3D {} -if sys.platform =3D=3D "win32": - _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', {}).get(= 'PATH') + if not MakePath: + EdkLogger.error("build", PARAMETER_MISSING, Message=3D"No Mak= e 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_file= ) except Exception as e: diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyt= hon/build/build.py index 1e47e382cba94dc6fba7d8ecad2bc924b02cea1d..8e6625ae42afe5ed5fddbdb72e= f5e8ca044609b4 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 reserved.
# = Copyright (c) 2018, Hewlett Packard Enterprise 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, AutoGenObject= .ToolChain, AutoGenObject.Arch), ExtraData=3Dstr(AutoGenObject)) =20 - makefile =3D GenMake.BuildFile(AutoGenObject)._FILE_NAME_[GenMake= .gMakeType] + makefile =3D GenMake.BuildFile(AutoGenObject).getMakefileName() =20 # run if Target =3D=3D 'run': @@ -2040,10 +2041,10 @@ class Build(): ModuleBuildDirectoryList =3D data_pipe.Get("ModuleBuildDirect= oryList") =20 for m_build_dir in LibraryBuildDirectoryList: - if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile._FILE_NAME_[GenMake.gMakeType])): + if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile.getMakefileName())): return None for m_build_dir in ModuleBuildDirectoryList: - if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile._FILE_NAME_[GenMake.gMakeType])): + if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile.getMakefileName())): return None Wa =3D WorkSpaceInfo( workspacedir,active_p,target,toolchain,archlist -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'