Stefan Hajnoczi writes:

> Patches that change tracetool can break the build if old build output
> files are lying around.

> This happens because the Makefile does not specify dependencies on
> tracetool.  The build will use old object files that do not match the
> current source code.

> Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
> ---
>  trace/Makefile.objs | 32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)

> diff --git a/trace/Makefile.objs b/trace/Makefile.objs
> index 73bec38..ed2ca38 100644
> --- a/trace/Makefile.objs
> +++ b/trace/Makefile.objs
> @@ -1,12 +1,22 @@
>  # -*- mode: makefile -*-
 
>  ######################################################################
> +# tracetool source files
> +# Every rule that invokes tracetool must depend on this so code is 
> regenerated
> +# if tracetool itself changes.
> +
> +tracetool-y = $(SRC_PATH)/scripts/tracetool.py
> +tracetool-y += $(SRC_PATH)/scripts/tracetool/*.py
> +tracetool-y += $(SRC_PATH)/scripts/tracetool/backend/*.py
> +tracetool-y += $(SRC_PATH)/scripts/tracetool/format/*.py

If 'find' is an acceptable build dependency, I'd rather use this to avoid
missing future sub-directories:

  tracetool-y = $(SRC_PATH)/scripts/tracetool.py
  tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -path "*.py")

If that's not acceptable, I'd suggest forcing expansion in case the variable is
used somewhere else in the future (besides targets, which are always expanded):

  tracetool-y = $(SRC_PATH)/scripts/tracetool.py
  tracetool-y += $(wildcard $(SRC_PATH)/scripts/tracetool/*.py)
  tracetool-y += $(wildcard $(SRC_PATH)/scripts/tracetool/backend/*.py)
  tracetool-y += $(wildcard $(SRC_PATH)/scripts/tracetool/format/*.py)

BTW, this was a much needed fix. I ran into problems with this and never even
thought about fixing it :)


Thanks,
  Lluis

-- 
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth

Reply via email to