[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] [trivial] Simpler handling of tracetool-gen
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] [trivial] Simpler handling of tracetool-generated files in makefiles |
Date: |
Wed, 18 Apr 2012 14:10:03 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sat, Apr 14, 2012 at 12:19:08AM +0200, Lluís Vilanova wrote:
> Adds 'tracetool-gen' to generate files with tracetool into a temporary file,
> and
> 'tracetool-ci' to "commit" the generation from the temporaty file into the
> actual destination file if there were any changes in the produced file.
>
> Signed-off-by: Lluís Vilanova <address@hidden>
> ---
> Makefile.objs | 19 +++++++++----------
> rules.mak | 17 +++++++++++++++++
> 2 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/Makefile.objs b/Makefile.objs
> index 6d6f24d..b98e905 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -373,18 +373,17 @@ libdis-$(CONFIG_LM32_DIS) += lm32-dis.o
> # trace
>
> ifeq ($(TRACE_BACKEND),dtrace)
> -trace.h: trace.h-timestamp trace-dtrace.h
> -else
> -trace.h: trace.h-timestamp
> +TRACE_H_EXTRA_DEPS=trace-dtrace.h
> endif
> +trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS)
I like this.
> trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
> - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py
> --format=h --backend=$(TRACE_BACKEND) < $< > $@," GEN trace.h")
> - @cmp -s $@ trace.h || cp $@ trace.h
> + $(call tracetool-gen,h,$(TRACE_BACKEND))
> + $(call tracetool-ci)
Here I don't think it's worth introducing an abstraction. While there
is a pattern I think the abstraction actually hides what is going on
rather than being useful. The macros are hiding output generation, I
find that especially troubling because you can't really tell what is
going to happen. It's clearer to leave these statements open coded.
Stefan