mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-07-04 03:58:59 +00:00
top: Improve 'clean' and 'distclean' makefile targets
This improves 'clean' and 'distclean' makefile target as follows: 1. Remove only .o, .a, .elf, and .bin files for 'clean' 2. Remove .dep in-addition to what 'clean' does for 'distclean' 3. Remove default build and install directory for 'distclean' Signed-off-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
parent
a4ce793121
commit
4c1d5a5d2d
1 changed files with 14 additions and 7 deletions
21
Makefile
21
Makefile
|
@ -284,20 +284,27 @@ install_firmwares: $(build_dir)/$(platform_subdir)/lib/libplatsbi.a $(build_dir)
|
|||
# Rule for "make clean"
|
||||
.PHONY: clean
|
||||
clean:
|
||||
ifeq ($(build_dir),$(CURDIR)/build)
|
||||
$(V)mkdir -p $(build_dir)
|
||||
$(if $(V), @echo " CLEAN $(build_dir)")
|
||||
$(V)find $(build_dir) -regex ".*\.\(o\|a\|elf\|bin\)" -type f -exec rm -rf {} +
|
||||
endif
|
||||
$(if $(V), @echo " RM <build_directory>/*.o")
|
||||
$(V)find $(build_dir) -type f -name "*.o" -exec rm -rf {} +
|
||||
$(if $(V), @echo " RM <build_directory>/*.a")
|
||||
$(V)find $(build_dir) -type f -name "*.a" -exec rm -rf {} +
|
||||
$(if $(V), @echo " RM <build_directory>/*.elf")
|
||||
$(V)find $(build_dir) -type f -name "*.elf" -exec rm -rf {} +
|
||||
$(if $(V), @echo " RM <build_directory>/*.bin")
|
||||
$(V)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} +
|
||||
|
||||
# Rule for "make distclean"
|
||||
.PHONY: distclean
|
||||
distclean:
|
||||
distclean: clean
|
||||
$(V)mkdir -p $(build_dir)
|
||||
$(if $(V), @echo " RM <build_directory>/*.dep")
|
||||
$(V)find $(build_dir) -type f -name "*.dep" -exec rm -rf {} +
|
||||
ifeq ($(build_dir),$(CURDIR)/build)
|
||||
$(if $(V), @echo " RM $(build_dir)")
|
||||
$(if $(V), @echo " RM <build_directory>")
|
||||
$(V)rm -rf $(build_dir)
|
||||
endif
|
||||
ifeq ($(install_dir),$(CURDIR)/install)
|
||||
$(if $(V), @echo " RM $(install_dir)")
|
||||
$(if $(V), @echo " RM <install_directory>")
|
||||
$(V)rm -rf $(install_dir)
|
||||
endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue