[PATCH 1/3] Makefile: clean auto-generated *.c files properly

Ivan Orlov ivan.orlov0322 at gmail.com
Mon Apr 1 14:34:36 PDT 2024


Currently, `make clean` doesn't remove auto-generated .c files in the
`build/` directory. It means that we don't have a reliable way of
regenerating these files except from removing the `build/` directory
manually.

Update the `clean` target in order to remove these files as well.

In the discussion of the "[PATCH v2 3/5] Makefile: clean '.c' files
generated by carray", Andrew Jones <ajones at ventanamicro.com> suggested
placing the auto-generated .c files into the `build/generated/` folder.
However, I believe it may not be necessary as in fact all of the files
in `build/` are auto-generated.

Signed-off-by: Ivan Orlov <ivan.orlov0322 at gmail.com>
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index 680c19a..4519277 100644
--- a/Makefile
+++ b/Makefile
@@ -684,6 +684,8 @@ clean:
 	$(CMD_PREFIX)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} +
 	$(if $(V), @echo " RM        $(build_dir)/*.dtb")
 	$(CMD_PREFIX)find $(build_dir) -type f -name "*.dtb" -exec rm -rf {} +
+	$(if $(V), @echo " RM        $(build_dir)/*.c")
+	$(CMD_PREFIX)find $(build_dir) -type f -name "*.c" -exec rm -rf {} +
 
 # Rule for "make distclean"
 .PHONY: distclean
-- 
2.34.1




More information about the opensbi mailing list