qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [Qemu-devel] [PATCH 1/2] Makefile: distclean should c


From: Alexandre Raymond
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

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 via email to

[Prev in Thread] Current Thread [Next in Thread]