All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] Makefile: Check for more dangling scratch files in out-of-tree builds
@ 2018-06-09 15:10 Philippe Mathieu-Daudé
  2018-06-15 12:30 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-06-09 15:10 UTC (permalink / raw)
  To: Markus Armbruster, Eric Blake, Thomas Huth, Michael S . Tsirkin,
	Peter Maydell
  Cc: Philippe Mathieu-Daudé, qemu-devel, Daniel P. Berrangé,
	Marc-André Lureau, qemu-trivial

It is easy to catch the generated 'config-host.mak' in the source
tree, however qemu-version.h and qemu-options.def are also generated
files and are hidden by .gitignore rules.

Improve the out-of-tree safety net rule added in d1bd2423a90,
by also checking for these two files.

This solves building issues with out-of-tree builds from a
source tree that has been built in:

- /qemu-version.h existing in source tree:

    /source/qemu/qemu-nbd.c: In function ‘version’:
    /source/qemu/qemu-nbd.c:133:6: error: expected ‘)’ before
    ‘QEMU_FULL_VERSION’
     "%s " QEMU_FULL_VERSION "\n"
          ^~~~~~~~~~~~~~~~~~
          )
    /source/qemu/qemu-nbd.c:133:3: error: format ‘%s’ expects a matching
    ‘char *’ argument [-Werror=format=]
     "%s " QEMU_FULL_VERSION "\n"
      ~^
    cc1: all warnings being treated as errors

- /qemu-options.def existing in source tree:

    /source/qemu/vl.c: In function ‘main’:
    /source/qemu/vl.c:3052:18: error: ‘QEMU_OPTION_blockdev’ undeclared
    (first use in this function); did you mean ‘QEMU_OPTION_clock’?
                 case QEMU_OPTION_blockdev:
                      ^~~~~~~~~~~~~~~~~~~~
                      QEMU_OPTION_clock
    /source/qemu/vl.c:3052:18: note: each undeclared identifier is reported
    only once for each function it appears in

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Since v1 http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg02254.html:
Peter noticed [1] those files already are in GENERATED_FILES

[1] http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg02338.html

 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 023b3437ec..521009964c 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,8 @@ endif
 # Check that we're not trying to do an out-of-tree build from
 # a tree that's been used for an in-tree build.
 ifneq ($(realpath $(SRC_PATH)),$(realpath .))
-ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
+scratch_files = config-host.mak qemu-version.h qemu-options.def
+ifneq ($(wildcard $(addprefix $(SRC_PATH)/,$(scratch_files))),)
 $(error This is an out of tree build but your source tree ($(SRC_PATH)) \
 seems to have been used for an in-tree build. You can fix this by running \
 "$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH v2] Makefile: Check for more dangling scratch files in out-of-tree builds
  2018-06-09 15:10 [Qemu-devel] [PATCH v2] Makefile: Check for more dangling scratch files in out-of-tree builds Philippe Mathieu-Daudé
@ 2018-06-15 12:30 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2018-06-15 12:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Markus Armbruster, Eric Blake, Thomas Huth, Michael S . Tsirkin,
	QEMU Developers, Daniel P. Berrangé,
	Marc-André Lureau, QEMU Trivial

On 9 June 2018 at 16:10, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> It is easy to catch the generated 'config-host.mak' in the source
> tree, however qemu-version.h and qemu-options.def are also generated
> files and are hidden by .gitignore rules.
>
> Improve the out-of-tree safety net rule added in d1bd2423a90,
> by also checking for these two files.
>
> This solves building issues with out-of-tree builds from a
> source tree that has been built in:
>
> - /qemu-version.h existing in source tree:
>
>     /source/qemu/qemu-nbd.c: In function ‘version’:
>     /source/qemu/qemu-nbd.c:133:6: error: expected ‘)’ before
>     ‘QEMU_FULL_VERSION’
>      "%s " QEMU_FULL_VERSION "\n"
>           ^~~~~~~~~~~~~~~~~~
>           )
>     /source/qemu/qemu-nbd.c:133:3: error: format ‘%s’ expects a matching
>     ‘char *’ argument [-Werror=format=]
>      "%s " QEMU_FULL_VERSION "\n"
>       ~^
>     cc1: all warnings being treated as errors
>
> - /qemu-options.def existing in source tree:
>
>     /source/qemu/vl.c: In function ‘main’:
>     /source/qemu/vl.c:3052:18: error: ‘QEMU_OPTION_blockdev’ undeclared
>     (first use in this function); did you mean ‘QEMU_OPTION_clock’?
>                  case QEMU_OPTION_blockdev:
>                       ^~~~~~~~~~~~~~~~~~~~
>                       QEMU_OPTION_clock
>     /source/qemu/vl.c:3052:18: note: each undeclared identifier is reported
>     only once for each function it appears in

This commit message should I think also mention that it is
only needed to deal with source trees that have these stale
files from failed build attempts that predate commit
428952cfa966f5af8. Otherwise the existing test on config-host.mak
is sufficient.

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Since v1 http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg02254.html:
> Peter noticed [1] those files already are in GENERATED_FILES
>
> [1] http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg02338.html
>
>  Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 023b3437ec..521009964c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -55,7 +55,8 @@ endif
>  # Check that we're not trying to do an out-of-tree build from
>  # a tree that's been used for an in-tree build.
>  ifneq ($(realpath $(SRC_PATH)),$(realpath .))
> -ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
> +scratch_files = config-host.mak qemu-version.h qemu-options.def
> +ifneq ($(wildcard $(addprefix $(SRC_PATH)/,$(scratch_files))),)
>  $(error This is an out of tree build but your source tree ($(SRC_PATH)) \
>  seems to have been used for an in-tree build. You can fix this by running \
>  "$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
> --
> 2.17.1

Otherwise
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-15 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-09 15:10 [Qemu-devel] [PATCH v2] Makefile: Check for more dangling scratch files in out-of-tree builds Philippe Mathieu-Daudé
2018-06-15 12:30 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.