Skip to contentSkip to conversation

tools build: Fix feature detect clean for out of source builds

PATCH Applied James Clark 3 participants 3 messages Aug 16, 2021 – Sep 1, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools build: Fix feature detect clean for out of source builds

Currently the clean target when using O= isn't cleaning the feature detect output. This is because O= and OUTPUT= are set to canonical paths. For example in tools/perf/Makefile:

  FULL_O := $(shell cd $(PWD); readlink -f $(O) || echo $(O))

This means that OUTPUT ends in a / and most usages prepend it to a file without adding an extra /. This line that was changed adds an extra / before the 'feature' folder but not to the end, resulting in a clean command like this:

rm -f /tmp/build//featuretest-all.bin ...

After the change the clean command looks like this:

rm -f /tmp/build/feature/test-all.bin ...

---
 tools/build/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/Makefile +1 -1
index 5ed41b96fcde..6f11e6fc9ffe 100644
@@ -32,7 +32,7 @@ all: $(OUTPUT)fixdep
 
 # Make sure there's anything to clean,
 # feature contains check for existing OUTPUT
-TMP_O := $(if $(OUTPUT),$(OUTPUT)/feature,./)
+TMP_O := $(if $(OUTPUT),$(OUTPUT)feature/,./)
 
 clean:
 	$(call QUIET_CLEAN, fixdep)
Signature · 1 line
2.28.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · James Clark

Currently the clean target when using O= isn't cleaning the feature detect output. This is because O= and OUTPUT= are set to canonical paths. For example in tools/perf/Makefile:

  FULL_O := $(shell cd $(PWD); readlink -f $(O) || echo $(O))

This means that OUTPUT ends in a / and most usages prepend it to a file without adding an extra /. This line that was changed adds an extra / before the 'feature' folder but not to the end, resulting in a clean command like this:

Quoted 7 lines

rm -f /tmp/build//featuretest-all.bin ...

After the change the clean command looks like this:

rm -f /tmp/build/feature/test-all.bin ...

nice catch!

thanks,
jirka

Quoted 20 lines
---
 tools/build/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/Makefile +1 -1
index 5ed41b96fcde..6f11e6fc9ffe 100644
@@ -32,7 +32,7 @@ all: $(OUTPUT)fixdep
 
 # Make sure there's anything to clean,
 # feature contains check for existing OUTPUT
-TMP_O := $(if $(OUTPUT),$(OUTPUT)/feature,./)
+TMP_O := $(if $(OUTPUT),$(OUTPUT)feature/,./)
 
 clean:
 	$(call QUIET_CLEAN, fixdep)
Signature · 1 line
2.28.0
#2 lore raw

Em Tue, Aug 31, 2021 at 08:46:10PM +0200, Jiri Olsa escreveu:

Quoted 16 lines · James Clark
Quoted 15 lines

Currently the clean target when using O= isn't cleaning the feature detect output. This is because O= and OUTPUT= are set to canonical paths. For example in tools/perf/Makefile:

  FULL_O := $(shell cd $(PWD); readlink -f $(O) || echo $(O))

This means that OUTPUT ends in a / and most usages prepend it to a file without adding an extra /. This line that was changed adds an extra / before the 'feature' folder but not to the end, resulting in a clean command like this:

rm -f /tmp/build//featuretest-all.bin ...

After the change the clean command looks like this:

Quoted 7 lines
Quoted 3 lines

rm -f /tmp/build/feature/test-all.bin ...

nice catch!

Thanks, applied and added:

Fixes 762323eb39a257c3 ("perf build: Move feature cleanup under tools/build")

- Arnaldo