From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.47]) by mx.groups.io with SMTP id smtpd.web12.4134.1579714639291714829 for ; Wed, 22 Jan 2020 09:37:19 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=hJgBWg2u; spf=pass (domain: arm.com, ip: 40.107.8.47, 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=6LwJsJnNAkdAdaB9gSPK4jtuBzJ/jK+CGD+QMFO8xNo=; b=hJgBWg2uCsIbVNQak4R6+m1Cmx4dhptrDwkvxnkZN8bQUWetA2coFSKMvEyBVFzPQsZI32oiJEEQ4CNppaGzK8mTIlVlgl1PMtduzSjYoSxuANG6xhsSkCy3UXq/k02RaO7rSgKW6rRKqXJMmzN/bISUGw4fRTzMIj4VAFiFICo= Received: from VI1PR08CA0111.eurprd08.prod.outlook.com (2603:10a6:800:d4::13) by DB6PR08MB2631.eurprd08.prod.outlook.com (2603:10a6:6:23::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19; Wed, 22 Jan 2020 17:37:16 +0000 Received: from VE1EUR03FT015.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::209) by VI1PR08CA0111.outlook.office365.com (2603:10a6:800:d4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.19 via Frontend Transport; Wed, 22 Jan 2020 17:37:16 +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 VE1EUR03FT015.mail.protection.outlook.com (10.152.18.176) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.18 via Frontend Transport; Wed, 22 Jan 2020 17:37:16 +0000 Received: ("Tessian outbound ba41a0333779:v40"); Wed, 22 Jan 2020 17:37:15 +0000 X-CR-MTA-TID: 64aa7808 Received: from 56ecfbf27778.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9A15C081-8E42-4D21-BC95-E3602F80AED3.1; Wed, 22 Jan 2020 17:37:10 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 56ecfbf27778.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 22 Jan 2020 17:37:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rd/MgUqK0YhCuImRYBjiwHQR5GkVPTq93hNk887OaloZIYkizJ+vsGqpBzpM0WKRa7RbTW/CAPSWuOPRshuQTP9TaKJrrR/flFdDtDdtnWWwpSDr1ybPlLh3Pc1eGxCc+Yqzs3VHXwnOwHFbn1yRsTmcxm2xt1XeWjFtniLvKqsQK9KxQEDGPftrN7XDuE2cTA3LzpwYiAUsracz4To8C2Ue4RCNLiHTsMQ/pLPn7ORQteb14/e3EISOLN4CTgvMjiVdvqSyqvGffCEJgI7llo+Tw2SB0hQqt7zNEVMk53V0E4e/7tsL1rbCpdpnvKFm6TIqTDn96N0JOZyDDkuDiQ== 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=6LwJsJnNAkdAdaB9gSPK4jtuBzJ/jK+CGD+QMFO8xNo=; b=NqcEXWmPXCBTJ0/a8cLgGOZTlCLC7EQYLxbJ5qiNjLtSCsB3bw0szzkt+qYqlka+u33orXKU612uxkdTA/4pSH8WqsQMIqpukRsq/avOCMEAQRymLr5QfIIKjJI4y5eRvDmqU/D6yZ25e0WY3o/BGZHlZ5zHLV8FZZLi7VoAk4HTXu8AmbOSHX09d+tbJgu3tU0xCPXn24XJuoNRk0zw7i7MUhACEQcgTN/99o7cRYsl2RznoTsOSFaAZJEDyz/SU4stX6M4ej0ciRvySlkAfVm43fumMjg9nMECPx4sTr8o9tcruI+J8az+ZRQK/5hqx6M9JStDOzv9Unz1svEUMQ== 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=6LwJsJnNAkdAdaB9gSPK4jtuBzJ/jK+CGD+QMFO8xNo=; b=hJgBWg2uCsIbVNQak4R6+m1Cmx4dhptrDwkvxnkZN8bQUWetA2coFSKMvEyBVFzPQsZI32oiJEEQ4CNppaGzK8mTIlVlgl1PMtduzSjYoSxuANG6xhsSkCy3UXq/k02RaO7rSgKW6rRKqXJMmzN/bISUGw4fRTzMIj4VAFiFICo= Received: from DB7PR08MB3113.eurprd08.prod.outlook.com (52.134.111.149) by DB7PR08MB3097.eurprd08.prod.outlook.com (52.134.110.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19; Wed, 22 Jan 2020 17:37:09 +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.2644.027; Wed, 22 Jan 2020 17:37:09 +0000 From: "PierreGondois" To: Pierre Gondois , "devel@edk2.groups.io" CC: "bob.c.feng@intel.com" , "liming.gao@intel.com" , Sami Mujawar , nd Subject: Re: [PATCH v1 1/1] BaseTools: Rationalise makefile generation Thread-Topic: [PATCH v1 1/1] BaseTools: Rationalise makefile generation Thread-Index: AQHVyh+N3Fc8M9EleUm0MbJSMQRfJ6f3AGhg Date: Wed, 22 Jan 2020 17:37:09 +0000 Message-ID: References: <20200113144045.2120-1-pierre.gondois@arm.com> In-Reply-To: <20200113144045.2120-1-pierre.gondois@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: eb781a41-5e21-4d98-be1c-5447141dac25.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: cc4642d8-b16b-4fa4-0818-08d79f61b921 X-MS-TrafficTypeDiagnostic: DB7PR08MB3097:|DB7PR08MB3097:|DB6PR08MB2631: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: True x-ms-oob-tlc-oobclassifiers: OLM:1122;OLM:1122; x-forefront-prvs: 029097202E X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(346002)(376002)(39860400002)(396003)(366004)(136003)(199004)(189003)(53546011)(66476007)(966005)(9686003)(66556008)(64756008)(76116006)(66946007)(6506007)(66446008)(55016002)(33656002)(110136005)(7696005)(26005)(316002)(186003)(71200400001)(54906003)(81166006)(81156014)(8936002)(2906002)(8676002)(52536014)(478600001)(86362001)(4326008)(30864003)(5660300002)(579004)(460985005);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR08MB3097;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: a60tpXYbZQo0sOIiy654QIud3EQq6ib2xwnlOFMmEtWQiBgp17kOHIYlmRAoImE3b6S0mKPiH6KEzCI3ASR3KUmo49R1WCkOl0K+ZiwE3hZR81ushJAjhdZw56rblb6q2jlS9YOfJNyyJSoxO9f2NUSYQ2wqqhwnqG4PwAdzzeAyLybZ2Nxmjxdog3LdvZ7YBrZ6Rtl7ttVamrHxuLCLRftmqbWtvCp57v0DJyj8AqI9W/6xgD9aLh2eVeLwagdTMiabLA8q/xdaAn81h4hFQqxrZdXIpCgQh610pm2NIOqWxJhqhPe9cNCjvyZd7mp6G89aFs/g6MXHoMz7CvvaN0a0eL1FHsfip134xZ0ioqcal4W4uPlvrlQpHu64++PUkPNkWVs+5GYsSEtHRXKiJIFpFmzdarBbh5c3IZDJf2+dgSlPeKPMT24u/htiuT+KUvviVd3jWzlZg2967FRLnikIHx8JSwixrQviETGzjU9a+FkoR/gg//hzELCmd73CjzfGP4nRjW2JTjDGN/USSpmQ+1VcQQPAZrK6SvI6KNg= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3097 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: VE1EUR03FT015.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)(346002)(396003)(376002)(136003)(189003)(199004)(8936002)(8676002)(81166006)(81156014)(478600001)(356004)(26826003)(54906003)(110136005)(30864003)(70586007)(4326008)(33656002)(86362001)(70206006)(336012)(26005)(186003)(7696005)(53546011)(6506007)(9686003)(55016002)(2906002)(966005)(52536014)(5660300002)(36906005)(316002)(460985005);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR08MB2631;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: 6a5bce8e-a17e-495d-1eaf-08d79f61b54f X-Forefront-PRVS: 029097202E X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e0dksyKVbXXNs0EJp1T3UYFx3pQooh7hp7+P8TNatpq3y/giN9RrzXtJPD/Y+lLfl2G0s2l6WhvSLqKA/JrpSL0eocU+eoIdLL6yiX6IPmSjVsdlRS4UkIui/LypWIBKNXle01/XJ5xr1shxAgIVz8dmmxPUyOwcgUA8XkvUHkOMJY93AR/JkbuEY2T/z9ZALfVZUfVW6tEvN/bYAqjVtMDv25HHoODk9STOBdc1ijNrRZ9jSS7vhRFj144SJ4DiApKBE2ULrKTCkNNn+AUb8nxdcyLwoF3MJtq1KTPooJ7F79lDHXczH95sfKk+Fk4LyTFbyHdu9N6TDm0E2MiwP17i5J/FaWz/AjwIdV97OR0dOMYOntArYu1dENVMyBMnfx7zbkIKKrIIN6DcXv4VmK3sN9NlvL4cXuOGk9eokxqCCbAEvDU7y3VzJWK6cmpkzbvgkL4jO34mG+Vg/7Ss0n2fOOlD3dqHIbhR5TSTfEqmLE7RQHxc9hZzWt9flsJXjQZqeD6QgTjo9C0J7ElyUst3ZsaZ/9peyJXEQlIbQyg= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2020 17:37:16.1361 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc4642d8-b16b-4fa4-0818-08d79f61b921 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: DB6PR08MB2631 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello Bob and Liming, Just to let you know, I created a Bugzilla here on the same topic: https://= bugzilla.tianocore.org/show_bug.cgi?id=3D2481=20 Regards, Pierre -----Original Message----- From: PierreGondois =20 Sent: 13 January 2020 14:41 To: devel@edk2.groups.io Cc: Pierre Gondois ; bob.c.feng@intel.com; liming.g= ao@intel.com; Sami Mujawar ; pierre.gondois@arm.comnd= @arm.com Subject: [PATCH v1 1/1] BaseTools: Rationalise makefile generation 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 detected= , the makefile generated is of Nmake type. Otherwise a GNUmake type is gene= rated. 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 i= s 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 gene= rated 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_BaseT= ools_Rationalise_makefile_generation_v1 Notes: v1: - Rationalise makefile generation [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 fe94f9a4c232bb599a59563444c3985700c78ec6..640b562257f74a45b38b8c857da= e4750f7c286e0 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 - 201= 8, 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 %(file= )s' + "win32" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)s= ', + "posix" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(file= )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 s= upported now. + # Only nmake and gmake are supported. # - # @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 + # @retval TRUE The build file is created or re-created success= fully + # @retval FALSE The build file exists and is the same as the on= e to be generated # - def Generate(self, FileType=3DgMakeType): - if FileType not in self._FILE_NAME_: - EdkLogger.error("build", PARAMETER_INVALID, "Invalid build typ= e [%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.MakeFileDir= , "deps.txt")): with open(os.path.join(self._AutoGenObject.MakeFileDir, "deps.= txt"),"w+") as fd: fd.write("") @@ -200,7 +209,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 i= n DirList] + return [self._MD_TEMPLATE_[self._Platform] % {'dir':Dir} for=20 + Dir in DirList] =20 ## Return a list of directory removal command string # @@ -209,7 +218,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 i= n DirList] + return [self._RD_TEMPLATE_[self._Platform] % {'dir':Dir} for=20 + Dir in DirList] =20 def PlaceMacro(self, Path, MacroDefinitions=3DNone): if Path.startswith("$("): @@ -459,11 +468,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.BinaryFileList= ) =3D=3D 0: @@ -625,10 +631,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 @@ -680,8 +686,8 @@ cleanlib: "separator" : Separator, "module_tool_definitions" : ToolsDef, =20 - "shell_command_code" : list(self._SHELL_CMD_[self._File= Type].keys()), - "shell_command" : list(self._SHELL_CMD_[self._File= Type].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Plat= form].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Plat= form].values()), =20 "module_entry_point" : ModuleEntryPoint, "image_entry_point" : ImageEntryPoint, @@ -716,7 +722,7 @@ cleanlib: self.ResultFileList.append(Dst) if '%s :' %(Dst) not in self.BuildTargetList: self.BuildTargetList.append("%s :" %(Dst)) - self.BuildTargetList.append('\t' + self._CP_TEMPLA= TE_[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): @@ -1217,7 +1223,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 make= file for %s" % self._FileType, @@ -1247,7 +1253,7 @@ ${BEGIN}\t-@${create_d= irectory_command}\n${END}\ ToolsDef.append("%s_%s =3D %s" % (Tool, Attr, MyAgo.Bu= ildOption[Tool][Attr])) ToolsDef.append("") =20 - MakefileName =3D self._FILE_NAME_[self._FileType] + MakefileName =3D self.getMakefileName() MakefileTemplateDict =3D { "makefile_header" : self._FILE_HEADER_[self._FileTyp= e], "makefile_path" : os.path.join("$(MODULE_BUILD_DIR= )", MakefileName), @@ -1280,8 +1286,8 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\ "separator" : Separator, "module_tool_definitions" : ToolsDef, =20 - "shell_command_code" : list(self._SHELL_CMD_[self._File= Type].keys()), - "shell_command" : list(self._SHELL_CMD_[self._File= Type].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Plat= form].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Plat= form].values()), =20 "create_directory_command" : self.GetCreateDirectoryCommand(s= elf.IntermediateDirectoryList), "custom_makefile_content" : CustomMakefile @@ -1408,7 +1414,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.ToolD= efinition["MAKE"]: @@ -1419,13 +1425,13 @@ cleanlib: self.ModuleBuildDirectoryList =3D self.GetModuleBuildDirectoryList= () self.LibraryBuildDirectoryList =3D self.GetLibraryBuildDirectoryLi= st() =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":Mak= efile} + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 + {"file":Makefile} LibraryMakefileList.append(Makefile) LibraryMakeCommandList.append(Command) self.LibraryMakeCommandList =3D LibraryMakeCommandList @@ -1435,7 = +1441,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":Mak= efile} + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 + {"file":Makefile} ModuleMakefileList.append(Makefile) ModuleMakeCommandList.append(Command) =20 @@ -1455,8 +1461,8 @@ cleanlib: =20 "toolchain_tag" : MyAgo.ToolChain, "build_target" : MyAgo.BuildTarget, - "shell_command_code" : list(self._SHELL_CMD_[self._File= Type].keys()), - "shell_command" : list(self._SHELL_CMD_[self._File= Type].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Plat= form].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Plat= form].values()), "build_architecture_list" : MyAgo.Arch, "architecture" : MyAgo.Arch, "separator" : Separator, @@ -1514,7 +1520,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 in= formation MyAgo =3D self._AutoGenObject @@ -1570,10 +1576,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 { @@ -1588,8 +1594,8 @@ class TopLevelMakefile(BuildFile): =20 "toolchain_tag" : MyAgo.ToolChain, "build_target" : MyAgo.BuildTarget, - "shell_command_code" : list(self._SHELL_CMD_[self._File= Type].keys()), - "shell_command" : list(self._SHELL_CMD_[self._File= Type].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Plat= form].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Plat= form].values()), 'arch' : list(MyAgo.ArchList), "build_architecture_list" : ','.join(MyAgo.ArchList), "separator" : Separator, diff --git a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py b/BaseTools= /Source/Python/AutoGen/IncludesAutoGen.py index bb6e883d84ca6decc97514f95a35bd6db8714eed..c41dc33c4bcf33d30cf8bfc8297= 18ed96923ff8f 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, Inte= l Corporation. All rights reserved.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # from Common.caching imp= ort cached_property @@ -12,20 +13,6 @@ from Common.Misc import SaveFileOnCh= ange, PathClass from Common.Misc import TemplateString import sys gIsFil= eMap =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 Make= 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/Pyth= on/build/build.py index 34acdccbdbd00a3d10f9c6c42004f59a96ff0063..a2a4337b7524163049c77f99874= ce1a7aa4c1644 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.
# C= opyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
# C= opyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -1250,7 +1251,7 @@ c= lass 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': @@ -2039,10 +2040,10 @@ class Build(): ModuleBuildDirectoryList =3D data_pipe.Get("ModuleBuildDirecto= ryList") =20 for m_build_dir in LibraryBuildDirectoryList: - if not os.path.exists(os.path.join(m_build_dir,GenMake.Bui= ldFile._FILE_NAME_[GenMake.gMakeType])): + if not os.path.exists(os.path.join(m_build_dir,GenMake.Bui= ldFile.getMakefileName())): return None for m_build_dir in ModuleBuildDirectoryList: - if not os.path.exists(os.path.join(m_build_dir,GenMake.Bui= ldFile._FILE_NAME_[GenMake.gMakeType])): + if not os.path.exists(os.path.join(m_build_dir,GenMake.Bui= ldFile.getMakefileName())): return None Wa =3D WorkSpaceInfo( workspacedir,active_p,target,toolchain,archlist -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'