1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
8 GMAKE?
= $(PWD
)/scripts
/make
9 GMAKE_FMK
= ${GMAKE} -f
$(PWD
)/mk
/build.mk
10 GMAKE_INV
= ${GMAKE_FMK} --no-print-directory
16 @
(echo
; echo
"Build started on $$(LC_ALL=C LANGUAGE=C date)"; \
17 set
-x
; ${GMAKE_FMK} VERBOSE
=1 all) 2>&1 | tee
-a make.log
20 @echo
'Common targets:'
21 @echo
' switch TARGET=targetname - Backup current config and copy old saved target config'
22 @echo
' download - fetches all needed distfiles'
23 @echo
'Cleaning targets:'
24 @echo
' clean - Remove bin and build_dir directories'
25 @echo
' cleantarget - Same as "clean", but also remove toolchain for target'
26 @echo
' cleandir - Same as "clean", but also remove all built toolchains'
27 @echo
' cleankernel - Remove kernel dir, useful if you changed any kernel patches'
28 @echo
' distclean - Same as "cleandir", but also remove downloaded'
29 @echo
' distfiles and .config'
31 @echo
'Configuration targets:'
32 @echo
' config - Update current config utilising a line-oriented program'
33 @echo
' menuconfig - Update current config utilising a menu based program'
34 @echo
' (default when .config does not exist)'
35 @echo
' oldconfig - Update current config utilising a provided .configs base'
36 @echo
' wconfig - Same as "oldconfig", but also writes out hidden symbols'
37 @echo
' allmodconfig - New config selecting all packages as modules when possible'
38 @echo
' allconfig - New config selecting all packages when possible'
39 @echo
' allnoconfig - New config where all options are answered with no'
40 @echo
' kernelconfig - Modify the target kernel configuration'
43 @echo
' help - Print this help text'
44 @echo
' pkg-help - Print help about selectively compiling single packages'
45 @echo
' dev-help - Print help for developers / package maintainers'
47 @echo
'Other generic targets:'
48 @echo
' all - Build everything as specified in .config'
49 @echo
' (default if .config exists)'
50 @echo
' v - Same as "all" but with logging to make.log enabled'
53 @echo
'Package specific targets (use with "package=<pkg-name>" parameter):'
54 @echo
' fetch - Download the necessary distfile'
55 @echo
' extract - Same as "fetch", but also extract the distfile'
56 @echo
' patch - Same as "extract", but also patch the source'
57 @echo
' build - Same as "patch", but also build the binaries'
58 @echo
' fake - Same as "build", but also install the binaries'
59 @echo
' package - Same as "fake", but also create the package'
60 @echo
' clean - Deinstall and remove the build area'
61 @echo
' distclean - Same as "clean", but also remove the distfiles'
63 @echo
'Short package rebuilding guide:'
64 @echo
' run "make package=<pkgname> clean" to remove all generated binaries'
65 @echo
' run "make package=<pkgname> package" to build everything and create the package(s)'
67 @echo
'This does not automatically resolve package dependencies!'
70 @echo
'Fast way of updating package patches:'
71 @echo
' run "make package=<pkgname> clean" to start with a good base'
72 @echo
' run "make package=<pkgname> patch" to fetch, unpack and patch the source'
73 @echo
' edit the package sources at build_dir/w-<pkgname>-*/<pkgname>-<version>'
74 @echo
' run "make package=<pkgname> update-patches to regenerate patch files'
76 @echo
'All changed patches will be opened with your $$EDITOR,'
77 @echo
'so you can add a description and verify the modifications.'
84 @
${GMAKE_INV} _config W
=
86 oldconfig
: .prereq_done
87 @
${GMAKE_INV} _config W
=-o
90 @
${GMAKE_INV} _config W
=-A
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
108 -@
${GMAKE_INV} distclean
109 @
-rm -f make.log .prereq_done
117 kernelconfig
: .prereq_done
118 @
${GMAKE_INV} kernelconfig
120 image_clean imageclean cleanimage
: .prereq_done
121 @
${GMAKE_INV} image_clean
123 menuconfig
: .prereq_done
124 @
${GMAKE_INV} menuconfig
126 allnoconfig
: .prereq_done
127 @
${GMAKE_INV} _config W
=-n
129 allconfig
: .prereq_done
130 @
${GMAKE_INV} _mconfig W
=-y RCONFIG
=Config.in
132 allmodconfig
: .prereq_done
133 @
${GMAKE_INV} _mconfig W
=-o RCONFIG
=Config.in
135 package_index
: .prereq_done
136 @
${GMAKE_INV} package_index
146 @
${MAKE} .prereq_done
--no-print-directory
150 @
${MAKE} .prereq_done NO_ERROR
=1
154 @
-rm -rf .prereq_done
155 @if
! bash
--version
2>&1 | fgrep
'GNU bash' >/dev
/null
2>&1; then \
156 echo
"GNU bash needs to be installed."; \
159 @if
test x
"$$(umask 2>/dev/null | sed 's/00*22/OK/')" != x
"OK"; then \
160 echo
>&2 Error
: you must build with umask
022, sorry.
; \
163 @echo
"TOPDIR:=$$(readlink -nf . 2>/dev/null || pwd -P)" >prereq.mk
164 @echo
"BASH:=$$(which bash)" >>prereq.mk
165 @if
[ -z
"$$(which gmake)" ]; then \
166 echo
"GMAKE:=$$(which make)" >>prereq.mk
;\
168 echo
"GMAKE:=$$(which gmake)" >>prereq.mk
;\
170 @echo
"GNU_HOST_NAME:=$$(${CC} -dumpmachine)" >>prereq.mk
171 @echo
"HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
172 -e 's/sparc.*/sparc/' \
174 -e 's/m68k.*/m68k/' \
175 -e 's/ppc/powerpc/g' \
176 -e 's/v850.*/v850/g' \
178 -e 's/mips-.*/mips/' \
179 -e 's/mipsel-.*/mipsel/' \
180 -e 's/cris.*/cris/' \
181 -e 's/i[3-9]86/i386/' \
183 @echo
'HOSTCC:=${CC}' >>prereq.mk
184 @echo
'HOSTCFLAGS:=-O2 -fwrapv' >>prereq.mk
185 @echo
'LANGUAGE:=C' >>prereq.mk
186 @echo
'LC_ALL:=C' >>prereq.mk
187 @echo
'MAKE:=$${GMAKE}' >>prereq.mk
188 @echo
"OStype:=$$(env uname)" >>prereq.mk
189 @echo
"_PATH:=$$PATH" >>prereq.mk
190 @echo
"PATH:=\$${TOPDIR}/scripts:$$PATH" >>prereq.mk
191 @echo
"SHELL:=$$(which bash)" >>prereq.mk
192 @env NO_ERROR
=${NO_ERROR} BASH
="$$(which bash)" \
193 CC
='${CC}' CPPFLAGS
='${CPPFLAGS}' \
194 bash scripts
/scan-tools.sh
195 @echo
'===> Prerequisites checked successfully.'
198 .PHONY
: prereq prereq-noerror