Remove unneeded build directory traversals
Subsystems (3)
v3 cover Remove unneeded build directory traversals
Hello all,
I was building a kernel for x86 and noticed Make still descended into directories like drivers/gpu/drm/hisilicon, this seems kind of odd given nothing will be built here. It looks to be due to some directories being included in obj-y unconditionally instead of only when the relevant CONFIG_ is set.
These patches are split by subsystem in-case, for some reason, a file in a directory does need to be built, I believe I have checked for all instances of this, but a quick review from some maintainers would be nice.
Thanks,
Andrew
Changes from v2:
- Removed patches that would not work
- Rebased on v4.11-rc1 (no changes needed)
Changes from v1:
- Removed patches already taken by maintainers
- Rebased on v4.10-rc1 (no changes needed)
Andrew F. Davis (7):
pwm: Only descend into pwm directory when CONFIG_PWM is set
amba: Only descend into amba directory when CONFIG_ARM_AMBA is set
NFC: Only descend into nfc directory when CONFIG_NFC is set
macintosh: Only descend into directory when CONFIG_MACINTOSH_DRIVERS
is set
auxdisplay: Only descend into directory when CONFIG_AUXDISPLAY is set
lguest: Only descend into lguest directory when CONFIG_LGUEST is set
mmc: Only descend into mmc directory when CONFIG_MMC is set
drivers/Makefile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
Signature · 1 line
2.11.0
PATCH v3 1/7 pwm: Only descend into pwm directory when CONFIG_PWM is set
When CONFIG_PWM is not set make will still descend into the pwm directory but nothing will be built. This produces unneeded build artifacts and messages in addition to slowing the build. Fix this here.
--- drivers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/Makefile +1 -1
@@ -13,7 +13,7 @@ obj-$(CONFIG_GENERIC_PHY) += phy/ # GPIO must come after pinctrl as gpios may need to mux pins etc obj-$(CONFIG_PINCTRL) += pinctrl/ obj-$(CONFIG_GPIOLIB) += gpio/ -obj-y += pwm/ +obj-$(CONFIG_PWM) += pwm/ obj-$(CONFIG_PCI) += pci/ # PCI dwc controller drivers obj-y += pci/dwc/
Signature · 1 line
2.11.0
PATCH v3 2/7 amba: Only descend into amba directory when CONFIG_ARM_AMBA is set
In reply to Andrew F. DavisWhen CONFIG_ARM_AMBA is not set make will still descend into the amba directory but nothing will be built. This produces unneeded build artifacts and messages in addition to slowing the build. Fix this here.
--- drivers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/Makefile +1 -1
@@ -31,7 +31,7 @@ obj-$(CONFIG_SFI) += sfi/ # PnP must come after ACPI since it will eventually need to check if acpi # was used and do nothing if so obj-$(CONFIG_PNP) += pnp/ -obj-y += amba/ +obj-$(CONFIG_ARM_AMBA) += amba/ obj-y += clk/ # Many drivers will want to use DMA so this has to be made available
Signature · 1 line
2.11.0
PATCH v3 3/7 NFC: Only descend into nfc directory when CONFIG_NFC is set
In reply to Andrew F. DavisWhen CONFIG_NFC is not set make will still descend into the nfc directory but nothing will be built. This produces unneeded build artifacts and messages in addition to slowing the build. Fix this here.
--- drivers/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/Makefile +5 -1
@@ -69,7 +69,11 @@ obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/ obj-$(CONFIG_PARPORT) += parport/ obj-$(CONFIG_NVM) += lightnvm/ -obj-y += base/ block/ misc/ mfd/ nfc/ +obj-y += base/ +obj-y += block/ +obj-y += misc/ +obj-y += mfd/ +obj-$(CONFIG_NFC) += nfc/ obj-$(CONFIG_LIBNVDIMM) += nvdimm/ obj-$(CONFIG_DEV_DAX) += dax/ obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/
Signature · 1 line
2.11.0
PATCH v3 4/7 macintosh: Only descend into directory when CONFIG_MACINTOSH_DRIVERS is set
In reply to Andrew F. DavisWhen CONFIG_MACINTOSH_DRIVERS is not set make will still descend into the macintosh directory but nothing will be built. This produces unneeded build artifacts and messages in addition to slowing the build. Fix this here.
--- drivers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/Makefile +1 -1
@@ -78,7 +78,7 @@ obj-$(CONFIG_LIBNVDIMM) += nvdimm/ obj-$(CONFIG_DEV_DAX) += dax/ obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/ obj-$(CONFIG_NUBUS) += nubus/ -obj-y += macintosh/ +obj-$(CONFIG_MACINTOSH_DRIVERS) += macintosh/ obj-$(CONFIG_IDE) += ide/ obj-$(CONFIG_SCSI) += scsi/ obj-y += nvme/
Signature · 1 line
2.11.0
PATCH v3 5/7 auxdisplay: Only descend into directory when CONFIG_AUXDISPLAY is set
In reply to Andrew F. DavisWhen CONFIG_AUXDISPLAY is not set make will still descend into the auxdisplay directory but nothing will be built. This produces unneeded build artifacts and messages in addition to slowing the build. Fix this here.
--- drivers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/Makefile +1 -1
@@ -95,7 +95,7 @@ obj-y += firewire/ obj-$(CONFIG_UIO) += uio/ obj-$(CONFIG_VFIO) += vfio/ obj-y += cdrom/ -obj-y += auxdisplay/ +obj-$(CONFIG_AUXDISPLAY) += auxdisplay/ obj-$(CONFIG_PCCARD) += pcmcia/ obj-$(CONFIG_DIO) += dio/ obj-$(CONFIG_SBUS) += sbus/
Signature · 1 line
2.11.0
PATCH v3 6/7 lguest: Only descend into lguest directory when CONFIG_LGUEST is set
In reply to Andrew F. DavisWhen CONFIG_LGUEST is not set make will still descend into the lguest directory but nothing will be built. This produces unneeded build artifacts and messages in addition to slowing the build. Fix this here.
--- drivers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/Makefile +1 -1
@@ -126,7 +126,7 @@ obj-$(CONFIG_ACCESSIBILITY) += accessibility/ obj-$(CONFIG_ISDN) += isdn/ obj-$(CONFIG_EDAC) += edac/ obj-$(CONFIG_EISA) += eisa/ -obj-y += lguest/ +obj-$(CONFIG_LGUEST) += lguest/ obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_CPU_IDLE) += cpuidle/ obj-y += mmc/
Signature · 1 line
2.11.0
PATCH v3 7/7 mmc: Only descend into mmc directory when CONFIG_MMC is set
In reply to Andrew F. DavisWhen CONFIG_MMC is not set make will still descend into the mmc directory but nothing will be built. This produces unneeded build artifacts and messages in addition to slowing the build. Fix this here.
--- drivers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/Makefile +1 -1
@@ -129,7 +129,7 @@ obj-$(CONFIG_EISA) += eisa/ obj-$(CONFIG_LGUEST) += lguest/ obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_CPU_IDLE) += cpuidle/ -obj-y += mmc/ +obj-$(CONFIG_MMC) += mmc/ obj-$(CONFIG_MEMSTICK) += memstick/ obj-$(CONFIG_NEW_LEDS) += leds/ obj-$(CONFIG_INFINIBAND) += infiniband/
Signature · 1 line
2.11.0
Quoted 11 lines · Andrew F. Davis
Hello all,
I was building a kernel for x86 and noticed Make still descended into directories like
drivers/gpu/drm/hisilicon, this seems kind of odd given nothing will be built here. It looks to be due to some directories being included in obj-y unconditionally instead of only when the relevantCONFIG_is set.These patches are split by subsystem in-case, for some reason, a file in a directory does need to be built, I believe I have checked for all instances of this, but a quick review from some maintainers would be nice.
I didn't see anything wrong with the patches, and made sure that there are no tristate symbols controlling the subdirectory for anything that requires a built-in driver (which would cause a link failure).
I'm not sure about drivers/lguest, which has some special magic in its Makefile, it's possible that this now fails with CONFIG_LGUEST=m.
Arnd
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · Andrew F. Davis
Hello all,
I was building a kernel for x86 and noticed Make still descended into directories like
drivers/gpu/drm/hisilicon, this seems kind of odd given nothing will be built here. It looks to be due to some directories being included in obj-y unconditionally instead of only when the relevantCONFIG_is set.These patches are split by subsystem in-case, for some reason, a file in a directory does need to be built, I believe I have checked for all instances of this, but a quick review from some maintainers would be nice.
Quoted 7 lines
I didn't see anything wrong with the patches, and made sure that there are no tristate symbols controlling the subdirectory for anything that requires a built-in driver (which would cause a link failure).
I'm not sure about
drivers/lguest, which has some special magic in itsMakefile, it's possible that this now fails withCONFIG_LGUEST=m.
lguest and mmc are the strange ones, so I put them last in the series in case they did need to be dropped.
lguest was supposed to have been taken from v1:
https://lkml.org/lkml/2016/6/20/1086
but it looks like it didn't so I re-introduced it for v3.
mmc caught some 0-day build warnings but I never got to the bottom of them.
Anyway, I have no problem with these two being held back until the magic in their Makefile is sorted out.
Thanks,
Andrew
Quoted 2 lines
Arnd
Quoted 22 lines · Andrew F. Davis
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · Andrew F. Davis
Hello all,
I was building a kernel for x86 and noticed Make still descended into directories like
drivers/gpu/drm/hisilicon, this seems kind of odd given nothing will be built here. It looks to be due to some directories being included in obj-y unconditionally instead of only when the relevantCONFIG_is set.These patches are split by subsystem in-case, for some reason, a file in a directory does need to be built, I believe I have checked for all instances of this, but a quick review from some maintainers would be nice.
Quoted 7 lines
I didn't see anything wrong with the patches, and made sure that there are no tristate symbols controlling the subdirectory for anything that requires a built-in driver (which would cause a link failure).
I'm not sure about
drivers/lguest, which has some special magic in itsMakefile, it's possible that this now fails withCONFIG_LGUEST=m.
Quoted 8 lines
lguest and mmc are the strange ones, so I put them last in the series in case they did need to be dropped.
lguest was supposed to have been taken from v1:
https://lkml.org/lkml/2016/6/20/1086
but it looks like it didn't so I re-introduced it for v3.mmc caught some 0-day build warnings but I never got to the bottom of them.
Ah, I see now what happened to mmc:
obj-$(subst m,y,$(CONFIG_MMC)) += host/
tmio_mmc_core-$(subst m,y,$(CONFIG_MMC_SDHI)) += tmio_mmc_dma.o
obj-$(subst m,y,$(CONFIG_MMC_SDHCI_PCI)) += sdhci-pci-data.o
with CONFIG_MMC=m, this will fail to build the built-in files in drivers/mmc/host. I suppose this could be expressed in a different way these days, but dropping the patch would be easier.
Arnd
Re: [PATCH v3 4/7] macintosh: Only descend into directory when CONFIG_MACINTOSH_DRIVERS is set
In reply to Andrew F. DavisQuoted 9 lines · Andrew F. Davis
When
CONFIG_MACINTOSH_DRIVERSis not set make will still descend into the macintosh directory but nothing will be built. This produces unneeded build artifacts and messages in addition to slowing the build. Fix this here.Signed-off-by Andrew F. Davis <[email protected]>--- drivers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
LGTM.
cheersj
kbuild test robot
build botRe: [PATCH v3 7/7] mmc: Only descend into mmc directory when CONFIG_MMC is set
In reply to Andrew F. Davisurl: https://github.com/0day-ci/linux/commits/Andrew-F-Davis/Remove-unneeded-build-directory-traversals/20170318-040719 config: x86_64-rhel (attached as .config) compiler: gcc-6 (Debian 6.2.0-3)…
Hi Andrew,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc2 next-20170310]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Andrew-F-Davis/Remove-unneeded-build-directory-traversals/20170318-040719
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All errors (new ones prefixed by >>):
>> ERROR: "sdhci_pci_get_data" [drivers/mmc/host/sdhci-pci.ko] undefined! >> ERROR: "sdhci_pci_spt_drive_strength" [drivers/mmc/host/sdhci-pci.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH v3 7/7] mmc: Only descend into mmc directory when CONFIG_MMC is set
In reply to Andrew F. Davisurl: https://github.com/0day-ci/linux/commits/Andrew-F-Davis/Remove-unneeded-build-directory-traversals/20170318-040719 config: x86_64-allmodconfig (attached as .config) compiler: gcc-6 (Debian…
Hi Andrew,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc2 next-20170310]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Andrew-F-Davis/Remove-unneeded-build-directory-traversals/20170318-040719
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All errors (new ones prefixed by >>):
arch/x86/built-in.o: In function `mrfld_sd_init':
>> platform_mrfld_sd.c:(.init.text+0x397d5): undefined reference to `sdhci_pci_get_data'
platform_mrfld_sd.c:(.init.text+0x397e3): undefined reference to `sdhci_pci_get_data'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation