diff --git a/src/runtime-rs/Makefile b/src/runtime-rs/Makefile index f492d1d334..7d49e7b479 100644 --- a/src/runtime-rs/Makefile +++ b/src/runtime-rs/Makefile @@ -452,12 +452,15 @@ optimize: $(SOURCES) | show-summary show-header @RUSTFLAGS="-C link-arg=-s $(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE) $(EXTRA_RUSTFEATURES) ##TARGET clean: clean build -clean: +clean: clean-generated-files @cargo clean - @rm -f $(GENERATED_FILES) @rm -f tarpaulin-report.html @rm -f $(CONFIGS) +##TARGET clean-generated-files: clean generated files +clean-generated-files: + @rm -f $(GENERATED_FILES) + vendor: @cargo vendor diff --git a/src/runtime/Makefile b/src/runtime/Makefile index c9cf7ac584..2d96cd3baa 100644 --- a/src/runtime/Makefile +++ b/src/runtime/Makefile @@ -879,15 +879,16 @@ vendor: handle_vendor static-checks-build: $(GENERATED_FILES) -clean: +clean: clean-generated-files $(QUIET_CLEAN)rm -f \ - $(CONFIGS) \ - $(GENERATED_FILES) \ $(MONITOR) \ $(SHIMV2) \ $(TARGET) \ .git-commit .git-commit.tmp +clean-generated-files: + $(QUIET_CLEAN)rm -f $(GENERATED_FILES) + show-usage: show-header @printf "• Overview:\n" @printf "\n" @@ -904,6 +905,7 @@ show-usage: show-header @printf "\tfast-test : run tests with failfast option.\n" @printf "\tcheck : run code checks.\n" @printf "\tclean : remove built files.\n" + @printf "\tclean-generated-files : remove generated files.\n" @printf "\tcontainerd-shim-v2 : only build containerd shim v2.\n" @printf "\tcoverage : run coverage tests.\n" @printf "\tdefault : same as 'make build' (or just 'make').\n" diff --git a/tools/packaging/static-build/shim-v2/build.sh b/tools/packaging/static-build/shim-v2/build.sh index 8fc2f7bea6..f37cb91f40 100755 --- a/tools/packaging/static-build/shim-v2/build.sh +++ b/tools/packaging/static-build/shim-v2/build.sh @@ -62,7 +62,8 @@ sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ --env CC="${CC}" \ -w "${repo_root_dir}/src/runtime-rs" \ "${container_image}" \ - bash -c "git config --global --add safe.directory ${repo_root_dir} && make PREFIX=${PREFIX} QEMUCMD=qemu-system-${arch}" + bash -c "git config --global --add safe.directory ${repo_root_dir} && \ + make clean-generated-files && make PREFIX=${PREFIX} QEMUCMD=qemu-system-${arch}" sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ --env CROSS_BUILD=${CROSS_BUILD} \ @@ -77,7 +78,8 @@ sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ -w "${repo_root_dir}/src/runtime" \ "${container_image}" \ - bash -c "git config --global --add safe.directory ${repo_root_dir} && make PREFIX=${PREFIX} QEMUCMD=qemu-system-${arch} ${EXTRA_OPTS}" + bash -c "git config --global --add safe.directory ${repo_root_dir} && \ + make clean-generated-files && make PREFIX=${PREFIX} QEMUCMD=qemu-system-${arch} ${EXTRA_OPTS}" sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ -w "${repo_root_dir}/src/runtime" \