All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Randy Dunlap <rdunlap@infradead.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Rich Felker <dalias@libc.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	linux-sh@vger.kernel.org
Subject: [PATCH 4/4] sh: remove compiler flag duplication
Date: Sun, 19 Feb 2023 23:15:55 +0900	[thread overview]
Message-ID: <20230219141555.2308306-4-masahiroy@kernel.org> (raw)
In-Reply-To: <20230219141555.2308306-1-masahiroy@kernel.org>

Every compiler flag added by arch/sh/Makefile is passed to the
compiler twice.

$(KBUILD_CPPFLAGS) + $(KBUILD_CFLAGS) is used for compiling *.c
$(KBUILD_CPPFLAGS) + $(KBUILD_AFLAGS) is used for compiling *.S

Given the above, adding $(cflags-y) to all of KBUILD_{CPP/C/A}FLAGS
ends up with duplication.

Add -I options to $(KBUILD_CPPFLAGS), and the rest of $(cflags-y)
to KBUILD_{C,A}FLAGS.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 arch/sh/Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index f1c6aace8acb..cab2f9c011a8 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -145,10 +145,8 @@ cpuincdir-y			+= cpu-common	# Must be last
 
 drivers-y			+= arch/sh/drivers/
 
-cflags-y	+= $(addprefix -I $(srctree)/arch/sh/include/, $(cpuincdir-y) $(machdir-y))
-
+KBUILD_CPPFLAGS		+= $(addprefix -I $(srctree)/arch/sh/include/, $(cpuincdir-y) $(machdir-y))
 KBUILD_CFLAGS		+= -pipe $(cflags-y)
-KBUILD_CPPFLAGS		+= $(cflags-y)
 KBUILD_AFLAGS		+= $(cflags-y)
 
 ifeq ($(CONFIG_MCOUNT),y)
-- 
2.34.1


  parent reply	other threads:[~2023-02-19 14:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-19 14:15 [PATCH 1/4] sh: fix -Wmissing-include-dirs warnings for various platforms Masahiro Yamada
2023-02-19 14:15 ` [PATCH 2/4] sh: move build rule of cchips/hd6446x/ to arch/sh/Kbuild Masahiro Yamada
2023-02-19 17:05   ` Randy Dunlap
2023-07-04  5:28   ` John Paul Adrian Glaubitz
2023-02-19 14:15 ` [PATCH 3/4] sh: refactor header include path addition Masahiro Yamada
2023-02-19 17:05   ` Randy Dunlap
2023-07-04  5:29   ` John Paul Adrian Glaubitz
2023-02-19 14:15 ` Masahiro Yamada [this message]
2023-02-19 17:05   ` [PATCH 4/4] sh: remove compiler flag duplication Randy Dunlap
2023-07-04  5:32   ` John Paul Adrian Glaubitz
2023-02-19 14:40 ` [PATCH 1/4] sh: fix -Wmissing-include-dirs warnings for various platforms John Paul Adrian Glaubitz
2023-02-19 16:54   ` Masahiro Yamada
2023-06-25  7:56   ` Masahiro Yamada
2023-06-25  8:11     ` John Paul Adrian Glaubitz
2023-06-25 21:07     ` John Paul Adrian Glaubitz
2023-02-19 17:05 ` Randy Dunlap
2023-07-04  5:26 ` John Paul Adrian Glaubitz
2023-07-05 17:08 ` John Paul Adrian Glaubitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230219141555.2308306-4-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=dalias@libc.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.