fix etrax arch
[openwrt/crisos.git] / include / prereq.mk
blob4a55c89ffcf9afd115aab72f64d4973c64bfc674
1 #
2 # Copyright (C) 2006-2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 ifneq ($(__prereq_inc),1)
9 __prereq_inc:=1
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; \
20 .SILENT: prereq
21 endif
23 define Require
24 export PREREQ_CHECK=1
25 ifeq ($$(CHECK_$(1)),)
26 prereq: prereq-$(1)
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; \
37 check-$(1): FORCE
38 $(call Require/$(1))
39 CHECK_$(1):=1
41 .SILENT: prereq-$(1) check-$(1)
42 endif
43 endef
46 define RequireCommand
47 define Require/$(1)
48 which $(1)
49 endef
51 $$(eval $$(call Require,$(1),$(2)))
52 endef
54 define RequireHeader
55 define Require/$(1)
56 [ -e "$(1)" ]
57 endef
59 $$(eval $$(call Require,$(1),$(2)))
60 endef
62 .NOTPARALLEL: