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
9 include $(INCLUDE_DIR
)/prereq.mk
10 include $(INCLUDE_DIR
)/host.mk
12 define Require
/non-root
13 [ "$$(shell whoami)" != "root" ]
15 $(eval
$(call Require
,non-root
, \
16 Please do not compile
as root. \
19 # Required for the toolchain
20 define Require
/working-make
21 echo
'all: test' > $(TMP_DIR
)/check.mk
22 echo
'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR
)/check.mk
23 echo
'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR
)/check.mk
24 echo
'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR
)/check.mk
25 $(NO_TRACE_MAKE
) -f
$(TMP_DIR
)/check.mk
28 $(eval
$(call Require
,working-make
, \
29 Please
install GNU make v3.81 or later.
(This version has bugs
) \
32 define Require
/case-sensitive-fs
33 rm -f
$(TMP_DIR
)/test.
*
34 touch
$(TMP_DIR
)/test.fs
35 [ \
! -f
$(TMP_DIR
)/test.FS
]
38 $(eval
$(call Require
,case-sensitive-fs
, \
39 OpenWrt can only be built on a case-sensitive filesystem \
42 define Require
/working-gcc
43 echo
'int main(int argc, char **argv) { return 0; }' | \
44 gcc
-x c
-o
$(TMP_DIR
)/a.out
-
47 $(eval
$(call Require
,working-gcc
, \
48 Please
install the GNU C Compiler
(gcc
). \
51 define Require
/working-g
++
52 echo
'int main(int argc, char **argv) { return 0; }' | \
53 g
++ -x c
++ -o
$(TMP_DIR
)/a.out
-lstdc
++ -
56 $(eval
$(call Require
,working-g
++, \
57 Please
install the GNU C
++ Compiler
(g
++). \
60 define Require
/ncurses
61 echo
'int main(int argc, char **argv) { initscr(); return 0; }' | \
62 gcc
-include ncurses.h
-x c
-o
$(TMP_DIR
)/a.out
-lncurses
-
65 $(eval
$(call Require
,ncurses
, \
66 Please
install ncurses.
(Missing libncurses.so or ncurses.h
) \
71 echo
'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
72 gcc
-include zlib.h
-x c
-o
$(TMP_DIR
)/a.out
-lz
-
75 $(eval
$(call Require
,zlib
, \
76 Please
install zlib.
(Missing libz.so or zlib.h
) \
80 $(eval
$(call RequireCommand
,bison
, \
81 Please
install GNU bison. \
84 $(eval
$(call RequireCommand
,flex
, \
85 Please
install flex. \
88 $(eval
$(call RequireCommand
,unzip
, \
89 Please
install unzip. \
92 $(eval
$(call RequireCommand
,bzip2
, \
93 Please
install bzip2. \
96 $(eval
$(call RequireCommand
,patch
, \
97 Please
install patch. \
100 $(eval
$(call RequireCommand
,perl
, \
101 Please
install perl. \
104 $(eval
$(call RequireCommand
,wget
, \
105 Please
install wget. \
108 define Require
/gnutar
109 $(TAR
) --version
2>&1 | grep GNU
> /dev
/null
112 $(eval
$(call Require
,gnutar
, \
113 Please
install GNU
tar. \
116 $(eval
$(call RequireCommand
,autoconf
, \
117 Please
install GNU autoconf. \