From patchwork Tue May 20 05:21:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 891302 Delivered-To: patch@linaro.org Received: by 2002:adf:e88a:0:b0:3a3:61c9:c5d4 with SMTP id d10csp1428356wrm; Mon, 19 May 2025 22:23:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVxjH5ExIInvuyvbQYNdreK6pJpAKhKYHbpXsVT+VfP9NN1geE+S1cVmV48J9ECsfSFT9Bx1g==@linaro.org X-Google-Smtp-Source: AGHT+IHt3eTP6o1PNh3NFnveoU/8AIrxucFWjj4+/4GTbXZXuBXuh66vkOdpYRvaEngZZo38xblx X-Received: by 2002:adf:f14d:0:b0:3a3:6234:3736 with SMTP id ffacd0b85a97d-3a362343748mr10027966f8f.38.1747718633180; Mon, 19 May 2025 22:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1747718633; cv=none; d=google.com; s=arc-20240605; b=PqgNTgy1PnEKSnT6UTIBcjlCt07HZgeCOeC+clLaXqiHZumgUwgav/Y1h3thVBLb0L AX+ixdjakWX2eYDEtcYI7ei8RbLTPPnIPmKDL7YYRamJI0q8yzdaaK2H+wCJhAjYo3fH gxFuTHCSn7h0XNkSKUbWvK7oS3sHqfuffuzXJzR00KXQbZ/XqizcLtHm1Xb390uPES9d rf1dS4j8xoFsvIBkD0siszFVKeFesN4IjeW0OtPGPOu/3j0NQGqZAtJtSrwTlFddoEhP i9MwCqB7T8TQ8lxV+Hf5VG4uhgad4ANazolZkOHC/zcTNH0uFMnYaeWeyOCj8f0y/qmr lKGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=myAQLnNyoEYgTL9thFBm6JVTMfd0yPZIgdnmPcYkCAg=; fh=RMyNY7IAfTjm8rXmBp87lDTzSGQ/+riHsdoZw9iN590=; b=Yv3AtT0ba/652BuiTWuBFCgszVSJsfXN32dFhBHulcqh/V/Mfum9/9xTT+J5IfkOfZ VovgDEcJbI9fPdOfOW8AqrSw8DDd+rQCfZnrEXNKXMqZqHqLFarDHNDYBBYX29nynM1H eoFbWd00Nbxt28fuWOaLKNu9ElneVFB0sZSJetkEH3+nIST3xa9oiAUEYwitBnSQBs2t R+1M4UYMavn7MUKrL+EF7/Z0bMcw9ed0XndebGsPM7Cj0g/RypeCoHXgFGoDOat1mNVb S29q3Vd4Ty/UqVvKp+FhQ8x1NrCdt+1iZnEzECQ55R9/sb7bYi2+F/R4Mu1ppVX2PEFY GAkw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=haj083N7; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id ffacd0b85a97d-3a35ca8b8bdsi7089761f8f.679.2025.05.19.22.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 May 2025 22:23:53 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=haj083N7; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ABF1082CA4; Tue, 20 May 2025 07:22:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="haj083N7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B319482CA4; Tue, 20 May 2025 07:22:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BB39382BD7 for ; Tue, 20 May 2025 07:22:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3a361b8a664so3654046f8f.3 for ; Mon, 19 May 2025 22:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1747718546; x=1748323346; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=myAQLnNyoEYgTL9thFBm6JVTMfd0yPZIgdnmPcYkCAg=; b=haj083N7qZ653hN0FtKx+XJV4GjSRV1+HfEmwGeRu8enYWRljQEzuURVKYSQpyvCJJ MJO99dG4yMi58KrzBGlpbtDgjlOjGE9ttICRYWa4wLQ9Dc9Zhoym5s6zmLHeNJbDw9I/ gGVzMW6dfAN/x279F9ZVTeRLqQ1AcBz4NoVebFNHNBtbRzfee7fPBX9Z5mXCi7mkns5B lQA1l0Ho3370283AVy9X/SNzXEoDApRaz7nIQJtw78xViqKvu5c3msMKCOuHwV8wjnUu xX6z/GQ+eVNJdkwfwhBR34XcHW8qR4MRMQOGX86xcXoEQdK8fkS5nnNx5B3xJDYyrICW Tp6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747718546; x=1748323346; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=myAQLnNyoEYgTL9thFBm6JVTMfd0yPZIgdnmPcYkCAg=; b=Vpov/+eLxswwOpIcSpSVT5+qS6zBd+M2KEg0NOfd18pVzK+cU7gJ0hzYA1XP1FeN/5 AefO930RTt7UiaUmcpK8sj2RCv/U6ImUZg+VgPI0/kjTwq81VxZP4pxcojkl/18QNFkv i8Z0y0FZy1LMS4pgU75B0qp71IWTgoeNbN71SDLgmhnHAAt9jKYShb8BwVp8weWsQIl9 eJuNEvMTJ/Ph0B8e9oOVjhzN2prehNbi8JB5QMdw8gqjzhrn5zoj7gPwpTl1sYaQDk2a 3/jEtXQXE1rml/0zOnGxkikkhozmGU7wb2G+UoUSfU09kPfDruJykaHlhS36Fb/rvRWJ Hc/Q== X-Forwarded-Encrypted: i=1; AJvYcCUjF6YSsTs83n7XGHjqqllldqZICroaSXhCKxs9qMRG/Yqhr2GXq9j+kHFxvUv52mQw+NEwKJs=@lists.denx.de X-Gm-Message-State: AOJu0YwMff6+35ZgVihpFiZ8il/g3FUW+DTiSOyVFqO+Rjoi67Q35x63 EI59JaKXPupZB6cATUYsW068fmUHXZD2/ISCGQPpvftLke4H3yx1SoUmSyJ4bo925H0= X-Gm-Gg: ASbGncujH8FYaLXgU2aJbsoBIlEk0PLQTwL6QmxtrPy1SVIi3Z1cCLh0zKw2FzaqAPj kKOVYnCFWQ/lS0C31dsrUeHlhdyegvsUip71RGy0hF43OVKniY0gtMko6+oCNEKiSH82+Q25Lqz nSRDGzDDN4Z2ehjuS3P4VdcXU5Bm5fspVvwQoQ21KjxSgSJOikOkD70NUbj0URsTieS8GZB8UnG 31wUWyugrj2QmXi3NA61w4kdsOYPcl/iFMzZEkXNWARwGrqKM5otGwkYvyxw9CT2M8G1VzMB0Uf GIECfpXqkP6st4ZF1mBUPoOQs7JGJZukbL1XXAITyGDHi2tEKovAk2bZtkhVrZcDat8AXeZPIGc = X-Received: by 2002:a05:6000:430c:b0:3a3:6947:6d35 with SMTP id ffacd0b85a97d-3a369477158mr7580078f8f.57.1747718546170; Mon, 19 May 2025 22:22:26 -0700 (PDT) Received: from localhost.localdomain ([46.198.180.244]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a35ca889e6sm15100762f8f.71.2025.05.19.22.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 May 2025 22:22:25 -0700 (PDT) From: Ilias Apalodimas To: trini@konsulko.com Cc: Ilias Apalodimas , Simon Glass , Marek Vasut , Peter Robinson , Prasad Kummari , Michal Simek , Jiaxun Yang , Rasmus Villemoes , Sam Edwards , Jonathan Humphreys , Quentin Schulz , Heinrich Schuchardt , u-boot@lists.denx.de Subject: [PATCH 11/24] kbuild: let fixdep directly write to .*.cmd files Date: Tue, 20 May 2025 08:21:22 +0300 Message-ID: <20250520052153.307194-12-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250520052153.307194-1-ilias.apalodimas@linaro.org> References: <20250520052153.307194-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Backport from kernel commit 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files") Signed-off-by: Ilias Apalodimas --- Makefile | 13 +++++-------- scripts/Kbuild.include | 5 ++--- scripts/Makefile.build | 11 +++++++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 15c7e633b874..09d36b8cbbed 100644 --- a/Makefile +++ b/Makefile @@ -2538,14 +2538,11 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) cmd_rmfiles = rm -f $(rm-files) -# read all saved command lines - -cmd_files := $(wildcard .*.cmd) - -ifneq ($(cmd_files),) - $(cmd_files): ; # Do not try to update included dependency files - include $(cmd_files) -endif +# read saved command lines for existing targets +existing-targets := $(wildcard $(sort $(targets))) +cmd_files := $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) +$(cmd_files): ; # Do not try to update included dependency files +-include $(cmd_files) endif #ifeq ($(config-targets),1) endif #ifeq ($(mixed-targets),1) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 2ef687ea895a..6ef66c451eb1 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -274,9 +274,8 @@ if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ cmd_and_fixdep = \ $(echo-cmd) $(cmd_$(1)); \ - scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ - rm -f $(depfile); \ - mv -f $(dot-target).tmp $(dot-target).cmd; + scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\ + rm -f $(depfile) # Usage: $(call if_changed_rule,foo) # Will check if $(cmd_foo) or any of the prerequisites changed, diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d90b0b7aa6a0..2f2d5d4afc25 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -410,14 +410,17 @@ FORCE: # optimization, we don't need to read them if the target does not # exist, we will rebuild anyway in that case. -cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) +existing-targets := $(wildcard $(sort $(targets))) -ifneq ($(cmd_files),) - include $(cmd_files) -endif +-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) # Create directories for object files if they do not exist obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) +# If targets exist, their directories apparently exist. Skip mkdir. +existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets)))) +obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs))) +ifneq ($(obj-dirs),) $(shell mkdir -p $(obj-dirs)) +endif .PHONY: $(PHONY)