From patchwork Tue Sep 21 22:55:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12509039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98582C433F5 for ; Tue, 21 Sep 2021 22:55:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 820B661166 for ; Tue, 21 Sep 2021 22:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbhIUW4u (ORCPT ); Tue, 21 Sep 2021 18:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbhIUW4t (ORCPT ); Tue, 21 Sep 2021 18:56:49 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E558C061574 for ; Tue, 21 Sep 2021 15:55:20 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id u18so1243060wrg.5 for ; Tue, 21 Sep 2021 15:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ClVH6jyIz4znZ8C2R+oY3i7esDwi5lA9JXl+OebTy1g=; b=RmE8B5naRqVSCFgGYzCQ/ytgmt6qtRp+FpPkjpco53RX0qz1hOF4++iUiwpAPMlJdu d16kMcjegUrU1bYOZRZwHAiHnVgorvAs8gyeq3b9h9xJo/72cYG9jiNcjXeW0hOezf2j pqbYoPLc7dNPsQqd1tussbh4S0xoXqrTvxFlONZk2heIa7yLlcxQiWN4uQTv/zr8Ws6T 7ZxsP/5Wa+3JmYN9WTknbslryRaVGvS6aNByclwcTH7racXxqeQNr/1rfQ/VomgvRYsM xChAnuzwu96s8yk0oBSXQm6avB15evaKO9G+FwlXAe8Zbnoi+6NLHXL8CFaFE0A1VL+L RNig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ClVH6jyIz4znZ8C2R+oY3i7esDwi5lA9JXl+OebTy1g=; b=vMR7eD8ueN4KbbWvkkspJdCEDhknKpZUd1are6/jizdFMhuGwdX4IrKOEA2OyI82+y 4Xbm4bWT6wLWF38r7jutYNxwDguL44Pq6fzhHaDm6VZ7mRq7OiilCxGEBZwsZz/yeiAE kyZIU8ywl82TPf15dy5vpTP2drfxeS0cHl1ZW1Yj8dGZAV4oBQtRfSWsM20vP2pDT4U2 k8L527ZRROON1HXEVDJa/ZU+DqWNYLltoCkeZAFlKcG5vaCG2jGVU9ki03ahLwFe2mD6 DRe3cRwJtvxCWPFH8Qci26owF2RwTf4sP5BRnivgJ0RH0hwvuDONGod7R9LC6oHwQWGV imxg== X-Gm-Message-State: AOAM530b/Uz46MKwdLtBdaOTAtmtRVqWMJth+xczgGU8iDtJVtIcs8jm pjbmbrwLfb5WizDxn4e31bvoeCjjnoBa5g== X-Google-Smtp-Source: ABdhPJxsYL9RXqriktebXCMTCPRJgRdWINvCx6k73smXaGGziShNojzyoejntxDnUbgeUsgG6hRonw== X-Received: by 2002:a5d:58c9:: with SMTP id o9mr38647246wrf.279.1632264918840; Tue, 21 Sep 2021 15:55:18 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id s3sm399474wra.72.2021.09.21.15.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 15:55:18 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Ramsay Jones , Denton Liu , Jeff King , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 1/3] Makefile: make the "sparse" target non-.PHONY Date: Wed, 22 Sep 2021 00:55:13 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.1098.gf02a64c1a2d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the "sparse" target and its *.sp dependencies to be non-.PHONY. It's now viable to run it as part of a normal compilation target, as we'll only re-generate these checks if the source *.c file has changed. On my box with -j8 it was fast before, or around 5 seconds, now it only takes that long the first time, and the common case is <100ms, or however long it takes GNU make to stat the *.sp file and see that all the corresponding *.c files are older. See 0bcd9ae85d7 (sparse: Fix errors due to missing target-specific variables, 2011-04-21) for the modern implementation of the sparse target being changed here. It is critical that we use -Wsparse-error here, otherwise the error would only show up once, but we'd successfully create the empty *.sp file, and running a second time wouldn't show the error. I'm therefore not putting it into SPARSE_FLAGS or SP_EXTRA_FLAGS, it's not optional, the Makefile logic won't behave properly without it. Appending to $@ without a move is OK here because we're using the .DELETE_ON_ERROR Makefile feature. See 7b76d6bf221 (Makefile: add and use the ".DELETE_ON_ERROR" flag, 2021-06-29). GNU make ensures that on error this file will be removed. Signed-off-by: Ævar Arnfjörð Bjarmason --- .gitignore | 1 + Makefile | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 311841f9bed..b02250a50c4 100644 --- a/.gitignore +++ b/.gitignore @@ -224,6 +224,7 @@ *.lib *.res *.sln +*.sp *.suo *.ncb *.vcproj diff --git a/Makefile b/Makefile index a9f9b689f0c..5b09f67aab0 100644 --- a/Makefile +++ b/Makefile @@ -2896,11 +2896,13 @@ check-sha1:: t/helper/test-tool$X SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ)) -$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE +$(SP_OBJ): %.sp: %.c GIT-CFLAGS $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \ - $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $< + -Wsparse-error \ + $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $< && \ + >$@ -.PHONY: sparse $(SP_OBJ) +.PHONY: sparse sparse: $(SP_OBJ) EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/% From patchwork Tue Sep 21 22:55:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12509041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A7EFC433FE for ; Tue, 21 Sep 2021 22:55:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1970961156 for ; Tue, 21 Sep 2021 22:55:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230305AbhIUW4w (ORCPT ); Tue, 21 Sep 2021 18:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230270AbhIUW4u (ORCPT ); Tue, 21 Sep 2021 18:56:50 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36EF3C061574 for ; Tue, 21 Sep 2021 15:55:21 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id t8so1327896wri.1 for ; Tue, 21 Sep 2021 15:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aRhq0BYVxeQoJWKUfr8w0qQjhFzZ3GDEm+N98b7upD4=; b=Wgmym1uGimNat/F4pG3KgLm6EXCKtZrebN5GGScbcJb5yG2Vxia/X/hsAtemBNXyXJ gfehxhITP3O6RrtPqDJF554pj33d2NNpiSrjLzA5Cw94Q0OWazNVjaD9KuPU9sN6Vghg eK6FDC50pqQrBy0qejUkouceu4vUZAoQE4/r+nwSVaydx9c39H4bHPN1azLFr2IgX0AD gHF8KpJRC9/GAWVIXkEAgGR9I0bditGaOuxONO5vmjminQ+AsVgaJ9SdHXM9VfYgJdEZ tdg2wLDGjgam3rBcKsScSE/zxhw6dMciAaZI4JU9zTxLxpLwFwsHPOXrbpdq3d4QWhOG FgBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aRhq0BYVxeQoJWKUfr8w0qQjhFzZ3GDEm+N98b7upD4=; b=6aVqDhaju1CisPLJRNo/FWcW6Rb3cqjc31rGhD0Q4Q6jCFdnj6eXnF1Ki13/7lioqg 0ncaUNLRkx0IgN0JsetIrijW7DA2GAB0n8YQbf/K5OOd2XK+OCqV1EDG7bYVRqxY7ve/ PdPzIBgRiDWAnsiOShqbmGGbr4Lrs7OZbj+KJd1Jz05RZVgxTEusJB6w/YIl1XUJrHcp pH2jGV/1451dHTSHLTKBr+yLzXrTqyGjYrsrSg6XcsgmctlD/2kdWFLCuTOmkWU3zIO/ sgcbJNzTcnmIqoaJ55JEeElcl/pEMav91HgFjTMEzYQzonwrkliUr40Ab1xz7gWQks0q ozNA== X-Gm-Message-State: AOAM533sPT/IvkPXv4x5ovuG0VMtFtkHzzH3bZCWJM62/M4KKu3uaxoo SbtTUcXgACOhNb9iFr6D048KaJ1Ew3CRBg== X-Google-Smtp-Source: ABdhPJz4G7SoJ9i1m/JgheYsYNjLIPagEZsQCJHJFr8HRo+cVrVwZbLtdaDfsC1RII49mwaTrMfp7Q== X-Received: by 2002:a7b:c056:: with SMTP id u22mr7276229wmc.15.1632264919582; Tue, 21 Sep 2021 15:55:19 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id s3sm399474wra.72.2021.09.21.15.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 15:55:19 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Ramsay Jones , Denton Liu , Jeff King , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 2/3] Makefile: do one append in %.hcc rule Date: Wed, 22 Sep 2021 00:55:14 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.1098.gf02a64c1a2d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a rule added in added b503a2d515e (Makefile: emulate compile in $(HCO) target better, 2019-09-25) to use one append, instead of ">" followed by a ">>". Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5b09f67aab0..ce4063a031a 100644 --- a/Makefile +++ b/Makefile @@ -2914,8 +2914,10 @@ HCO = $(patsubst %.h,%.hco,$(CHK_HDRS)) HCC = $(HCO:hco=hcc) %.hcc: %.h - @echo '#include "git-compat-util.h"' >$@ - @echo '#include "$<"' >>$@ + @{ \ + echo '#include "git-compat-util.h"'; \ + echo '#include "$<"'; \ + } >$@ $(HCO): %.hco: %.hcc FORCE $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $< From patchwork Tue Sep 21 22:55:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12509043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FCF7C433EF for ; Tue, 21 Sep 2021 22:55:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0BCEE61166 for ; Tue, 21 Sep 2021 22:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbhIUW4w (ORCPT ); Tue, 21 Sep 2021 18:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbhIUW4v (ORCPT ); Tue, 21 Sep 2021 18:56:51 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F033C061575 for ; Tue, 21 Sep 2021 15:55:22 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id t18so1415087wrb.0 for ; Tue, 21 Sep 2021 15:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PYeeWQMPaLi3LimZFAioYHAKtZxlhyoTad6RBYOpNnI=; b=NXjczHm1nsUmW4NyJF74oF2H/ve97RM0dNoyI+74O2janamtXY1PFEJZ7+YfQtnGBj f6BtGRVhGXoa5aIvDUSP6RTVfsSfK5+GUI2MXoBBUax7Tq75Ja3X17jtbcI8BS2/C8VY buFYzvZBQAhQ/rePxrovkgFNn3bORQZg1NVCUMJsOcz51xYnBNfiBJPau27HRp4C0jIQ jAPrdYddLwDWwPIAO9Ea6XGgHbI5ECzTexH+dA14Ue9H2FfZpcnOjLsMveZZ0d0dHrWP Y+ZZjLARdw0ircUCv4FcSvYNRWf8w/BRXwlHuIYB7grFXQ9fR8gFN9lMr6pEEVkOAGHZ Uxhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PYeeWQMPaLi3LimZFAioYHAKtZxlhyoTad6RBYOpNnI=; b=hRlS2b3UAcdwGc0hYzfBF3J0JYWzM3l/U8LbPcjR8VU2dVoU1/suZMyKisfzUPvewU qWzueATBXxvjHzo5FlQJqH3AUpWMHY0gSzgfALqTyPCsDUexK+SzvQ2VELe0HpcF+RUj MW/Gnn3Nk+zaLozfUG5kEBdqUOxT2wo+s5/EIDInKH9GK0jpzZ3whF6ZUkLgIFum5x/g ZuJMCo6M+pVyo6ybjzeRpuvQa0E72zN+rgy181SdK5ZxdkNKW3dWrXIfzfnjYAlDigQ1 SHgsbEd38ByxbLjDWNfk0eeFYLqG2zv0KnFzg+I82ddlHgiy3MKEGFzQJ12+bAK76ili /bXg== X-Gm-Message-State: AOAM533x0ZTFqVt0FXE2tiiZa6m7FVseK6Bb3Z+NtoqIwNMR4XTeHhw5 EOKVMrxs0FWQvaEHIbGsIB9a4yoXL7px4g== X-Google-Smtp-Source: ABdhPJwZcvieyz0qG6ysbctJT+wD+6ADEMEzbdFKHYaxe9tvNXW64VZzQeoXKLcJ7mkUDKVOyjjTTQ== X-Received: by 2002:adf:f185:: with SMTP id h5mr38576432wro.302.1632264920361; Tue, 21 Sep 2021 15:55:20 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id s3sm399474wra.72.2021.09.21.15.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 15:55:19 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Ramsay Jones , Denton Liu , Jeff King , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 3/3] Makefile: make the "hdr-check" target non-.PHONY Date: Wed, 22 Sep 2021 00:55:15 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.1098.gf02a64c1a2d In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org For the same reason as the preceding commit (which made "sparse" non-.PHONY), let's make the "hdr-check" target non-.PHONY. We could also change this to do "-o $@" instead of creating an empty file, but there would be no point, and it would just waste I/O and disk space, we're not interested in the compilation output, just whether or not we had an error. Signed-off-by: Ævar Arnfjörð Bjarmason --- .gitignore | 1 + Makefile | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b02250a50c4..4579985e2f4 100644 --- a/.gitignore +++ b/.gitignore @@ -220,6 +220,7 @@ /cscope* /compile_commands.json *.hcc +*.hco *.obj *.lib *.res diff --git a/Makefile b/Makefile index ce4063a031a..7980e69955a 100644 --- a/Makefile +++ b/Makefile @@ -2919,10 +2919,11 @@ HCC = $(HCO:hco=hcc) echo '#include "$<"'; \ } >$@ -$(HCO): %.hco: %.hcc FORCE - $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $< +$(HCO): %.hco: %.hcc + $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $< && \ + >$@ -.PHONY: hdr-check $(HCO) +.PHONY: hdr-check hdr-check: $(HCO) .PHONY: style