summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2018-12-26 08:36:54 +0300
committerAnup Patel <anup@brainfault.org>2018-12-27 07:00:12 +0300
commit4c1d5a5d2dad51a90d2617cd9f4187e6eb8f4159 (patch)
treefa059c6868fe3a8bb5e7228b73231569786ce141 /Makefile
parenta4ce7931212dd71af0b1e30379eddfa4adac21f7 (diff)
downloadopensbi-4c1d5a5d2dad51a90d2617cd9f4187e6eb8f4159.tar.xz
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>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 14 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 33f4de6..3464565 100644
--- a/Makefile
+++ b/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