build: add option to delete intermediate files

Add option to remove intermediate files to save space and remove
clutter.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-10-20 14:31:56 -04:00
parent e6dfae0fea
commit fdbf2dbd2b
2 changed files with 17 additions and 0 deletions

View file

@ -1153,6 +1153,17 @@ if(CONFIG_BUILD_OUTPUT_BIN)
endif()
endif()
# Cleanup intermediate files
if(CONFIG_CLEANUP_INTERMEDIATE_FILES)
list(APPEND
post_build_commands
COMMAND
# This file can be very large in some cases, delete it as we do not need it.
${CMAKE_COMMAND} -E remove ${ZEPHYR_PREBUILT_EXECUTABLE}.elf
)
endif()
if(CONFIG_BUILD_OUTPUT_S19)
get_property(elfconvert_formats TARGET bintools PROPERTY elfconvert_formats)
if(srec IN_LIST elfconvert_formats)

View file

@ -295,6 +295,12 @@ config OUTPUT_PRINT_MEMORY_USAGE
ram_report and
https://sourceware.org/binutils/docs/ld/MEMORY.html
config CLEANUP_INTERMEDIATE_FILES
bool "Remove all intermediate files"
help
Delete intermediate files to save space and cleanup clutter resulting
from the build process.
config BUILD_NO_GAP_FILL
bool "Don't fill gaps in generated hex/bin/s19 files."