Linux Kernel Mentees list
 help / color / mirror / Atom feed
* [PATCH] tools/counter: Add checking directory exists for make clean
@ 2023-07-07 14:08 Anh Tuan Phan
  2023-07-10  1:07 ` William Breathitt Gray
  2023-07-13 19:42 ` Shuah Khan
  0 siblings, 2 replies; 6+ messages in thread
From: Anh Tuan Phan @ 2023-07-07 14:08 UTC (permalink / raw)
  To: william.gray, william.gray, linux-kernel-mentees

rmdir requires the directory exist so it causes "make -C tools clean"
failed if someone only builds other tools but not counter. This commit
adds checking the directory exist before doing rmdir.

Signed-off-by: Anh Tuan Phan <tuananhlfc@gmail.com>
---
 tools/counter/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/counter/Makefile b/tools/counter/Makefile
index a0f4cab71fe5..2907f3b3094b 100644
--- a/tools/counter/Makefile
+++ b/tools/counter/Makefile
@@ -40,7 +40,9 @@ $(OUTPUT)counter_example: $(COUNTER_EXAMPLE)
 clean:
 	rm -f $(ALL_PROGRAMS)
 	rm -rf $(OUTPUT)include/linux/counter.h
-	rmdir -p $(OUTPUT)include/linux
+	@if [ -d $(OUTPUT)include/linux ]; then \
+		rmdir -p $(OUTPUT)include/linux; \
+	fi
 	find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete

 install: $(ALL_PROGRAMS)
-- 
2.34.1
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-14 22:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-07 14:08 [PATCH] tools/counter: Add checking directory exists for make clean Anh Tuan Phan
2023-07-10  1:07 ` William Breathitt Gray
2023-07-14 13:57   ` Anh Tuan Phan
2023-07-14 11:34     ` William Breathitt Gray
2023-07-13 19:42 ` Shuah Khan
2023-07-14 13:59   ` Anh Tuan Phan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox