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
10 include $(INCLUDE_DIR
)/prereq.mk
11 include $(INCLUDE_DIR
)/host.mk
13 define Require
/non-root
14 [ "$$(shell whoami)" != "root" ]
16 $(eval
$(call Require
,non-root
, \
17 Please do not compile
as root. \
20 # Required for the toolchain
21 define Require
/working-make
22 echo
'all: test' > $(TMP_DIR
)/check.mk
23 echo
'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR
)/check.mk
24 echo
'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR
)/check.mk
25 echo
'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR
)/check.mk
26 $(NO_TRACE_MAKE
) -f
$(TMP_DIR
)/check.mk
29 $(eval
$(call Require
,working-make
, \
30 Please
install GNU make v3.81 or later.
(This version has bugs
) \
33 define Require
/working-gcc
34 echo
'int main(int argc, char **argv) { return 0; }' | \
35 gcc
-x c
-o
$(TMP_DIR
)/a.out
-
38 $(eval
$(call Require
,working-gcc
, \
39 Please
install the GNU C Compiler
(gcc
). \
42 define Require
/working-g
++
43 echo
'int main(int argc, char **argv) { return 0; }' | \
44 g
++ -x c
++ -o
$(TMP_DIR
)/a.out
-lstdc
++ -
47 $(eval
$(call Require
,working-g
++, \
48 Please
install the GNU C
++ Compiler
(g
++). \
51 define Require
/ncurses
52 echo
'int main(int argc, char **argv) { initscr(); return 0; }' | \
53 gcc
-include ncurses.h
-x c
-o
$(TMP_DIR
)/a.out
-lncurses
-
56 $(eval
$(call Require
,ncurses
, \
57 Please
install ncurses.
(Missing libncurses.so or ncurses.h
) \
62 echo
'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
63 gcc
-include zlib.h
-x c
-o
$(TMP_DIR
)/a.out
-lz
-
66 $(eval
$(call Require
,zlib
, \
67 Please
install zlib.
(Missing libz.so or zlib.h
) \
71 $(eval
$(call RequireCommand
,bison
, \
72 Please
install GNU bison. \
75 $(eval
$(call RequireCommand
,flex
, \
76 Please
install flex. \
79 $(eval
$(call RequireCommand
,python
, \
80 Please
install python. \
83 $(eval
$(call RequireCommand
,unzip
, \
84 Please
install unzip. \
87 $(eval
$(call RequireCommand
,bzip2
, \
88 Please
install bzip2. \
91 $(eval
$(call RequireCommand
,patch
, \
92 Please
install patch. \
95 $(eval
$(call RequireCommand
,perl
, \
96 Please
install perl. \
99 $(eval
$(call RequireCommand
,wget
, \
100 Please
install wget. \
103 define Require
/gnutar
104 $(TAR
) --version
2>&1 | grep GNU
> /dev
/null
107 $(eval
$(call Require
,gnutar
, \
108 Please
install GNU
tar. \