diff options
-rw-r--r-- | rules/post/ptxd_make_world_clean.make | 34 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_clean.sh | 50 |
2 files changed, 84 insertions, 0 deletions
diff --git a/rules/post/ptxd_make_world_clean.make b/rules/post/ptxd_make_world_clean.make new file mode 100644 index 000000000..c8d50d01c --- /dev/null +++ b/rules/post/ptxd_make_world_clean.make @@ -0,0 +1,34 @@ +# -*-makefile-*- +# +# Copyright (C) 2010 by Michael Olbrich <m.olbrich@pengutronix.de> +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +%_clean: $(STATEDIR)/%.clean + @# empty rule + +$(STATEDIR)/%.clean: FORCE + @$(call targetinfo) + @$(call world/clean, $(PTX_MAP_TO_PACKAGE_$(*))) + +# +# clean +# +world/clean = \ + $(call world/env, $1) \ + ptxd_make_world_clean + +# +# clean_pkg +# +# remove all temporary files for the current package +# +clean_pkg = \ + $(call world/clean $(PTX_MAP_TO_PACKAGE_$(*))) + +# vim600:set foldmethod=marker: +# vim600:set syntax=make: diff --git a/scripts/lib/ptxd_make_world_clean.sh b/scripts/lib/ptxd_make_world_clean.sh new file mode 100644 index 000000000..8d098ca30 --- /dev/null +++ b/scripts/lib/ptxd_make_world_clean.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Copyright (C) 2010 by Michael Olbrich <m.olbrich@pengutronix.de> +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# clean +# +ptxd_make_world_clean() { + ptxd_make_world_init && + + if [ -f "${ptx_state_dir}/${pkg_label}.xpkg.map" ]; then + echo "Deleting ipks:" + for name in `cat "${ptx_state_dir}/${pkg_label}.xpkg.map" 2>/dev/null`; do + ls "${ptx_pkg_dir}/${name}"_*.ipk + rm -f "${ptx_pkg_dir}/${name}"_*.ipk + done + echo + fi + if [ -n "`ls "${ptx_state_dir}/${pkg_label}".* 2> /dev/null`" ]; then + echo "Deleting stage files:" + ls "${ptx_state_dir}/${pkg_label}".* + rm -f "${ptx_state_dir}/${pkg_label}".* + echo + fi + if [ -d "${pkg_dir}" ]; then + echo "Deleting src dir:" + echo "${pkg_dir}" + rm -rf "${pkg_dir}" + echo + fi + if [ -d "${pkg_build_dir}" ]; then + echo "Deleting build dir:" + echo "${pkg_build_dir}" + rm -rf "${pkg_build_dir}" + echo + fi + if [ -d "${pkg_pkg_dir}" ]; then + echo "Deleting pkg dir:" + echo "${pkg_pkg_dir}" + rm -rf "${pkg_pkg_dir}" + echo + fi +} +export -f ptxd_make_world_clean + |