2 # Copyright (C) 2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 # define a dependency on a subtree
10 # 2: directory dependency
11 # 3: tempfile for file listings
14 DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*"
16 find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | mkhash md5
23 check-depends: $(2)_check
25 ifneq ($(wildcard $(2)),)
28 $(call find_md5,$(1),$(4)) > $(3).1; \
29 { [ \! -f "$(3)" ] || diff $(3) $(3).1 >/dev/null; } && \
32 [ -f "$(2)_check.1" ] && mv "$(2)_check.1"; \
33 $(TOPDIR)/scripts/timestamp.pl $(DEP_FINDPARAMS) $(4) -n $(2) $(1) && { \
34 $(call debug_eval,$(SUBDIR),r,echo "No need to rebuild $(2)";) \
35 touch -r "$(2)" "$(2)_check"; \
38 $(call debug_eval,$(SUBDIR),r,echo "Need to rebuild $(2)";) \
41 $(if $(3), mv $(3).1 $(3))
44 $(if $(3), rm -f $(3) $(3).1)
45 $(call debug_eval,$(SUBDIR),r,echo "Target $(2) not built")
50 ifeq ($(filter .%,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),$(MAKECMDGOALS),x))