Skip to contentSkip to conversation

tools/counter: Makefile: Replace rmdir by rm to avoid make,clean failure

PATCH In review Anh Tuan Phan 2 participants 3 messages Jul 16, 2023 – Jul 23, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools/counter: Makefile: Replace rmdir by rm to avoid make,clean failure

Use rm -df instead of rmdir -p since rmdir requires the directory exist so it causes "make -C tools clean" failed if someone only builds other tools but not counter.

Fixes 228354ed692f ("tools/counter: Makefile: Remove lingering

'include' directories on make clean")

---
Changes from v1:
- Use rm -df instead of checking the directory exists
- Add Fixes tag
- Update the patch title
Reference:
- v1:
https://lore.kernel.org/all/[email protected]/

---
 tools/counter/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/counter/Makefile +2 -1
index a0f4cab71fe5..b2c2946f44c9 100644
@@ -40,7 +40,8 @@ $(OUTPUT)counter_example: $(COUNTER_EXAMPLE)
 clean:
 	rm -f $(ALL_PROGRAMS)
 	rm -rf $(OUTPUT)include/linux/counter.h
-	rmdir -p $(OUTPUT)include/linux
+	rm -df $(OUTPUT)include/linux
+	rm -df $(OUTPUT)include
 	find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
 
 install: $(ALL_PROGRAMS)
Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · Anh Tuan Phan

Use rm -df instead of rmdir -p since rmdir requires the directory exist so it causes "make -C tools clean" failed if someone only builds other tools but not counter.

Fixes 228354ed692f ("tools/counter: Makefile: Remove lingering

'include' directories on make clean")

Hi Anh,

Tags should span a single line even if they are long. This is minor enough that I will clean it as I pick up the patch so no need to worry about it this time. In the future, run script/checkpatch.pl on your patches to catch these type of mistakes that are easy to miss.

I'll queue this patch for the counter-fixes branch.

Thanks,

William Breathitt Gray

Quoted 29 lines

---
Changes from v1:
- Use rm -df instead of checking the directory exists
- Add Fixes tag
- Update the patch title
Reference:
- v1:
https://lore.kernel.org/all/[email protected]/

---
 tools/counter/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/counter/Makefile +2 -1
index a0f4cab71fe5..b2c2946f44c9 100644
@@ -40,7 +40,8 @@ $(OUTPUT)counter_example: $(COUNTER_EXAMPLE)
 clean:
 	rm -f $(ALL_PROGRAMS)
 	rm -rf $(OUTPUT)include/linux/counter.h
-	rmdir -p $(OUTPUT)include/linux
+	rm -df $(OUTPUT)include/linux
+	rm -df $(OUTPUT)include
 	find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
 
 install: $(ALL_PROGRAMS)
Signature · 1 line
2.34.1
#2 lore raw
Quoted 15 lines · William Breathitt Gray
Quoted 6 lines · Anh Tuan Phan

Use rm -df instead of rmdir -p since rmdir requires the directory exist so it causes "make -C tools clean" failed if someone only builds other tools but not counter.

Fixes 228354ed692f ("tools/counter: Makefile: Remove lingering

'include' directories on make clean")

Hi Anh,

Tags should span a single line even if they are long. This is minor enough that I will clean it as I pick up the patch so no need to worry about it this time. In the future, run script/checkpatch.pl on your patches to catch these type of mistakes that are easy to miss.

Quoted 6 lines

I'll queue this patch for the counter-fixes branch.

Thanks,

William Breathitt Gray

Thanks for helping me correct the patch, will run the script in the future.

Best,
Anh

Quoted 29 lines
Quoted 29 lines

---
Changes from v1:
- Use rm -df instead of checking the directory exists
- Add Fixes tag
- Update the patch title
Reference:
- v1:
https://lore.kernel.org/all/[email protected]/

---
 tools/counter/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/counter/Makefile +2 -1
index a0f4cab71fe5..b2c2946f44c9 100644
@@ -40,7 +40,8 @@ $(OUTPUT)counter_example: $(COUNTER_EXAMPLE)
 clean:
 	rm -f $(ALL_PROGRAMS)
 	rm -rf $(OUTPUT)include/linux/counter.h
-	rmdir -p $(OUTPUT)include/linux
+	rm -df $(OUTPUT)include/linux
+	rm -df $(OUTPUT)include
 	find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
 
 install: $(ALL_PROGRAMS)
Signature · 1 line
2.34.1