Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp2020602lqp; Tue, 16 Apr 2024 05:22:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfkar4kI2hhS4GK4R+unPUSe6OV6CUZAjGW7g/0L+mc0hd/d9YeNc2cYNUX1oIR7obtbxDNZge6TTtaeANfVnbU2nXfyxs/Y9Ii0E05w== X-Google-Smtp-Source: AGHT+IGO4QmLXkMcz25YsJ0RiR3dXpxWvyMcLPwVIPoXjuj01qRsKE3Mcnsom5EXYfuAUG4vES/z X-Received: by 2002:a05:6e02:1d98:b0:36a:2d86:90d7 with SMTP id h24-20020a056e021d9800b0036a2d8690d7mr17322717ila.5.1713270121546; Tue, 16 Apr 2024 05:22:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713270121; cv=pass; d=google.com; s=arc-20160816; b=JqZsxXk0y5InI8VxRJyIZN68q76a4aPtOEeb6m5tSAH1cfVwIk+77s7nvmKw/4tzPK 86K+9CVCRnwmIFbEx7HH47rAUASVoqy7sCsuRjC9csH10CQZyqJ6pS8+R+ATWPvI0CvF A4NA9BAQ5xRYJq1zyW26OOk7sLLqGAvevJlSYtvxVSz1h4fKXO9CDFgf+ZIsCBqY9Rj2 BrR+FkPk5uNHCssubxWXz4CGOgyJqeSUiVLF+CAc09JeNAmtIOa57vDu9gv22HSptcse W++GtR4pEzTd0uaNesLZSDUgapYOX9YL0dO4c4t+vDipz/qa9cEaOxtmekpOfkq7MTij G64A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6psS5LletWVsZ1ACq3i/QosQMUKs9tI8g8PS2lxJC94=; fh=oQbvuNnOUeIuBT5siQdg+euUHNNdn+CeEwAg69/1RSo=; b=Yh1Iz6KADmEE9pkLymR8AkLEDFuLXvy255C5eGUOenQo4VjRV22MTDZYjIe1Ulnl+x kXkVO3/D+XRu9TmYFz176ziInSAWTjJoPGzASS9BHYzaHsL87FHsHQBx2jQZ9WBTjOOi NHTZGbSaooMrrgnSJDb+7MGZYC9N5Ct4ojZ4vNNKWILxiX1rATWuK+W23dTiJIYhF2W6 W93cagYjHqfIC3DgF5hui9Chbf48sOayohdM+TaTRYMUANe5x7gd2Wy+zH6z9F3syWPf k78spJs8p599ikF6WxXumKEgYYWVtHHaS5rpoahsgqyGDMKRlTB1xZqAj0CiHAnjmxTH 1OOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gwkkwf1v; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-146778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146778-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t18-20020a635352000000b005d7bf204e26si9975179pgl.899.2024.04.16.05.22.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 05:22:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gwkkwf1v; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-146778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146778-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0C96FB21571 for ; Tue, 16 Apr 2024 12:21:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B69C212D77B; Tue, 16 Apr 2024 12:19:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gwkkwf1v" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1DA412D758; Tue, 16 Apr 2024 12:19:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713269961; cv=none; b=COcTTt7zY4tqYmBi/PDevJxZ2ggdO3CgeFBHhrgosEYpJ+GEhWeoec8yWlfn+l4GaESzdUNu+G4posWxQLBWQkbl0mIEELZizAwHycyyOvNh6T8HvouAk5/GptiDAHyebULOW7ylyaNpdoEhZEqgCSLuHy9R4MA4HDUKnMNolNE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713269961; c=relaxed/simple; bh=t4Bl7j8SQ36v8QBgo3xBasbvDvHJPyEmr0FsJYORC4w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=styq808crKiiZ3gsbrkmkZAFfP5dtx11oU8wx7imS5RTyvdvgbz2edchvkal79u3NRpgqHP1DY7sGSZ6BtZiz0xmQeZKbGL5Wk+Lopf6QAz0My8Oc7LhY3hroekdVGn3TO8R/fL6NgNC6wmWMVhsay4bA7M7P2tQ7Z8tNOA4FCk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gwkkwf1v; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AF2AC2BD10; Tue, 16 Apr 2024 12:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713269961; bh=t4Bl7j8SQ36v8QBgo3xBasbvDvHJPyEmr0FsJYORC4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gwkkwf1v2o1SKivR+dpENDwyRWqrOO4DALLLgoi6n55OvlI5fNuBTIc3xK/PZHfKf R+6LgCQCoFYuanB1MHSj+UNxS8E4jQEjEOR3mJQQ+haYSAgyRXncbrwi5IJZH8gYRN IIn/8wA2R2oYDrIRE3/tcvBrngq827LXDSBQAPJPz5ab/DbFl4l765I3QdqhF/qYyt jrmStZI60rzLCg4DmNmLq5SESTXqaB54FL+zAZPfo32CMrYm+j7DUY3U9UKMItXrLJ I6ued+pchNSFeS1K4uufbA37UTH0yMF+cNB+ZeWIeP1VGy5ARRyeHcsGjCnhLz/e8I d+qVAaSkSSV2g== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 3/4] kbuild: use $(obj)/ instead of $(src)/ for pattern rules for %.[cS] Date: Tue, 16 Apr 2024 21:18:37 +0900 Message-Id: <20240416121838.95427-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240416121838.95427-1-masahiroy@kernel.org> References: <20240416121838.95427-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Kbuild conventionally uses $(obj)/ for generated files, and $(src)/ for checked-in source files. It is merely a convention without any functional difference. In fact, $(obj) and $(src) are exactly the same, as defined in scripts/Makefile.build: src := $(obj) Before changing the semantics of $(src) in the next commit, this commit replaces $(obj)/ with $(src)/ in pattern rules where the prerequisite might be a generated file. C and assembly files are sometimes generated by tools, so they could be either generated files or real sources. The $(obj)/ prefix works for both cases with the help of VPATH. As mentioned above, $(obj) and $(src) are the same at this point, hence this commit has no functional change. I did not modify scripts/Makefile.userprogs because there is no use case where userspace C files are generated. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 18 +++++++++--------- scripts/Makefile.host | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index baf86c0880b6..067c93fa76c2 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -113,13 +113,13 @@ endif quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS) $(CC_FLAGS_LTO), $(c_flags)) -fverbose-asm -S -o $@ $< -$(obj)/%.s: $(src)/%.c FORCE +$(obj)/%.s: $(obj)/%.c FORCE $(call if_changed_dep,cc_s_c) quiet_cmd_cpp_i_c = CPP $(quiet_modtag) $@ cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $< -$(obj)/%.i: $(src)/%.c FORCE +$(obj)/%.i: $(obj)/%.c FORCE $(call if_changed_dep,cpp_i_c) genksyms = scripts/genksyms/genksyms \ @@ -133,7 +133,7 @@ cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms) quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ cmd_cc_symtypes_c = $(call cmd_gensymtypes_c,true,$@) >/dev/null -$(obj)/%.symtypes : $(src)/%.c FORCE +$(obj)/%.symtypes : $(obj)/%.c FORCE $(call cmd,cc_symtypes_c) # LLVM assembly @@ -141,7 +141,7 @@ $(obj)/%.symtypes : $(src)/%.c FORCE quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -fno-discard-value-names -o $@ $< -$(obj)/%.ll: $(src)/%.c FORCE +$(obj)/%.ll: $(obj)/%.c FORCE $(call if_changed_dep,cc_ll_c) # C (.c) files @@ -240,7 +240,7 @@ define rule_as_o_S endef # Built-in and composite module parts -$(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE +$(obj)/%.o: $(obj)/%.c $(recordmcount_source) FORCE $(call if_changed_rule,cc_o_c) $(call cmd,force_checksrc) @@ -257,7 +257,7 @@ quiet_cmd_cc_lst_c = MKLST $@ $(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \ System.map $(OBJDUMP) > $@ -$(obj)/%.lst: $(src)/%.c FORCE +$(obj)/%.lst: $(obj)/%.c FORCE $(call if_changed_dep,cc_lst_c) # Compile Rust sources (.rs) @@ -336,14 +336,14 @@ cmd_gensymtypes_S = \ quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@ cmd_cc_symtypes_S = $(call cmd_gensymtypes_S,true,$@) >/dev/null -$(obj)/%.symtypes : $(src)/%.S FORCE +$(obj)/%.symtypes : $(obj)/%.S FORCE $(call cmd,cc_symtypes_S) quiet_cmd_cpp_s_S = CPP $(quiet_modtag) $@ cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $< -$(obj)/%.s: $(src)/%.S FORCE +$(obj)/%.s: $(obj)/%.S FORCE $(call if_changed_dep,cpp_s_S) quiet_cmd_as_o_S = AS $(quiet_modtag) $@ @@ -358,7 +358,7 @@ cmd_gen_symversions_S = $(call gen_symversions,S) endif -$(obj)/%.o: $(src)/%.S FORCE +$(obj)/%.o: $(obj)/%.S FORCE $(call if_changed_rule,as_o_S) targets += $(filter-out $(subdir-builtin), $(real-obj-y)) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 3c17e6ba421c..d35f55e0d141 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -112,7 +112,7 @@ endif quiet_cmd_host-csingle = HOSTCC $@ cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \ $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem)) -$(host-csingle): $(obj)/%: $(src)/%.c FORCE +$(host-csingle): $(obj)/%: $(obj)/%.c FORCE $(call if_changed_dep,host-csingle) # Link an executable based on list of .o files, all plain c @@ -129,7 +129,7 @@ $(call multi_depend, $(host-cmulti), , -objs) # host-cobjs -> .o quiet_cmd_host-cobjs = HOSTCC $@ cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< -$(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE +$(host-cobjs): $(obj)/%.o: $(obj)/%.c FORCE $(call if_changed_dep,host-cobjs) # Link an executable based on list of .o files, a mixture of .c and .cc -- 2.40.1