[PATCH 2/4] Makefile: remove some unnecessary header include paths

From: Masahiro Yamada
Date: Tue Apr 16 2024 - 08:21:07 EST


The include directive with the double-quote form, #include "...",
first searches for the specified header in the directory containing
the source file.

If all local headers are included using the double-quote form instead
of the angle bracket form, there is no need to add the local directory
to the header search path.

drivers/gpu/drm/imagination and drivers/net/ethernet/aquantia/atlantic
use only the double-quote form for including the local headers, and
there are no generated sources or headers in their directories. Hence,
the local header search path is unneeded.

The same applies to arch/loongarch/kvm/ because TRACE_INCLUDE_PATH is
relative to include/trace/.

I guess there exist more Makefiles with unnecessary header inclusion
paths (and more cases where it is possible to delete the header search
path by replacing #include <...> with #include "..."), but I do not have
an easy way to detect it.

These are unneeded inclusion paths that I happened to find.

Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
---

arch/loongarch/kvm/Makefile | 2 --
drivers/gpu/drm/imagination/Makefile | 2 --
drivers/net/ethernet/aquantia/atlantic/Makefile | 2 --
3 files changed, 6 deletions(-)

diff --git a/arch/loongarch/kvm/Makefile b/arch/loongarch/kvm/Makefile
index 244467d7792a..7a0108a721c1 100644
--- a/arch/loongarch/kvm/Makefile
+++ b/arch/loongarch/kvm/Makefile
@@ -3,8 +3,6 @@
# Makefile for LoongArch KVM support
#

-ccflags-y += -I $(srctree)/$(src)
-
include $(srctree)/virt/kvm/Makefile.kvm

obj-$(CONFIG_KVM) += kvm.o
diff --git a/drivers/gpu/drm/imagination/Makefile b/drivers/gpu/drm/imagination/Makefile
index ec6db8e9b403..3d9d4d40fb80 100644
--- a/drivers/gpu/drm/imagination/Makefile
+++ b/drivers/gpu/drm/imagination/Makefile
@@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only OR MIT
# Copyright (c) 2023 Imagination Technologies Ltd.

-subdir-ccflags-y := -I$(srctree)/$(src)
-
powervr-y := \
pvr_ccb.o \
pvr_cccb.o \
diff --git a/drivers/net/ethernet/aquantia/atlantic/Makefile b/drivers/net/ethernet/aquantia/atlantic/Makefile
index 8ebcc68e807f..268a055086c4 100644
--- a/drivers/net/ethernet/aquantia/atlantic/Makefile
+++ b/drivers/net/ethernet/aquantia/atlantic/Makefile
@@ -8,8 +8,6 @@

obj-$(CONFIG_AQTION) += atlantic.o

-ccflags-y += -I$(srctree)/$(src)
-
atlantic-objs := aq_main.o \
aq_nic.o \
aq_pci_func.o \
--
2.40.1