add tools/syslinux
[openadk.git] / Makefile
blob7a01e93d99bb2eb9778901fe6a4497c7f984c913
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 _UNLIMIT= __limit=$$(ulimit -dH 2>/dev/null); \
5 test -n "$$__limit" && ulimit -dS $$__limit;
7 all: checkreloc .prereq_done
8 @${_UNLIMIT} ${GMAKE_INV} all
10 v: .prereq_done
11 @(echo; echo "Build started on $$(LC_ALL=C LANGUAGE=C date)"; \
12 set -x; ${_UNLIMIT} ${GMAKE_FMK} VERBOSE=1 all) 2>&1 | tee -a make.log
14 help:
15 @echo 'Configuration targets:'
16 @echo ' config - Update current config utilising a line-oriented program'
17 @echo ' menuconfig - Update current config utilising a menu based program'
18 @echo ' (default when .config does not exist)'
19 @echo ' guiconfig - Update current config utilising a gui based program'
20 @echo ' oldconfig - Update current config utilising a provided .configs base'
21 @echo ' allmodconfig - New config selecting all packages as modules when possible'
22 @echo ' allconfig - New config selecting all packages when possible'
23 @echo ' allnoconfig - New config where all options are answered with no'
24 @echo ''
25 @echo 'Help targets:'
26 @echo ' help - Print this help text'
27 @echo ' pkg-help - Print help about selectively compiling single packages'
28 @echo ' dev-help - Print help for developers / package maintainers'
29 @echo ''
30 @echo 'Common targets:'
31 @echo ' switch ARCH=arch SYSTEM=system - Backup current config and copy old saved target config'
32 @echo ' download - fetches all needed distfiles'
33 @echo ' kernelconfig - Modify the target kernel configuration'
34 @echo ''
35 @echo 'Cleaning targets:'
36 @echo ' clean - Remove bin and build_dir directories'
37 @echo ' cleantarget - Same as "clean", but also remove toolchain for target'
38 @echo ' cleandir - Same as "clean", but also remove all built toolchains'
39 @echo ' cleankernel - Remove kernel dir, useful if you changed any kernel patches'
40 @echo ' distclean - Same as "cleandir", but also remove downloaded'
41 @echo ' distfiles and .config'
42 @echo ''
43 @echo 'Other generic targets:'
44 @echo ' all - Build everything as specified in .config'
45 @echo ' (default if .config exists)'
46 @echo ' v - Same as "all" but with logging to make.log enabled'
48 pkg-help:
49 @echo 'Package specific targets (use with "package=<pkg-name>" parameter):'
50 @echo ' fetch - Download the necessary distfile'
51 @echo ' extract - Same as "fetch", but also extract the distfile'
52 @echo ' patch - Same as "extract", but also patch the source'
53 @echo ' build - Same as "patch", but also build the binaries'
54 @echo ' fake - Same as "build", but also install the binaries'
55 @echo ' package - Same as "fake", but also create the package'
56 @echo ' clean - Deinstall and remove the build area'
57 @echo ' distclean - Same as "clean", but also remove the distfiles'
58 @echo ''
59 @echo 'Short package rebuilding guide:'
60 @echo ' run "make package=<pkgname> clean" to remove all generated binaries'
61 @echo ' run "make package=<pkgname> package" to build everything and create the package(s)'
62 @echo ''
63 @echo 'This does not automatically resolve package dependencies!'
65 dev-help:
66 @echo 'Fast way of updating package patches:'
67 @echo ' run "make package=<pkgname> clean" to start with a good base'
68 @echo ' run "make package=<pkgname> patch" to fetch, unpack and patch the source'
69 @echo ' edit the package sources at build_dir/w-<pkgname>-*/<pkgname>-<version>'
70 @echo ' run "make package=<pkgname> update-patches" to regenerate patch files'
71 @echo ''
72 @echo 'All changed patches will be opened with your $$EDITOR,'
73 @echo 'so you can add a description and verify the modifications.'
74 @echo ''
75 @echo 'Adding a new package:'
76 @echo 'make PKG=foo VER=1.0 newpackage'
77 @echo 'Adding a new simple library package:'
78 @echo 'make PKG=foo VER=1.0 TYPE=lib newpackage'
79 @echo 'Adding a new simple program package:'
80 @echo 'make PKG=foo VER=1.0 TYPE=prog newpackage'
82 clean: .prereq_done
83 -@rm -f nohup.out
84 @${GMAKE_INV} clean
86 config: .prereq_done
87 @${GMAKE_INV} _config W=
89 oldconfig: .prereq_done
90 @${GMAKE_INV} _config W=-o
92 download: .prereq_done
93 @${GMAKE_INV} toolchain/download
94 @${GMAKE_INV} package/download
96 cleankernel kernelclean: .prereq_done
97 -@${GMAKE_INV} cleankernel
99 cleandir dirclean: .prereq_done
100 -@${GMAKE_INV} cleandir
101 @-rm -f make.log .prereq_done
103 cleantarget targetclean: .prereq_done
104 -@${GMAKE_INV} cleantarget
105 @-rm -f make.log
107 distclean cleandist:
108 -@${GMAKE_INV} distclean
109 @-rm -f make.log .prereq_done
111 image: .prereq_done
112 @${GMAKE_INV} image
114 switch: .prereq_done
115 @${GMAKE_INV} switch
117 kernelconfig: .prereq_done
118 @${GMAKE_INV} kernelconfig
120 newpackage: .prereq_done
121 @${GMAKE_INV} newpackage
123 image_clean imageclean cleanimage: .prereq_done
124 @${GMAKE_INV} image_clean
126 menuconfig: .prereq_done
127 @${GMAKE_INV} menuconfig
129 guiconfig: .prereq_done
130 @${GMAKE_INV} guiconfig
132 defconfig: .prereq_done
133 @${GMAKE_INV} defconfig
135 allnoconfig: .prereq_done
136 @${GMAKE_INV} _config W=-n
138 allconfig: .prereq_done
139 @${GMAKE_INV} _mconfig W=-y RCONFIG=Config.in
141 allmodconfig: .prereq_done
142 @${BASH} ${TOPDIR}/scripts/update-sys
143 @${BASH} ${TOPDIR}/scripts/update-pkg
144 @${GMAKE_INV} _mconfig W=-o RCONFIG=Config.in
146 package_index: .prereq_done
147 @${GMAKE_INV} package_index
149 release: .prereq_done
150 @${GMAKE_INV} release
152 bulk: .prereq_done
153 @${GMAKE_INV} bulk
155 bulktoolchain: .prereq_done
156 @${GMAKE_INV} bulktoolchain
158 bulkall: .prereq_done
159 @${GMAKE_INV} bulkall
161 bulkallmod: .prereq_done
162 @${GMAKE_INV} bulkallmod
164 check: .prereq_done
165 @${GMAKE_INV} check
167 check-gcc: .prereq_done
168 @${GMAKE_INV} check-gcc
170 check-g++: .prereq_done
171 @${GMAKE_INV} check-g++
173 menu: .prereq_done
174 @${GMAKE_INV} menu
176 dep: .prereq_done
177 @${GMAKE_INV} dep
179 world: .prereq_done
180 @${GMAKE_INV} world
182 prereq:
183 @rm -f .prereq_done
184 @${GMAKE} .prereq_done
186 prereq-noerror:
187 @rm -f .prereq_done
188 @${GMAKE} .prereq_done NO_ERROR=1
190 NO_ERROR=0
191 .prereq_done:
192 @-rm -rf .prereq_done
193 @if ! bash --version 2>&1 | grep -F 'GNU bash' >/dev/null 2>&1; then \
194 echo "GNU bash needs to be installed."; \
195 exit 1; \
197 @if test x"$$(umask 2>/dev/null | sed 's/00*22/OK/')" != x"OK"; then \
198 echo >&2 Error: you must build with umask 022, sorry.; \
199 exit 1; \
201 @echo "TOPDIR:=$$(readlink -nf . 2>/dev/null || pwd -P)" >prereq.mk
202 @echo "BASH:=$$(which bash)" >>prereq.mk
203 @if [ -z "$$(which gmake 2>/dev/null )" ]; then \
204 echo "GMAKE:=$$(which make)" >>prereq.mk ;\
205 else \
206 echo "GMAKE:=$$(which gmake)" >>prereq.mk ;\
208 @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine)" >>prereq.mk
209 @echo "ARCH_FOR_BUILD:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
210 -e 's/sparc.*/sparc/' \
211 -e 's/armeb.*/armeb/g' \
212 -e 's/arm.*/arm/g' \
213 -e 's/m68k.*/m68k/' \
214 -e 's/v850.*/v850/g' \
215 -e 's/sh[234]/sh/' \
216 -e 's/mips-.*/mips/' \
217 -e 's/mipsel-.*/mipsel/' \
218 -e 's/cris.*/cris/' \
219 -e 's/i[3-9]86/x86/' \
220 )" >>prereq.mk
221 @echo 'CC_FOR_BUILD:=${CC}' >>prereq.mk
222 @echo 'CXX_FOR_BUILD:=${CXX}' >>prereq.mk
223 @echo 'LANGUAGE:=C' >>prereq.mk
224 @echo 'LC_ALL:=C' >>prereq.mk
225 @echo 'MAKE:=$${GMAKE}' >>prereq.mk
226 @echo "OStype:=$$(env uname)" >>prereq.mk
227 @echo "ADKtype:=$$(cat /etc/adktarget 2>/dev/null)" >>prereq.mk
228 @echo "_PATH:=$$PATH" >>prereq.mk
229 @echo "PATH:=\$${TOPDIR}/scripts:/usr/sbin:$$PATH" >>prereq.mk
230 @echo "SHELL:=$$(which bash)" >>prereq.mk
231 @env NO_ERROR=${NO_ERROR} BASH="$$(which bash)" \
232 CC='${CC}' CPPFLAGS='${CPPFLAGS}' \
233 bash scripts/scan-tools.sh
234 @echo '===> Prerequisites checked successfully.'
235 @bash scripts/create-sys
236 @bash scripts/create-pkg
237 @touch .adkinit
238 @touch $@
240 checkreloc:
241 @bash scripts/reloc.sh
243 .PHONY: prereq prereq-noerror checkreloc
244 # DO NOT DELETE