qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Raymond <cerbere@gmail.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial@nongnu.org, Qemu Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 1/2] Makefile: distclean should clean all possible targets
Date: Tue, 26 Jul 2011 09:51:21 -0400	[thread overview]
Message-ID: <CAHWZs7UG9NrAQKAtJN2+eQtbOOGFZrotdfSg3PhQ+FD_mRX4-w@mail.gmail.com> (raw)
In-Reply-To: <m339htczcl.fsf@blackfin.pond.sub.org>

Hi Markus,

> Well, I'd expect distclean to remove exactly what *this* makefile can
> build, and leave everything else alone.

I was expecting "distclean" to bring back the source directory to
however it was after checkout, removing anything that might have been
created by the build/configure process.


> Your patch adds a special case to that simple rule: also remove
> not-configured target directories.  Other not-configured stuff is still
> left behind.
>
> Special cases need special justification, hence my question above.

This patch stems from the discussion in "Makefile: fix out-of-tree builds"
http://lists.gnu.org/archive/html/qemu-devel/2011-07/msg02707.html

What happens is that SRC_PATH is set in the VPATH variable in the
Makefile, which causes it to search for files inside the source
directory (and outside the current build directory).

Say you're building out-of-tree, and the Makefile happens to pick up
old files from your main source directory, it can lead to errors in
the build. If you are "unable" to delete old build data because you've
run a more restricted "configure" after an earlier build, this earlier
build data will not go away if you distclean.

For example:
---8<---
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
    $(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u
> $@,"  GEN   $@")

...

%/config-devices.mak: default-configs/%.mak
...
---8<---

Let's say my sources are in ~/src/qemu/ and I build in /tmp/foo/.

Those rules can match i386-softmmu/config-devices.mak inside
~/src/qemu/ from a previous build if it doesn't exist in the current
build directory. Since this file is up to date wrt
~/src/qemu/default-configs/i386-softmu.mak, it won't be rebuilt in the
build directory. Then, when the recipe for config-all-devices.mak is
run, it will try to cat i386-softmmu/config-devices.mak, but "cat"
doesn't know about VPATH, so it will fail.

Alexandre


PS: if you're interested, here is the trace of this problem :

 Considering target file `config-all-devices.mak'.
  File `config-all-devices.mak' does not exist.
   Considering target file `i386-softmmu/config-devices.mak'.
    Looking for an implicit rule for `i386-softmmu/config-devices.mak'.
    Trying pattern rule with stem `i386-softmmu'.
    Trying implicit prerequisite `default-configs/i386-softmmu.mak'.
    Found prerequisite `default-configs/i386-softmmu.mak' as VPATH
`/Users/myuser/src/qemu/default-configs/i386-softmmu.mak'
    Found an implicit rule for `i386-softmmu/config-devices.mak'.
     Considering target file `default-configs/i386-softmmu.mak'.
      Looking for an implicit rule for `default-configs/i386-softmmu.mak'.
      No implicit rule found for `default-configs/i386-softmmu.mak'.
      Finished prerequisites of target file `default-configs/i386-softmmu.mak'.
     No need to remake target `default-configs/i386-softmmu.mak';
using VPATH name
`/Users/myuser/src/qemu/default-configs/i386-softmmu.mak'.
    Finished prerequisites of target file `i386-softmmu/config-devices.mak'.
    Prerequisite
`/Users/myuser/src/qemu/default-configs/i386-softmmu.mak' is older
than target `i386-softmmu/config-devices.mak'.
   No need to remake target `i386-softmmu/config-devices.mak'; using
VPATH name `/Users/myuser/src/qemu/i386-softmmu/config-devices.mak'.
<---- ***this here is the problem***
  Finished prerequisites of target file `config-all-devices.mak'.
 Must remake target `config-all-devices.mak'.
Putting child 0x001278c0 (config-all-devices.mak) PID 1699 on the chain.
Live child 0x001278c0 (config-all-devices.mak) PID 1699
  GEN   config-all-devices.mak
cat: i386-softmmu/config-devices.mak: No such file or directory
<---- ***this is the error***


  reply	other threads:[~2011-07-26 13:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26  3:56 [Qemu-trivial] [PATCH 0/2] Minor makefile fixes Alexandre Raymond
2011-07-26  3:56 ` [Qemu-trivial] [PATCH 1/2] Makefile: distclean should clean all possible targets Alexandre Raymond
2011-07-26  6:47   ` [Qemu-trivial] [Qemu-devel] " Markus Armbruster
2011-07-26 13:51     ` Alexandre Raymond [this message]
2011-07-27  5:57       ` Markus Armbruster
2011-07-27 13:55         ` Alexandre Raymond
2011-07-27 14:42           ` Michael Roth
2011-07-29 11:20             ` [Qemu-trivial] " Paolo Bonzini
2011-07-26  3:56 ` [Qemu-trivial] [PATCH 2/2] Makefile: delete config.log in distclean Alexandre Raymond
2011-07-29 11:07   ` [Qemu-trivial] [Qemu-devel] " Stefan Hajnoczi

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=CAHWZs7UG9NrAQKAtJN2+eQtbOOGFZrotdfSg3PhQ+FD_mRX4-w@mail.gmail.com \
    --to=cerbere@gmail.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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).