-tmp/.pkginfo:
- @mkdir -p tmp
- @echo Collecting package info...
- @-for dir in package/*/; do \
- [ -f "$${dir}/Makefile" ] || continue; \
- echo Source-Makefile: $${dir}Makefile; \
- $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2; \
- echo; \
- done > $@
-
-tmp/.targetinfo:
- @mkdir -p tmp
- @echo Collecting target info...
- @-for dir in target/linux/*/; do \
- [ -f "$${dir}/Makefile" ] || continue; \
- ( cd "$$dir"; $(NO_TRACE_MAKE) --no-print-dir DUMP=1 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2 ); \
- echo; \
- done > $@
+define stamp
+tmp/info/.stamp-$(1)-$(shell ls $(2)/*/Makefile | (md5sum || md5) 2>/dev/null | cut -d' ' -f1)
+endef
+
+STAMP_pkginfo=$(call stamp,pkginfo,package)
+STAMP_targetinfo=$(call stamp,targetinfo,target/linux)
+define scan_info
+
+$(STAMP_$(1)):
+ @mkdir -p tmp/info
+ @rm -f tmp/info/.stamp-$(1)*
+ @touch $$@
+
+$(foreach FILE,$(shell ls $(2)/*/Makefile),
+tmp/.$(1): $(FILE)
+$(FILE):
+)
+
+tmp/.$(1): $(STAMP_$(1))
+ @echo -n Collecting $(3) info...
+ @$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="$(1)" SCAN_DIR="$(2)" SCAN_NAME="$(3)" SCAN_DEPS="$(4)"
+
+endef
+
+$(eval $(call scan_info,pkginfo,package,package,include/package.mk))
+$(eval $(call scan_info,targetinfo,target/linux,target,include/kernel-build.mk include/kernel-version.mk))