linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: make Makefile|Kbuild in each directory optional
@ 2018-01-25  1:41 Jakub Kicinski
  2018-01-25 13:15 ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2018-01-25  1:41 UTC (permalink / raw)
  To: linux-kbuild, davem; +Cc: linux-kernel, netdev, oss-drivers, Jakub Kicinski

It is useful to be able to build single object files, e.g.:
$ make net/sched/cls_flower.o W=1 C=2

Currently kbuild does a hard include of a Kbuild or Makefile
for directory where that object would reside.  Kbuild doesn't
cater too well to multi-directory drivers, meaning such drivers
will usually only use a single central Makefile.  This in turn
means it will be impossible to build most of object files
individually for such drivers.

Make the include of $dir/{Makefile,Kbuild} optional.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
---
I must admit I have no idea whose tree I should send this to :(
Could it go via net-next if no one on linux-kbuild objects?

 scripts/Makefile.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 47cddf32aeba..178864f877d5 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -42,7 +42,7 @@ save-cflags := $(CFLAGS)
 # The filename Kbuild has precedence over Makefile
 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
-include $(kbuild-file)
+-include $(kbuild-file)
 
 # If the save-* variables changed error out
 ifeq ($(KBUILD_NOPEDANTIC),)
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: make Makefile|Kbuild in each directory optional
  2018-01-25  1:41 [PATCH] kbuild: make Makefile|Kbuild in each directory optional Jakub Kicinski
@ 2018-01-25 13:15 ` Masahiro Yamada
  2018-01-25 19:17   ` [oss-drivers] " Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2018-01-25 13:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Linux Kbuild mailing list, David S. Miller,
	Linux Kernel Mailing List, netdev, oss-drivers

2018-01-25 10:41 GMT+09:00 Jakub Kicinski <jakub.kicinski@netronome.com>:
> It is useful to be able to build single object files, e.g.:
> $ make net/sched/cls_flower.o W=1 C=2
>
> Currently kbuild does a hard include of a Kbuild or Makefile
> for directory where that object would reside.  Kbuild doesn't
> cater too well to multi-directory drivers, meaning such drivers
> will usually only use a single central Makefile.  This in turn
> means it will be impossible to build most of object files
> individually for such drivers.
>
> Make the include of $dir/{Makefile,Kbuild} optional.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
> ---
> I must admit I have no idea whose tree I should send this to :(
> Could it go via net-next if no one on linux-kbuild objects?

This should be taken care of by linux-kbuild (and me).

For your specific problem, please fix netronome/nfp/Makefile


I'd like to take my time to think about this patch.

The single target is a bit compromised implementation
(it cannot handle subdir-ccflags-y correctly, for example)
I wonder if we should do this just for single target...





>  scripts/Makefile.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 47cddf32aeba..178864f877d5 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -42,7 +42,7 @@ save-cflags := $(CFLAGS)
>  # The filename Kbuild has precedence over Makefile
>  kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
>  kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
> -include $(kbuild-file)
> +-include $(kbuild-file)
>
>  # If the save-* variables changed error out
>  ifeq ($(KBUILD_NOPEDANTIC),)
> --
> 2.15.1
>



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [oss-drivers] Re: [PATCH] kbuild: make Makefile|Kbuild in each directory optional
  2018-01-25 13:15 ` Masahiro Yamada
@ 2018-01-25 19:17   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2018-01-25 19:17 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linux Kbuild mailing list, David S. Miller,
	Linux Kernel Mailing List, netdev, oss-drivers

On Thu, 25 Jan 2018 22:15:47 +0900, Masahiro Yamada wrote:
> For your specific problem, please fix netronome/nfp/Makefile

Would you be able to suggest a way of splitting a module Makefile?
I failed to find a way of doing that.  The only solution I see is 
to create empty Makefiles in subdirectories (5 of them).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-25 19:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25  1:41 [PATCH] kbuild: make Makefile|Kbuild in each directory optional Jakub Kicinski
2018-01-25 13:15 ` Masahiro Yamada
2018-01-25 19:17   ` [oss-drivers] " Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).