* ideas towards requiring VPATH build
@ 2019-10-11 21:28 Eric Blake
2019-10-14 14:23 ` Eric Blake
0 siblings, 1 reply; 2+ messages in thread
From: Eric Blake @ 2019-10-11 21:28 UTC (permalink / raw)
To: QEMU, Paolo Bonzini, Daniel P. Berrangé,
Peter Maydell, Markus Armbruster
I know we've talked about enforcing a VPATH build, but haven't yet
flipped the switch. This week, I've played with using a VPATH build (cd
qemu; mkdir -p build; cd ./build; ../configure ...; make ...), but find
my old habits of expecting an in-tree build to just work (cd qemu; make
...) hard to overcome. So this is what I've come up with: if you place
the following file in-tree, then any 'make ...' command you type in-tree
without using -C will have the same effect as if you had typed the same
command in the build directory, but without having to manually remember
to switch to the build directory.
Perhaps this can be a starting point for a patch to actually include
this file in qemu.git as part of the larger effort to force VPATH
builds, while still having the convenience of in-tree make working for
those who were used to it. (I places an echo and sleep in my file to
remind myself when I forgot to use the build directory, but that is not
mandatory if we want GNUmakefile stored in qemu.git).
Presumably, any full switch to force a VPATH build would also include
creating the build directory as needed (my hack assumes that it already
exists).
$ cat GNUmakefile
# Hack for redirecting while reminding myself to use distinct builddir
%: force
@echo 'changing directory to build...'
@sleep 2
@$(MAKE) -C build -f Makefile $(MAKECMDGOALS)
force: ;
GNUmakefile: ;
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ideas towards requiring VPATH build
2019-10-11 21:28 ideas towards requiring VPATH build Eric Blake
@ 2019-10-14 14:23 ` Eric Blake
0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2019-10-14 14:23 UTC (permalink / raw)
To: QEMU, Paolo Bonzini, Daniel P. Berrangé,
Peter Maydell, Markus Armbruster
On 10/11/19 4:28 PM, Eric Blake wrote:
> I know we've talked about enforcing a VPATH build, but haven't yet
> flipped the switch. This week, I've played with using a VPATH build (cd
> qemu; mkdir -p build; cd ./build; ../configure ...; make ...), but find
> my old habits of expecting an in-tree build to just work (cd qemu; make
> ...) hard to overcome. So this is what I've come up with: if you place
> the following file in-tree, then any 'make ...' command you type in-tree
> without using -C will have the same effect as if you had typed the same
> command in the build directory, but without having to manually remember
> to switch to the build directory.
>
> Perhaps this can be a starting point for a patch to actually include
> this file in qemu.git as part of the larger effort to force VPATH
> builds, while still having the convenience of in-tree make working for
> those who were used to it. (I places an echo and sleep in my file to
> remind myself when I forgot to use the build directory, but that is not
> mandatory if we want GNUmakefile stored in qemu.git).
>
> Presumably, any full switch to force a VPATH build would also include
> creating the build directory as needed (my hack assumes that it already
> exists).
>
> $ cat GNUmakefile
> # Hack for redirecting while reminding myself to use distinct builddir
> %: force
> @echo 'changing directory to build...'
> @sleep 2
> @$(MAKE) -C build -f Makefile $(MAKECMDGOALS)
> force: ;
> GNUmakefile: ;
Works for 'make all' or 'make check', but doesn't quite work for 'make'.
For that, I had to add:
ifeq ($(MAKECMDGOALS),)
recurse: all
endif
prior to the %: line (the name 'recurse' is not special, it merely has
to be something unlikely to be in the actual Makefile, and appear as the
first rule with a dependency on the name of the real first rule in
Makefile, so that when make is invoked without a target, we still end up
invoking the actual Makefile rather than our GNUmakefile shim claiming
that 'force' has nothing to do).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-14 14:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 21:28 ideas towards requiring VPATH build Eric Blake
2019-10-14 14:23 ` Eric Blake
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).