2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
15 if
[ -f
$(TMP_DIR
)/.prereq-error
]; then \
16 cat
$(TMP_DIR
)/.prereq-error
; \
24 .SILENT
: $(TMP_DIR
) prereq
27 ifeq ($$(CHECK_
$(1)),)
30 prereq-
$(1): $(TMP_DIR
) FORCE
31 echo
-n
"Checking '$(1)'... "
32 if
$(NO_TRACE_MAKE
) -f
$(INCLUDE_DIR
)/prereq.mk check-
$(1) >/dev
/null
2>/dev
/null
; then \
36 echo
-e
"$(strip $(2))" >> $(TMP_DIR
)/.prereq-error
; \
43 .SILENT
: prereq-
$(1) check-
$(1)
53 $$(eval
$$(call Require
,$(1),$(2)))
56 # Required for the toolchain
57 define Require
/working-make
58 echo
'all: test' > $(TMP_DIR
)/check.mk
59 echo
'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR
)/check.mk
60 echo
'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR
)/check.mk
61 echo
'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR
)/check.mk
62 $(NO_TRACE_MAKE
) -f
$(TMP_DIR
)/check.mk
65 $(eval
$(call Require
,working-make
, \
66 Your make version is buggy. Please
install GNU make v3.81 or later. \
69 define Require
/working-gcc
70 echo
'int main(int argc, char **argv) { return 0; }' | \
71 gcc
-x c
-o
$(TMP_DIR
)/a.out
-
74 $(eval
$(call Require
,working-gcc
, \
75 No working GNU C Compiler
(gcc
) was found on your system. \
78 define Require
/working-g
++
79 echo
'int main(int argc, char **argv) { return 0; }' | \
80 g
++ -x c
++ -o
$(TMP_DIR
)/a.out
-lstdc
++ -
83 $(eval
$(call Require
,working-g
++, \
84 No working GNU C
++ Compiler
(g
++) was found on your system. \
87 define Require
/ncurses
88 echo
'int main(int argc, char **argv) { initscr(); return 0; }' | \
89 gcc
-include ncurses.h
-x c
-o
$(TMP_DIR
)/a.out
-lncurses
-
92 $(eval
$(call Require
,ncurses
, \
93 No ncurses development files were not found on your system. \
98 echo
'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
99 gcc
-include zlib.h
-x c
-o
$(TMP_DIR
)/a.out
-lz
-
102 $(eval
$(call Require
,zlib
, \
103 No zlib development files were not found on your system. \
107 $(eval
$(call RequireCommand
,bison
, \
108 Please
install GNU bison. \
111 $(eval
$(call RequireCommand
,flex
, \
112 Please
install flex. \
115 $(eval
$(call RequireCommand
,python
, \
116 Please
install python. \
119 $(eval
$(call RequireCommand
,unzip
, \
120 Please
install unzip. \
123 $(eval
$(call RequireCommand
,bzip2
, \
124 Please
install bzip2. \
127 $(eval
$(call RequireCommand
,patch
, \
128 Please
install patch. \
131 $(eval
$(call RequireCommand
,perl
, \
132 Please
install perl. \