[include] autotools.mk: always pass -I m4, some package don't seem to set correct...
[openwrt.git] / include / depends.mk
1 #
2 # Copyright (C) 2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # define a dependency on a subtree
8 # parameters:
9 # 1: directories/files
10 # 2: directory dependency
11 # 3: tempfile for file listings
12 # 4: find options
13
14 DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp"
15
16 find_md5=$(SH_FUNC) find $(1) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | md5s
17
18 define rdep
19 .PRECIOUS: $(2)
20 .SILENT: $(2)_check
21
22 $(2): $(2)_check
23
24 ifneq ($(wildcard $(2)),)
25 $(2)_check::
26 $(if $(3), \
27 $(call find_md5,$(1),$(4)) > $(3).1; \
28 { [ \! -f "$(3)" ] || diff $(3) $(3).1 >/dev/null; } && \
29 ) \
30 { \
31 [ -f "$(2)_check.1" ] && mv "$(2)_check.1"; \
32 $(TOPDIR)/scripts/timestamp.pl $(DEP_FINDPARAMS) $(4) -n $(2) $(1) && { \
33 $(call debug_eval,$(SUBDIR),r,echo "No need to rebuild $(2)";) \
34 touch -r "$(2)" "$(2)_check"; \
35 } \
36 } || { \
37 $(call debug_eval,$(SUBDIR),r,echo "Need to rebuild $(2)";) \
38 touch "$(2)_check"; \
39 }
40 $(if $(3), mv $(3).1 $(3))
41 else
42 $(2)_check::
43 $(if $(3), rm -f $(3) $(3).1)
44 $(call debug_eval,$(SUBDIR),r,echo "Target $(2) not built")
45 endif
46
47 endef
48
This page took 0.045029 seconds and 5 git commands to generate.