summaryrefslogtreecommitdiffstats
path: root/core/cleanbuild.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2010-03-03 10:45:14 -0800
committerYing Wang <wangying@google.com>2010-03-03 13:08:28 -0800
commitfa9ae7bbbe4412893d585a92b12f17b806a58d62 (patch)
treeebc86533b25d613d42537308578408c0f97d838b /core/cleanbuild.mk
parentb7aa96bf8e5cb35fe5c517d62b6f7fca0a5d9539 (diff)
downloadbuild-fa9ae7bbbe4412893d585a92b12f17b806a58d62.zip
build-fa9ae7bbbe4412893d585a92b12f17b806a58d62.tar.gz
build-fa9ae7bbbe4412893d585a92b12f17b806a58d62.tar.bz2
Decentralizes cleanspecs.
After this change, you should add-clean-step at the end of CleanSpec.mk in your project, instead of the centralized cleanspecs.mk in build/core.
Diffstat (limited to 'core/cleanbuild.mk')
-rw-r--r--core/cleanbuild.mk24
1 files changed, 18 insertions, 6 deletions
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index a753554..7e68d6f 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -16,28 +16,40 @@
INTERNAL_CLEAN_STEPS :=
# Builds up a list of clean steps. Creates a unique
-# id for each step by taking INTERNAL_CLEAN_BUILD_VERSION
+# id for each step by taking makefile path, INTERNAL_CLEAN_BUILD_VERSION
# and appending an increasing number of '@' characters.
#
# $(1): shell command to run
+# $(2): indicate to not use makefile path as part of step id if not empty.
+# $(2) should only be used in build/core/cleanspec.mk: just for compatibility.
define _add-clean-step
$(if $(strip $(INTERNAL_CLEAN_BUILD_VERSION)),, \
$(error INTERNAL_CLEAN_BUILD_VERSION not set))
- $(eval _acs_id := $(strip $(lastword $(INTERNAL_CLEAN_STEPS))))
- $(if $(_acs_id),,$(eval _acs_id := $(INTERNAL_CLEAN_BUILD_VERSION)))
- $(eval _acs_id := $(_acs_id)@)
+ $(eval _acs_makefile_prefix := $(lastword $(MAKEFILE_LIST)))
+ $(eval _acs_makefile_prefix := $(subst /,_,$(_acs_makefile_prefix)))
+ $(eval _acs_makefile_prefix := $(subst .,-,$(_acs_makefile_prefix)))
+ $(eval _acs_makefile_prefix := $(_acs_makefile_prefix)_acs)
+ $(if $($(_acs_makefile_prefix)),,\
+ $(eval $(_acs_makefile_prefix) := $(INTERNAL_CLEAN_BUILD_VERSION)))
+ $(eval $(_acs_makefile_prefix) := $($(_acs_makefile_prefix))@)
+ $(if $(strip $(2)),$(eval _acs_id := $($(_acs_makefile_prefix))),\
+ $(eval _acs_id := $(_acs_makefile_prefix)$($(_acs_makefile_prefix))))
$(eval INTERNAL_CLEAN_STEPS += $(_acs_id))
$(eval INTERNAL_CLEAN_STEP.$(_acs_id) := $(1))
$(eval _acs_id :=)
+ $(eval _acs_makefile_prefix :=)
endef
define add-clean-step
-$(if $(call _add-clean-step,$(1)),)
+$(eval # for build/core/cleanspec.mk, dont use makefile path as part of step id) \
+$(if $(filter %/cleanspec.mk,$(lastword $(MAKEFILE_LIST))),\
+ $(eval $(call _add-clean-step,$(1),true)),\
+ $(eval $(call _add-clean-step,$(1))))
endef
# Defines INTERNAL_CLEAN_BUILD_VERSION and the individual clean steps.
# cleanspec.mk is outside of the core directory so that more people
# can have permission to touch it.
-include build/cleanspec.mk
+include $(BUILD_SYSTEM)/cleanspec.mk
INTERNAL_CLEAN_BUILD_VERSION := $(strip $(INTERNAL_CLEAN_BUILD_VERSION))
# If the clean_steps.mk file is missing (usually after a clean build)