linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: consolidate single targets
@ 2018-10-30  4:32 Masahiro Yamada
  2018-11-02  9:44 ` Jon Hunter
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2018-10-30  4:32 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

Instead of specifying target/source pairs, let's list patterns that we
want to handle as single targets. This slightly changes the behavior;
the top Makefile previously checked the presence of a source file,
now Kbuild will descend into a subdirectory anyway to find out what to
do there.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 Makefile | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index be76e6e..7d13add 100644
--- a/Makefile
+++ b/Makefile
@@ -1713,21 +1713,7 @@ else
         target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
 endif
 
-%.s: %.c prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.i: %.c prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.o: %.c prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.lst: %.c prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.s: %.S prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.o: %.S prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.symtypes: %.c prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.ll: %.c prepare scripts FORCE
+%.i %.ll %.lst %.o %.s %.symtypes: prepare scripts FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
 
 # Modules
-- 
2.7.4


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

* Re: [PATCH] kbuild: consolidate single targets
  2018-10-30  4:32 [PATCH] kbuild: consolidate single targets Masahiro Yamada
@ 2018-11-02  9:44 ` Jon Hunter
  2018-11-02 10:53   ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Hunter @ 2018-11-02  9:44 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild; +Cc: Michal Marek, linux-kernel


On 30/10/2018 04:32, Masahiro Yamada wrote:
> Instead of specifying target/source pairs, let's list patterns that we
> want to handle as single targets. This slightly changes the behavior;
> the top Makefile previously checked the presence of a source file,
> now Kbuild will descend into a subdirectory anyway to find out what to
> do there.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  Makefile | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index be76e6e..7d13add 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1713,21 +1713,7 @@ else
>          target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
>  endif
>  
> -%.s: %.c prepare scripts FORCE
> -	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.i: %.c prepare scripts FORCE
> -	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.o: %.c prepare scripts FORCE
> -	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.lst: %.c prepare scripts FORCE
> -	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.s: %.S prepare scripts FORCE
> -	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.o: %.S prepare scripts FORCE
> -	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.symtypes: %.c prepare scripts FORCE
> -	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.ll: %.c prepare scripts FORCE
> +%.i %.ll %.lst %.o %.s %.symtypes: prepare scripts FORCE
>  	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
>  
>  # Modules

On one of my build machines (an older ubuntu 14.04 machine), this is
commit is causing 'make mrproper' or 'make distclean' to fail. Reverting
this commit fixes the problem.

$ make mrproper
Error: kernelrelease not valid - run 'make prepare' to update it
  CC      kernel/bounds.s
In file included from <command-line>:0:0:
././include/linux/kconfig.h:5:32: fatal error: generated/autoconf.h: No
such file or directory
 #include <generated/autoconf.h>
                                ^
compilation terminated.
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

FWIW, this machine has ...

$ make --version
GNU Make 3.81

Cheers
Jon

-- 
nvpublic

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

* Re: [PATCH] kbuild: consolidate single targets
  2018-11-02  9:44 ` Jon Hunter
@ 2018-11-02 10:53   ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2018-11-02 10:53 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Linux Kbuild mailing list, Michal Marek, Linux Kernel Mailing List

Hi Jon,

On Fri, Nov 2, 2018 at 6:44 PM Jon Hunter <jonathanh@nvidia.com> wrote:
>
>
> On 30/10/2018 04:32, Masahiro Yamada wrote:
> > Instead of specifying target/source pairs, let's list patterns that we
> > want to handle as single targets. This slightly changes the behavior;
> > the top Makefile previously checked the presence of a source file,
> > now Kbuild will descend into a subdirectory anyway to find out what to
> > do there.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> >
> >  Makefile | 16 +---------------
> >  1 file changed, 1 insertion(+), 15 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index be76e6e..7d13add 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1713,21 +1713,7 @@ else
> >          target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
> >  endif
> >
> > -%.s: %.c prepare scripts FORCE
> > -     $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> > -%.i: %.c prepare scripts FORCE
> > -     $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> > -%.o: %.c prepare scripts FORCE
> > -     $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> > -%.lst: %.c prepare scripts FORCE
> > -     $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> > -%.s: %.S prepare scripts FORCE
> > -     $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> > -%.o: %.S prepare scripts FORCE
> > -     $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> > -%.symtypes: %.c prepare scripts FORCE
> > -     $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> > -%.ll: %.c prepare scripts FORCE
> > +%.i %.ll %.lst %.o %.s %.symtypes: prepare scripts FORCE
> >       $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> >
> >  # Modules
>
> On one of my build machines (an older ubuntu 14.04 machine), this is
> commit is causing 'make mrproper' or 'make distclean' to fail. Reverting
> this commit fixes the problem.
>
> $ make mrproper
> Error: kernelrelease not valid - run 'make prepare' to update it
>   CC      kernel/bounds.s
> In file included from <command-line>:0:0:
> ././include/linux/kconfig.h:5:32: fatal error: generated/autoconf.h: No
> such file or directory
>  #include <generated/autoconf.h>
>                                 ^
> compilation terminated.
> make[1]: *** [kernel/bounds.s] Error 1
> make: *** [prepare0] Error 2
>
> FWIW, this machine has ...
>
> $ make --version
> GNU Make 3.81


Confirmed.

For make 3.81 or 3.82, 'make clean' will fail,
but it will work by passing -r option.


masahiro@pug:~/ref/linux-next$ make-3.81   clean
make-3.81: Circular checkbin.o <- prepare dependency dropped.
  HOSTCC  scripts/basic/fixdep
  CC      scripts/mod/empty.o
In file included from <command-line>:0:0:
././include/linux/kconfig.h:5:32: fatal error: generated/autoconf.h:
No such file or directory
compilation terminated.
make-3.81[2]: *** [scripts/mod/empty.o] Error 1
make-3.81[1]: *** [scripts/mod] Error 2
make-3.81: *** [scripts] Error 2
masahiro@pug:~/ref/linux-next$ make-3.81  -r clean



I know how to fix it, but
I will drop the problematic commit for now.


Thanks.


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2018-11-02 10:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30  4:32 [PATCH] kbuild: consolidate single targets Masahiro Yamada
2018-11-02  9:44 ` Jon Hunter
2018-11-02 10:53   ` Masahiro Yamada

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).