2 # Copyright (C) 2006-2015 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)
12 if
[ -f
$(TMP_DIR
)/.prereq-error
]; then \
14 cat
$(TMP_DIR
)/.prereq-error
; \
15 rm -f
$(TMP_DIR
)/.prereq-error
; \
29 ifeq ($$(CHECK_
$(1)),)
32 prereq-
$(1): $(if
$(PREREQ_PREV
),prereq-
$(PREREQ_PREV
)) FORCE
33 printf
"Checking '$(1)'... "
34 if
$(NO_TRACE_MAKE
) -f
$(firstword $(MAKEFILE_LIST
)) check-
$(1) >/dev
/null
2>/dev
/null
; then \
38 echo
"$(PKG_NAME): $(strip $(2))" >> $(TMP_DIR
)/.prereq-error
; \
45 .SILENT
: prereq-
$(1) check-
$(1)
58 $$(eval
$$(call Require
,$(1),$(2)))
66 $$(eval
$$(call Require
,$(1),$(2)))
69 define QuoteHostCommand
70 '$(subst ','"'"',$(strip $(1)))'
76 define TestHostCommand
78 ($(3)) >/dev/null 2>/dev/null
81 $$(eval $$(call Require,$(1),$(2)))
87 define SetupHostCommand
89 for cmd in $(call QuoteHostCommand,$(3)) $(call QuoteHostCommand,$(4)) \
90 $(call QuoteHostCommand,$(5)) $(call QuoteHostCommand,$(6)) \
91 $(call QuoteHostCommand,$(7)) $(call QuoteHostCommand,$(8)) \
92 $(call QuoteHostCommand,$(9)); do \
93 if [ -n "$$$$$$$$cmd" ]; then \
94 bin="$$$$$$$$(PATH
="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \
95 which
"$$$$$$$${cmd%% *}")"; \
96 if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \
97 mkdir -p "$(STAGING_DIR_HOST
)/bin
"; \
98 ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST
)/bin
/$(strip $(1))"; \
106 $$(eval $$(call Require,$(1),$(if $(2),$(2),Missing $(1) command)))