1 include $(TOPDIR)/include/verbose.mk
4 all: $(TMP_DIR)/.$(SCAN_TARGET)
6 SCAN_TARGET ?= packageinfo
9 TARGET_STAMP:=$(TMP_DIR)/info/.files-$(SCAN_TARGET).stamp
10 FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE)
11 OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE)
13 export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
16 $(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1))))
19 ifeq ($(SCAN_NAME),target)
20 SCAN_DEPS=image/Makefile profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk image/*.mk
22 SCAN_DEPS=$(TOPDIR)/include/package*.mk
23 ifneq ($(call feedname,$(SCAN_DIR)),)
24 SCAN_DEPS += $(TOPDIR)/feeds/$(call feedname,$(SCAN_DIR))/*.mk
29 ifneq ($(strip $(NO_COLOR)),1)
31 printf "\033[M\r$(1)" >&2;
45 $(TMP_DIR)/.$(SCAN_TARGET): $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1)
46 $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1): $(SCAN_DIR)/$(2)/Makefile $(foreach DEP,$(DEPS_$(SCAN_DIR)/$(2)/Makefile) $(SCAN_DEPS),$(wildcard $(if $(filter /%,$(DEP)),$(DEP),$(SCAN_DIR)/$(2)/$(DEP))))
48 $$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(2)) \
49 echo Source-Makefile: $(SCAN_DIR)/$(2)/Makefile; \
50 $(if $(3),echo Override: $(3),true); \
51 $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \
52 mkdir -p "$(TOPDIR)/logs/$(SCAN_DIR)/$(2)"; \
53 $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(SCAN_DIR)/$(2)/dump.txt 2>&1; \
54 $$(call progress,ERROR: please fix $(SCAN_DIR)/$(2)/Makefile - see logs/$(SCAN_DIR)/$(2)/dump.txt for details\n) \
63 rm -f $(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-*
66 ifeq ($(SCAN_NAME),target)
67 GREP_STRING=BuildTarget
69 GREP_STRING=(Build/DefaultTargets|BuildPackage|KernelPackage)
72 $(FILELIST): $(OVERRIDELIST)
73 rm -f $(TMP_DIR)/info/.files-$(SCAN_TARGET)-*
74 find -L $(SCAN_DIR) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -aHE 'call $(GREP_STRING)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@
76 $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
78 cat $< | awk '{print "$(SCAN_DIR)/" $$0 "/Makefile" }' | xargs grep -HE '^ *SCAN_DEPS *= *' | awk -F: '{ gsub(/^.*DEPS *= */, "", $$2); print "DEPS_" $$1 "=" $$2 }'; \
79 awk -F/ -v deps="$$DEPS" -v of="$(OVERRIDELIST)" ' \
81 while (getline < (of)) \
87 gsub(/\//, "_", info); \
90 if($$NF in override) \
92 print "$$(eval $$(call PackageDir," info "," dir "," pkg "))"; \
98 -include $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk
102 $(NO_TRACE_MAKE) $(FILELIST); \
103 MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | mkhash md5 | awk '{print $$1}'); \
104 [ -f "$@.$$MD5SUM" ] || { \
111 $(TMP_DIR)/.$(SCAN_TARGET): $(TARGET_STAMP)
112 $(call progress,Collecting $(SCAN_NAME) info: merging...)
113 -cat $(FILELIST) | awk '{gsub(/\//, "_", $$0);print "$(TMP_DIR)/info/.$(SCAN_TARGET)-" $$0}' | xargs cat > $@ 2>/dev/null
114 $(call progress,Collecting $(SCAN_NAME) info: done)