linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Meyer <thomas@m3y3r.de>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Jim Davis <jim.epost@gmail.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-kbuild <linux-kbuild@vger.kernel.org>
Subject: Re: make clean all broken with -j? + question regarding modpost
Date: Sat, 12 Aug 2017 13:13:41 +0200	[thread overview]
Message-ID: <20170812111341.GA7704@localhost.localdomain> (raw)
In-Reply-To: <CAK7LNAS3anskx8+9aWQrg+PKkr4L4AdsdWaha=_uMU5VjKpg5A@mail.gmail.com>

On Sat, Aug 12, 2017 at 12:11:50PM +0900, Masahiro Yamada wrote:
> Hi.
> 
> 
> 2017-08-11 7:11 GMT+09:00 Jim Davis <jim.epost@gmail.com>:
> > On Thu, Aug 10, 2017 at 11:28 AM, Randy Dunlap <rdunlap@infradead.org> wrote:
> >> [adding linux-kbuild]
> >>
> >> On 08/10/2017 08:42 AM, Thomas Meyer wrote:
> >>> Hi,
> >>>
> >>> 1.) make with multiple targets
> >>>
> >>> When running
> >>> $ make -j4 clean all
> >>> I get error from make (probably in scripts/Makefile.modbuiltin):
> >
> > With 4.13-rc4 I can get a similar build failure on my Fedora 26 workstation with
> >
> > make allnoconfig; make -j2 clean all
> >
> > /bin/sh: scripts/mod/empty.o: No such file or directory
> > make[2]: *** [scripts/mod/Makefile:24: scripts/mod/elfconfig.h] Error 1
> > make[1]: *** [scripts/Makefile.build:561: scripts/mod] Error 2
> >
> > Here's an ugly workaround for that test case.
> >
> > diff --git a/Makefile b/Makefile
> > index 6eba23bcb5ad..6a1fd24dcf31 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1297,6 +1297,7 @@ MRPROPER_FILES += .config .config.old .version
> > .old_version \
> >
> >  # clean - Delete most, but leave enough to build external modules
> >  #
> > +.NOTPARALLEL: clean
> >  clean: rm-dirs  := $(CLEAN_DIRS)
> >  clean: rm-files := $(CLEAN_FILES)
> >  clean-dirs      := $(addprefix _clean_, . $(vmlinux-alldirs)
> > Documentation samples)
> >
> 
> 
> If config targets and build targets are given from the command line
> (for example,  "make -j8 defconfig all"
> they are processed one by one.

Hi,

yes, after studying the top level Makefile I also stumbled upon the
__build_one_by_one mechanism.

> 
> Kbuild does not cater to the mixture of clean targets and build targets,
> but I do not know why.

Yes, good question. Two answers I can think of: Either it did work once and
broke or "make -j4 clean all" never worked, but nobody did care about.
Although it is strange to see that the Makefile already have the special case of
"mixed" targets, so somebody did care about at least of some similar special
case.

> 
> I wrote as follows.
> 
> 
> 
> --- a/Makefile
> +++ b/Makefile
> @@ -482,7 +482,8 @@ uapi-asm-generic:
>  version_h := include/generated/uapi/linux/version.h
>  old_version_h := include/linux/version.h
> 
> -no-dot-config-targets := clean mrproper distclean \
> +clean-targets := %clean mrproper cleandocs
> +no-dot-config-targets := $(clean-targets) \
>                          cscope gtags TAGS tags help% %docs check% coccicheck \
>                          $(version_h) headers_% archheaders archscripts \
>                          kernelversion %src-pkg
> @@ -505,6 +506,14 @@ ifeq ($(KBUILD_EXTMOD),)
>                  endif
>          endif
>  endif
> +
> +# For "make -j clean all", "make mrproper defconfig all", etc.
> +ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
> +       ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
> +               mixed-targets := 1
> +       endif
> +endif
> +
>  # install and module_install need also be processed one by one
>  ifneq ($(filter install,$(MAKECMDGOALS)),)
>          ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
> 

Yes, above patch does fix the bug and fixes "make -j4 clean all".

with kind regards
thomas
> 
> -- 
> Best Regards
> Masahiro Yamada

  parent reply	other threads:[~2017-08-12 11:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10 15:42 make clean all broken with -j? + question regarding modpost Thomas Meyer
2017-08-10 18:28 ` Randy Dunlap
2017-08-10 22:11   ` Jim Davis
2017-08-12  3:11     ` Masahiro Yamada
2017-08-12  8:06       ` Sam Ravnborg
2017-08-12 11:13       ` Thomas Meyer [this message]
2017-08-12  3:15   ` Masahiro Yamada
2017-08-12 11:21     ` Thomas Meyer
2017-08-10 22:58 ` valdis.kletnieks

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=20170812111341.GA7704@localhost.localdomain \
    --to=thomas@m3y3r.de \
    --cc=jim.epost@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=yamada.masahiro@socionext.com \
    /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 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).