STAMP_PREPARED:=$(PREV_STAMP_PREPARED)
CONFIG_AUTOREBUILD:=
else
- STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))$(call confvar,$(PKG_PREPARED_DEPENDS)))
+ STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(PKG_PREPARED_DEPENDS)))
endif
STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
STAMP_CONFIGURED_WILDCARD=$(PKG_BUILD_DIR)/.configured_*
include $(INCLUDE_DIR)/package-bin.mk
include $(INCLUDE_DIR)/autotools.mk
+_pkg_target:=$(if $(QUILT),,.)
+
override MAKEFLAGS=
CONFIG_SITE:=$(INCLUDE_DIR)/site/$(ARCH)
CUR_MAKEFILE:=$(filter-out Makefile,$(firstword $(MAKEFILE_LIST)))
$(STAMP_PREPARED): $(STAMP_PREPARED_DEPENDS)
@-rm -rf $(PKG_BUILD_DIR)
@mkdir -p $(PKG_BUILD_DIR)
+ touch $$@_check
$(foreach hook,$(Hooks/Prepare/Pre),$(call $(hook))$(sep))
$(Build/Prepare)
$(foreach hook,$(Hooks/Prepare/Post),$(call $(hook))$(sep))
$(call Build/Exports,$(STAMP_BUILT))
$(STAMP_BUILT): $(STAMP_CONFIGURED) $(STAMP_BUILT_DEPENDS)
+ rm -f $$@
+ touch $$@_check
$(foreach hook,$(Hooks/Compile/Pre),$(call $(hook))$(sep))
$(Build/Compile)
$(foreach hook,$(Hooks/Compile/Post),$(call $(hook))$(sep))
touch $$@
ifdef Build/InstallDev
- .compile: $(STAMP_INSTALLED)
+ $(_pkg_target)compile: $(STAMP_INSTALLED)
endif
- .prepare: $(STAMP_PREPARED)
- .configure: $(STAMP_CONFIGURED)
- .dist: $(STAMP_CONFIGURED)
- .distcheck: $(STAMP_CONFIGURED)
+ $(_pkg_target)prepare: $(STAMP_PREPARED)
+ $(_pkg_target)configure: $(STAMP_CONFIGURED)
+ $(_pkg_target)dist: $(STAMP_CONFIGURED)
+ $(_pkg_target)distcheck: $(STAMP_CONFIGURED)
+
+ ifneq ($(CONFIG_AUTOREMOVE),)
+ compile:
+ -touch $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
+ $(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
+ $(XARGS) rm -rf
+ endif
endef
define Build/DefaultTargets
.install: .compile
install: compile
-clean: FORCE
+force-clean-build: FORCE
+ rm -rf $(PKG_BUILD_DIR)
+
+clean-build: $(if $(wildcard $(PKG_BUILD_DIR)/.autoremove),force-clean-build)
+
+clean: force-clean-build
$(CleanStaging)
$(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST))
$(Build/Clean)
rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) $(STAGING_DIR_HOST)/packages/$(STAGING_FILES_LIST)
- rm -rf $(PKG_BUILD_DIR)
dist:
$(Build/Dist)