add 'deselect' property for menuconfig
[openwrt.git] / include / scan.mk
1 include $(TOPDIR)/include/verbose.mk
2
3 SCAN_TARGET ?= pkginfo
4 SCAN_NAME ?= package
5 SCAN_DIR ?= package
6 SCAN_DEPS ?= include/package.mk
7
8 ifeq ($(IS_TTY),1)
9 define progress
10 printf "\033[M\r$(1)" >&2;
11 endef
12 else
13 define progress
14 :
15 endef
16 endif
17
18 SCAN = $(patsubst $(SCAN_DIR)/%/Makefile,%,$(shell ls $(SCAN_DIR)/*/Makefile))
19 tmp/.$(SCAN_TARGET):
20 @($(call progress,Collecting $(SCAN_NAME) info: merging...))
21 for file in $(SCAN); do \
22 cat tmp/info/.$(SCAN_TARGET)-$$file; \
23 done > $@
24 @($(call progress,Collecting $(SCAN_NAME) info: done))
25 @echo
26
27 ifneq ($(SCAN_EXTRA),)
28 SCAN_STAMP=tmp/info/.scan-$(SCAN_TARGET)-$(shell ls $(SCAN_EXTRA) 2>/dev/null | (md5sum || md5) 2>/dev/null | cut -d' ' -f1)
29 $(SCAN_STAMP):
30 rm -f tmp/info/.scan-$(SCAN_TARGET)-*
31 mkdir -p $(shell dirname $@)
32 touch $@
33 endif
34
35 define scanfiles
36 $(foreach FILE,$(SCAN),
37 tmp/.$(SCAN_TARGET): tmp/info/.$(SCAN_TARGET)-$(FILE) FORCE
38 tmp/info/.$(SCAN_TARGET)-$(FILE): $(SCAN_DEPS) $(SCAN_DIR)/$(FILE)/Makefile $(SCAN_STAMP)
39 { \
40 $$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(FILE)) \
41 echo Source-Makefile: $(SCAN_DIR)/$(FILE)/Makefile; \
42 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $(SCAN_DIR)/$(FILE) 3>/dev/null || echo "ERROR: please fix $(SCAN_DIR)/$(FILE)/Makefile" >&2; \
43 echo; \
44 } > $$@
45 )
46
47 endef
48 $(eval $(call scanfiles))
49
50 FORCE:
51 .PHONY: FORCE
This page took 0.05411 seconds and 5 git commands to generate.