9b77a1baf70b32828aaeb6f0ace064b08fc031fc
[openwrt.git] / 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 include $(INCLUDE_DIR)/host.mk
11
12 PKG_NAME:=Build dependency
13
14 define Require/non-root
15 [ "$$(shell whoami)" != "root" ]
16 endef
17 $(eval $(call Require,non-root, \
18 Please do not compile as root. \
19 ))
20
21 # Required for the toolchain
22 define Require/working-make
23 echo 'all: test' > $(TMP_DIR)/check.mk
24 echo 'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
25 echo 'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
26 echo 'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR)/check.mk
27 $(NO_TRACE_MAKE) -f $(TMP_DIR)/check.mk
28 endef
29
30 $(eval $(call Require,working-make, \
31 Please install GNU make v3.81 or later. (This version has bugs) \
32 ))
33
34 define Require/case-sensitive-fs
35 rm -f $(TMP_DIR)/test.*
36 touch $(TMP_DIR)/test.fs
37 [ \! -f $(TMP_DIR)/test.FS ]
38 endef
39
40 $(eval $(call Require,case-sensitive-fs, \
41 OpenWrt can only be built on a case-sensitive filesystem \
42 ))
43
44 define Require/working-gcc
45 echo 'int main(int argc, char **argv) { return 0; }' | \
46 gcc -x c -o $(TMP_DIR)/a.out -
47 endef
48
49 $(eval $(call Require,working-gcc, \
50 Please install the GNU C Compiler (gcc). \
51 ))
52
53 define Require/working-g++
54 echo 'int main(int argc, char **argv) { return 0; }' | \
55 g++ -x c++ -o $(TMP_DIR)/a.out -lstdc++ - && \
56 $(TMP_DIR)/a.out
57 endef
58
59 $(eval $(call Require,working-g++, \
60 Please install the GNU C++ Compiler (g++). \
61 ))
62
63 define Require/ncurses
64 echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
65 gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out -lncurses -
66 endef
67
68 $(eval $(call Require,ncurses, \
69 Please install ncurses. (Missing libncurses.so or ncurses.h) \
70 ))
71
72
73 define Require/zlib
74 echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
75 gcc -include zlib.h -x c -o $(TMP_DIR)/a.out -lz -
76 endef
77
78 $(eval $(call Require,zlib, \
79 Please install zlib. (Missing libz.so or zlib.h) \
80 ))
81
82 $(eval $(call RequireCommand,gawk, \
83 Please install GNU awk. \
84 ))
85
86 $(eval $(call RequireCommand,bison, \
87 Please install GNU bison. \
88 ))
89
90 $(eval $(call RequireCommand,flex, \
91 Please install flex. \
92 ))
93
94 $(eval $(call RequireCommand,unzip, \
95 Please install unzip. \
96 ))
97
98 $(eval $(call RequireCommand,bzip2, \
99 Please install bzip2. \
100 ))
101
102 $(eval $(call RequireCommand,patch, \
103 Please install patch. \
104 ))
105
106 $(eval $(call RequireCommand,perl, \
107 Please install perl. \
108 ))
109
110 $(eval $(call RequireCommand,wget, \
111 Please install wget. \
112 ))
113
114 define Require/gnutar
115 $(TAR) --version 2>&1 | grep GNU > /dev/null
116 endef
117
118 $(eval $(call Require,gnutar, \
119 Please install GNU tar. \
120 ))
121
122 define Require/git
123 which git-clone
124 endef
125
126 $(eval $(call Require,git, \
127 Please install git. \
128 ))
129
130 $(eval $(call RequireCommand,svn, \
131 Please install the subversion client. \
132 ))
133
134 $(eval $(call RequireCommand,autoconf, \
135 Please install GNU autoconf. \
136 ))
137
This page took 0.041925 seconds and 3 git commands to generate.