[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/4] build: add make macro for making file from file.in


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Jürgen Groß <jgross@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 17 Nov 2025 12:30:10 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=s/+DRLArGLCZpYFA3M/ya4bWWpXk10BXJza2YB+BZDE=; b=dXxMPQTB/Hg5N5Ztc8o9EcJW7ey3aWvtfJrs+p4LaZpUG2x3+RJkzDQMJTnl7gsWNyzbX+OS+DILeeTaGgMxeUL6ciQZjHUn8D2Xz+aZDaYIjD+iRv//DhG8tatwT1fCrbvGpQo/1UEtGZzVEiFOBIwesz3IoXP4aEysrk/aULB4ZziUqG2jaj/9CV9kntSRKkAPRW2Kz6ZeM+v3Mb7mXzVz5APPMrmBCYrjOJ6QbLBS5LXvX4lUhaV2y4mzaedV2c5PPcnznU+w2ehlYBKFbWF/EdrjGVulrJ6FLQv8t4q4tdUP92apMDU+c8+BB0nfvW1XSQyYX79jweRt83T8+w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GOVrGQWgoW3ZMDzinC9g6+Kdp1Dxo6wK7+qIjWAYaFgv6l1W+oUB1pK4RyuMdDleQBZPYp5p01RyAudk12/JK//HUqW8zhozYQFpRttWrlUifixthXHS12dej6GQFt3Mo8Vl+GcenkBtszkI99p35f1iWfczwH/zbt4HQJ4OYR3UcFe2yOgiBIJd7kcpVA+53dPK20vHWSwWSCC3Vd2ZVIg3kNimj22mdkaeEBKsq9dxg+AyLc01ZVKK9FcO4hhD5IWqSWfDtu6bETyMtIPi5EkDhmFy38FJa5l7z34QVEsa1Hdol5e47cL/87aiaErOeL4RgvZ/AEgbctM+oASyDg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 17 Nov 2025 12:30:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17/11/2025 12:24 pm, Jan Beulich wrote:
> On 14.11.2025 13:54, Jürgen Groß wrote:
>> On 14.11.25 12:42, Andrew Cooper wrote:
>>> On 14/11/2025 11:32 am, Juergen Gross wrote:
>>>> diff --git a/Config.mk b/Config.mk
>>>> index e1556dfbfa..d21d67945a 100644
>>>> --- a/Config.mk
>>>> +++ b/Config.mk
>>>> @@ -159,6 +159,19 @@ define move-if-changed
>>>>    if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
>>>>   endef
>>>>   
>>>> +PATH_FILES := Paths
>>>> +INC_FILES := $(foreach f, $(PATH_FILES), $(XEN_ROOT)/config/$(f).mk)
>>>> +
>>>> +include $(INC_FILES)
>>>> +
>>>> +BUILD_MAKE_VARS := $(foreach f, $(PATH_FILES), $(shell awk '$$2 == ":=" { 
>>>> print $$1; }' $(XEN_ROOT)/config/$(f).mk.in))
>>>> +
>>>> +# Replace @xxx@ markers in $(1).in with $(xxx) variable contents, write 
>>>> to $(1)
>>>> +define apply-build-vars
>>>> + $(1): $(1).in
>>>> +  sed $$(foreach v, $$(BUILD_MAKE_VARS), -e 's#@$$(v)@#$$($$(v))#g') <$$< 
>>>> >$$@
>>>> +endef
>>> Shouldn't this write to a tmp file, and use move-if-changed?  Most of
>>> the time the markers won't have changed, and we'll want to short circuit
>>> dependent rules.
>> I can see this being an advantage when e.g. generating header files, as
>> those being generated again would potentially cause lots of rebuilds.
>>
>> In this case I can hardly see any case where make wouldn't do the right
>> thing already. Either the *.in file is newer than the generated file due
>> to a git update or a manual edit, so make will regenerate the target (and
>> this is what we want), or the *.in file hasn't changed, so make won't
>> regenerate the file as it is newer than the *.in file already.
>>
>> Or did I miss some aspect?
> Aren't some of the generated files Makefile fragments? Them being re-generated
> means make re-invoking itself, which could be avoided if the contents don't
> really change. (This isn't just a performance concern; this re-invocation has
> been the source of, well, surprising behavior in certain cases.)

Having thought about this some more, it needs to be FORCE and
move-if-changed, or to express a dependency on Paths.mk

Otherwise, if you ./configure --libdir=something/else and then do an
incremental build, the generated files will be wrong.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.