add BOARD and KERNEL to tgz image file name
[openwrt/openwrt.git] / openwrt / include / prereq-build.mk
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/prereq.mk
10
11 define Require/non-root
12 [ "$$(shell whoami)" != "root" ]
13 endef
14 $(eval $(call Require,non-root, \
15 Please do not compile as root. \
16 ))
17
18 # Required for the toolchain
19 define Require/working-make
20 echo 'all: test' > $(TMP_DIR)/check.mk
21 echo 'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
22 echo 'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
23 echo 'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR)/check.mk
24 $(NO_TRACE_MAKE) -f $(TMP_DIR)/check.mk
25 endef
26
27 $(eval $(call Require,working-make, \
28 Please install GNU make v3.81 or later. (This version has bugs) \
29 ))
30
31 define Require/working-gcc
32 echo 'int main(int argc, char **argv) { return 0; }' | \
33 gcc -x c -o $(TMP_DIR)/a.out -
34 endef
35
36 $(eval $(call Require,working-gcc, \
37 Please install the GNU C Compiler (gcc). \
38 ))
39
40 define Require/working-g++
41 echo 'int main(int argc, char **argv) { return 0; }' | \
42 g++ -x c++ -o $(TMP_DIR)/a.out -lstdc++ -
43 endef
44
45 $(eval $(call Require,working-g++, \
46 Please install the GNU C++ Compiler (g++). \
47 ))
48
49 define Require/ncurses
50 echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
51 gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out -lncurses -
52 endef
53
54 $(eval $(call Require,ncurses, \
55 Please install ncurses. (Missing libncurses.so or ncurses.h) \
56 ))
57
58
59 define Require/zlib
60 echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
61 gcc -include zlib.h -x c -o $(TMP_DIR)/a.out -lz -
62 endef
63
64 $(eval $(call Require,zlib, \
65 Please install zlib. (Missing libz.so or zlib.h) \
66 ))
67
68
69 $(eval $(call RequireCommand,bison, \
70 Please install GNU bison. \
71 ))
72
73 $(eval $(call RequireCommand,flex, \
74 Please install flex. \
75 ))
76
77 $(eval $(call RequireCommand,python, \
78 Please install python. \
79 ))
80
81 $(eval $(call RequireCommand,unzip, \
82 Please install unzip. \
83 ))
84
85 $(eval $(call RequireCommand,bzip2, \
86 Please install bzip2. \
87 ))
88
89 $(eval $(call RequireCommand,patch, \
90 Please install patch. \
91 ))
92
93 $(eval $(call RequireCommand,perl, \
94 Please install perl. \
95 ))