Skip to contentSkip to conversation

trace: ensure $(tracetool-y) is defined in top level makefile

PATCH Superseded Daniel P. Berrange 2 participants 3 messages Mar 15, 2017 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace: ensure $(tracetool-y) is defined in top level makefile

The build rules for trace files have a dependancy on $(tracetool-y). This variable populated in the trace/Makefile.objs file and thus its definition gets pulled into the top level makefile. This happens too late in the process though, so by the time $(tracetool-y) is defined, make has already evaluated $(tracetool-y) in the dependancies and found it to be empty. The result is that when the tracetool source is changed, the generated files are not rebuilt. The solution is to define the variable in the top level makefile too

---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)
Makefile +3 -0
index 1c4c04f..dffc74b 100644
@@ -85,6 +85,9 @@ GENERATED_SOURCES += $(TRACE_SOURCES)
 
 trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
 
+tracetool-y = $(SRC_PATH)/scripts/tracetool.py
+tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
+
 %/trace.h: %/trace.h-timestamp
 	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
 %/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y)
Signature · 1 line
2.9.3
#1 lore raw
Quoted 9 lines · Daniel P. Berrange

The build rules for trace files have a dependancy on $(tracetool-y). This variable populated in the trace/Makefile.objs file and thus its definition gets pulled into the top level makefile. This happens too late in the process though, so by the time $(tracetool-y) is defined, make has already evaluated $(tracetool-y) in the dependancies and found it to be empty. The result is that when the tracetool source is changed, the generated files are not rebuilt. The solution is to define the variable in the top level makefile too

Quoted 4 lines
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

Does this mean the definitions in trace/Makefile.objs are now redundant and can be omitted?

Makefile GENERATED_SOURCES += $(TRACE_SOURCES) · line 89

Quoted 11 lines
Makefile +2 -0
index 1c4c04f..dffc74b 100644
@@ -85,6 +85,9 @@ GENERATED_SOURCES += $(TRACE_SOURCES)
 
 trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
 
+tracetool-y = $(SRC_PATH)/scripts/tracetool.py
+tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")

Should this also include the comment currently in trace/Makefile.objs:

######################################################################

# tracetool source files
# Every rule that invokes tracetool must depend on this so code is
regenerated
# if tracetool itself changes.

But it certainly looks like you're on the right track for fixing the issue I ran into.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
Quoted 10 lines · Eric Blake
Quoted 9 lines · Daniel P. Berrange

The build rules for trace files have a dependancy on $(tracetool-y). This variable populated in the trace/Makefile.objs file and thus its definition gets pulled into the top level makefile. This happens too late in the process though, so by the time $(tracetool-y) is defined, make has already evaluated $(tracetool-y) in the dependancies and found it to be empty. The result is that when the tracetool source is changed, the generated files are not rebuilt. The solution is to define the variable in the top level makefile too

Quoted 7 lines
Quoted 4 lines
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

Does this mean the definitions in trace/Makefile.objs are now redundant and can be omitted?

Hmm, I'm not sure, but quite possibly true.

Quoted 15 lines

Makefile GENERATED_SOURCES += $(TRACE_SOURCES) · line 89

Quoted 12 lines
Makefile +2 -0
index 1c4c04f..dffc74b 100644
@@ -85,6 +85,9 @@ GENERATED_SOURCES += $(TRACE_SOURCES)
 
 trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
 
+tracetool-y = $(SRC_PATH)/scripts/tracetool.py
+tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")

Should this also include the comment currently in trace/Makefile.objs:

Quoted 8 lines

######################################################################

# tracetool source files
# Every rule that invokes tracetool must depend on this so code is
regenerated
# if tracetool itself changes.

But it certainly looks like you're on the right track for fixing the issue I ran into.

IMHO such comments are pointless - they're just stating the obvious.

Regards,
Daniel

Signature · 3 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|