[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH 1/2] Makefile: distclean should c
Re: [Qemu-trivial] [Qemu-devel] [PATCH 1/2] Makefile: distclean should clean all possible targets
Tue, 26 Jul 2011 09:51:21 -0400
> 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"
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.
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u
> $@," GEN $@")
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.
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
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
Finished prerequisites of target file `i386-softmmu/config-devices.mak'.
`/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
cat: i386-softmmu/config-devices.mak: No such file or directory
<---- ***this is the error***
[Qemu-trivial] [PATCH 2/2] Makefile: delete config.log in distclean, Alexandre Raymond, 2011/07/25