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
/case-sensitive-fs
34 rm -f
$(TMP_DIR
)/test.
*
35 touch
$(TMP_DIR
)/test.fs
36 [ \
! -f
$(TMP_DIR
)/test.FS
]
39 $(eval
$(call Require
,case-sensitive-fs
, \
40 OpenWrt can only be built on a case-sensitive filesystem \
43 define Require
/working-gcc
44 echo
'int main(int argc, char **argv) { return 0; }' | \
45 gcc
-x c
-o
$(TMP_DIR
)/a.out
-
48 $(eval
$(call Require
,working-gcc
, \
49 Please
install the GNU C Compiler
(gcc
). \
52 define Require
/working-g
++
53 echo
'int main(int argc, char **argv) { return 0; }' | \
54 g
++ -x c
++ -o
$(TMP_DIR
)/a.out
-lstdc
++ -
57 $(eval
$(call Require
,working-g
++, \
58 Please
install the GNU C
++ Compiler
(g
++). \
61 define Require
/ncurses
62 echo
'int main(int argc, char **argv) { initscr(); return 0; }' | \
63 gcc
-include ncurses.h
-x c
-o
$(TMP_DIR
)/a.out
-lncurses
-
66 $(eval
$(call Require
,ncurses
, \
67 Please
install ncurses.
(Missing libncurses.so or ncurses.h
) \
72 echo
'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
73 gcc
-include zlib.h
-x c
-o
$(TMP_DIR
)/a.out
-lz
-
76 $(eval
$(call Require
,zlib
, \
77 Please
install zlib.
(Missing libz.so or zlib.h
) \
81 $(eval
$(call RequireCommand
,bison
, \
82 Please
install GNU bison. \
85 $(eval
$(call RequireCommand
,flex
, \
86 Please
install flex. \
89 $(eval
$(call RequireCommand
,python
, \
90 Please
install python. \
93 $(eval
$(call RequireCommand
,unzip
, \
94 Please
install unzip. \
97 $(eval
$(call RequireCommand
,bzip2
, \
98 Please
install bzip2. \
101 $(eval
$(call RequireCommand
,patch
, \
102 Please
install patch. \
105 $(eval
$(call RequireCommand
,perl
, \
106 Please
install perl. \
109 $(eval
$(call RequireCommand
,wget
, \
110 Please
install wget. \
113 define Require
/gnutar
114 $(TAR
) --version
2>&1 | grep GNU
> /dev
/null
117 $(eval
$(call Require
,gnutar
, \
118 Please
install GNU
tar. \