fix kexec-tools build
[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 define scanfiles
28 $(foreach FILE,$(SCAN),
29 tmp/.$(SCAN_TARGET): tmp/info/.$(SCAN_TARGET)-$(FILE) FORCE
30 tmp/info/.$(SCAN_TARGET)-$(FILE): $(SCAN_DEPS) $(SCAN_DIR)/$(FILE)/Makefile
31 { \
32 $$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(FILE)) \
33 echo Source-Makefile: $(SCAN_DIR)/$(FILE)/Makefile; \
34 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $(SCAN_DIR)/$(FILE) 3>/dev/null || echo "ERROR: please fix $(SCAN_DIR)/$(FILE)/Makefile" >&2; \
35 echo; \
36 } > $$@
37 )
38
39 endef
40 $(eval $(call scanfiles))
41
42 FORCE:
43 .PHONY: FORCE
This page took 0.045956 seconds and 5 git commands to generate.