[package] uboot-kirkwood: update to 2013.10
[openwrt.git] / include / prereq.mk
1
2 # Copyright (C) 2006-2007 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 ifneq ($(__prereq_inc),1)
9 __prereq_inc:=1
10
11 prereq:
12         if [ -f $(TMP_DIR)/.prereq-error ]; then \
13                 echo; \
14                 cat $(TMP_DIR)/.prereq-error; \
15                 rm -f $(TMP_DIR)/.prereq-error; \
16                 echo; \
17                 false; \
18         fi
19
20 .SILENT: prereq
21 endif
22
23 define Require
24   export PREREQ_CHECK=1
25   ifeq ($$(CHECK_$(1)),)
26     prereq: prereq-$(1)
27
28     prereq-$(1): FORCE
29                 echo -n "Checking '$(1)'... "
30                 if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \
31                         echo 'ok.'; \
32                 else \
33                         echo 'failed.'; \
34                         echo -e "$(PKG_NAME): $(strip $(2))" | perl -ne 's/\\\s*/\n/g,print' >> $(TMP_DIR)/.prereq-error; \
35                 fi
36
37     check-$(1): FORCE
38           $(call Require/$(1))
39     CHECK_$(1):=1
40
41     .SILENT: prereq-$(1) check-$(1)
42   endif
43 endef
44
45
46 define RequireCommand
47   define Require/$(1)
48     which $(1)
49   endef
50
51   $$(eval $$(call Require,$(1),$(2)))
52 endef
53
54 define RequireHeader
55   define Require/$(1)
56     [ -e "$(1)" ]
57   endef
58   
59   $$(eval $$(call Require,$(1),$(2)))
60 endef
61
62 .NOTPARALLEL: