patch from #989 (thanks Bartman007)
[openwrt.git] / include / prereq.mk
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 prereq:
9 if [ -f $(TMP_DIR)/.prereq-error ]; then \
10 echo; \
11 cat $(TMP_DIR)/.prereq-error; \
12 rm -f $(TMP_DIR)/.prereq-error; \
13 echo; \
14 false; \
15 fi
16
17 .SILENT: prereq
18
19 define Require
20 export PREREQ_CHECK=1
21 ifeq ($$(CHECK_$(1)),)
22 prereq: prereq-$(1)
23
24 prereq-$(1): FORCE
25 echo -n "Checking '$(1)'... "
26 if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \
27 echo 'ok.'; \
28 else \
29 echo 'failed.'; \
30 echo -e "$(strip $(2))" >> $(TMP_DIR)/.prereq-error; \
31 fi
32
33 check-$(1): FORCE
34 $(call Require/$(1))
35 CHECK_$(1):=1
36
37 .SILENT: prereq-$(1) check-$(1)
38 endif
39 endef
40
41
42 define RequireCommand
43 define Require/$(1)
44 which $(1)
45 endef
46
47 $$(eval $$(call Require,$(1),$(2)))
48 endef
49
This page took 0.049952 seconds and 5 git commands to generate.