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 GMAKE?
= $(PWD
)/scripts
/make
5 GMAKE_FMK
= ${GMAKE} -f
$(PWD
)/mk
/build.mk
6 GMAKE_INV
= ${GMAKE_FMK} --no-print-directory
12 @
(echo
; echo
"Build started on $$(LC_ALL=C LANGUAGE=C date)"; \
13 set
-x
; ${GMAKE_FMK} VERBOSE
=1 all) 2>&1 | tee
-a make.log
16 @echo
' switch DEV=device - Backup current config and copy old saved device config'
17 @echo
'Cleaning targets:'
18 @echo
' clean - Remove bin and build_dir directories'
19 @echo
' cleandevice - Same as "clean", but also remove toolchain for device'
20 @echo
' cleandir - Same as "clean", but also remove all built toolchains'
21 @echo
' cleankernel - Remove kernel dir'
22 @echo
' distclean - Same as "cleandir", but also remove downloaded'
23 @echo
' distfiles and .config'
25 @echo
'Configuration targets:'
26 @echo
' config - Update current config utilising a line-oriented program'
27 @echo
' menuconfig - Update current config utilising a menu based program'
28 @echo
' (default when .config does not exist)'
29 @echo
' oldconfig - Update current config utilising a provided .configs base'
30 @echo
' wconfig - Same as "oldconfig", but also writes out hidden symbols'
31 @echo
' allmodconfig - New config selecting all packages as modules when possible'
32 @echo
' allconfig - New config selecting all packages when possible'
33 @echo
' allnoconfig - New config where all options are answered with no'
36 @echo
' help - Print this help text'
37 @echo
' pkg-help - Print help about selectively compiling single packages'
38 @echo
' dev-help - Print help for developers / package maintainers'
40 @echo
'Other generic targets:'
41 @echo
' all - Build everything as specified in .config'
42 @echo
' (default if .config exists)'
43 @echo
' v - Same as "all" but with logging to make.log enabled'
46 @echo
'Package specific targets (use with "package=<pkg-name>" parameter):'
47 @echo
' fetch - Download the necessary distfile'
48 @echo
' extract - Same as "fetch", but also extract the distfile'
49 @echo
' patch - Same as "extract", but also patch the source'
50 @echo
' build - Same as "patch", but also build the binaries'
51 @echo
' fake - Same as "build", but also install the binaries'
52 @echo
' package - Same as "fake", but also create the ipkg package'
53 @echo
' clean - Deinstall and remove the build area'
54 @echo
' distclean - Same as "clean", but also remove the distfiles'
56 @echo
'Short package rebuilding guide:'
57 @echo
' run "make package=<pkgname> clean" to remove all generated binaries'
58 @echo
' run "make package=<pkgname> package" to build everything and create the ipkg'
60 @echo
'This does not automatically resolve package dependencies!'
63 @echo
'Fast way of updating package patches:'
64 @echo
' run "make package=<pkgname> clean" to start with a good base'
65 @echo
' run "make package=<pkgname> patch" to fetch, unpack and patch the source'
66 @echo
' edit the package sources at build_dir/w-<pkgname>-*/<pkgname>-<version>'
67 @echo
' run "make package=<pkgname> update-patches to regenerate patch files'
69 @echo
'All changed patches will be opened with your $$EDITOR,'
70 @echo
'so you can add a description and verify the modifications.'
77 @
${GMAKE_INV} _config W
=
79 oldconfig
: .prereq_done
80 @
${GMAKE_INV} _config W
=-o
83 @
${GMAKE_INV} _config W
=-A
85 download
: .prereq_done
86 @
${GMAKE_INV} toolchain
/download
87 @
${GMAKE_INV} package
/download
89 cleankernel
: .prereq_done
90 -@
${GMAKE_INV} cleankernel
92 cleandir
: .prereq_done
93 -@
${GMAKE_INV} clean cleandir
94 @
-rm -f make.log .prereq_done
96 cleandevice
: .prereq_done
97 -@
${GMAKE_INV} clean cleandevice
100 distclean: .prereq_done
101 -@
${GMAKE_INV} clean cleandir
distclean
102 @
-rm -f make.log .prereq_done
110 image_clean
: .prereq_done
111 @
${GMAKE_INV} image_clean
113 menuconfig
: .prereq_done
114 @
${GMAKE_INV} menuconfig
116 allnoconfig
: .prereq_done
117 @
${GMAKE_INV} _config W
=-n
119 allconfig
: .prereq_done
120 @
${GMAKE_INV} _mconfig W
=-y RCONFIG
=Config.in
122 allmodconfig
: .prereq_done
123 @
${GMAKE_INV} _mconfig W
=-o RCONFIG
=Config.in
125 package_index
: .prereq_done
126 @
${GMAKE_INV} package_index
133 @
${MAKE} .prereq_done
--no-print-directory
137 @
${MAKE} .prereq_done NO_ERROR
=1
141 @
-rm -rf .prereq_done
142 @if
! bash
--version
2>&1 | fgrep
'GNU bash' >/dev
/null
2>&1; then \
143 echo
"GNU bash needs to be installed."; \
146 @if
test x
"$$(umask 2>/dev/null | sed 's/00*22/OK/')" != x
"OK"; then \
147 echo
>&2 Error
: you must build with umask
022, sorry.
; \
150 @echo
"TOPDIR:=$$(readlink -nf . 2>/dev/null || pwd -P)" >prereq.mk
151 @echo
"BASH:=$$(which bash)" >>prereq.mk
152 @if
[ -z
"$$(which gmake)" ]; then \
153 echo
"GMAKE:=$$(which make)" >>prereq.mk
;\
155 echo
"GMAKE:=$$(which gmake)" >>prereq.mk
;\
157 @echo
"GNU_HOST_NAME:=$$(${CC} -dumpmachine)" >>prereq.mk
158 @echo
"HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
159 -e 's/sparc.*/sparc/' \
161 -e 's/m68k.*/m68k/' \
162 -e 's/ppc/powerpc/g' \
163 -e 's/v850.*/v850/g' \
165 -e 's/mips-.*/mips/' \
166 -e 's/mipsel-.*/mipsel/' \
167 -e 's/cris.*/cris/' \
168 -e 's/i[3-9]86/i386/' \
170 @echo
'HOSTCC:=${CC}' >>prereq.mk
171 @echo
'HOSTCFLAGS:=-O2 -fwrapv' >>prereq.mk
172 @echo
'LANGUAGE:=C' >>prereq.mk
173 @echo
'LC_ALL:=C' >>prereq.mk
174 @echo
'MAKE:=$${GMAKE}' >>prereq.mk
175 @echo
"OStype:=$$(env uname)" >>prereq.mk
176 @echo
"_PATH:=$$PATH" >>prereq.mk
177 @echo
"PATH:=\$${TOPDIR}/scripts:$$PATH" >>prereq.mk
178 @echo
"SHELL:=$$(which bash)" >>prereq.mk
179 @env NO_ERROR
=${NO_ERROR} BASH
="$$(which bash)" \
180 CC
='${CC}' CPPFLAGS
='${CPPFLAGS}' \
181 bash scripts
/scan-tools.sh
182 @echo
'===> Prerequisites checked successfully.'
185 .PHONY
: prereq prereq-noerror