1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
7 GMAKE?
= $(PWD
)/scripts
/make
8 GMAKE_FMK
= ${GMAKE} -f
$(PWD
)/mk
/build.mk
9 GMAKE_INV
= ${GMAKE_FMK} --no-print-directory
15 @
(echo
; echo
"Build started on $$(LC_ALL=C LANGUAGE=C date)"; \
16 set
-x
; ${GMAKE_FMK} VERBOSE
=1 all) 2>&1 | tee
-a make.log
19 @echo
' switch DEV=device - Backup current config and copy old saved device config'
20 @echo
'Cleaning targets:'
21 @echo
' clean - Remove bin and build_dir directories'
22 @echo
' cleandevice - Same as "clean", but also remove toolchain for device'
23 @echo
' cleandir - Same as "clean", but also remove all built toolchains'
24 @echo
' cleankernel - Remove kernel dir'
25 @echo
' distclean - Same as "cleandir", but also remove downloaded'
26 @echo
' distfiles and .config'
28 @echo
'Configuration targets:'
29 @echo
' config - Update current config utilising a line-oriented program'
30 @echo
' menuconfig - Update current config utilising a menu based program'
31 @echo
' (default when .config does not exist)'
32 @echo
' oldconfig - Update current config utilising a provided .configs base'
33 @echo
' wconfig - Same as "oldconfig", but also writes out hidden symbols'
34 @echo
' allmodconfig - New config selecting all packages as modules when possible'
35 @echo
' allconfig - New config selecting all packages when possible'
36 @echo
' allnoconfig - New config where all options are answered with no'
39 @echo
' help - Print this help text'
40 @echo
' pkg-help - Print help about selectively compiling single packages'
41 @echo
' dev-help - Print help for developers / package maintainers'
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'
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 ipkg package'
56 @echo
' clean - Deinstall and remove the build area'
57 @echo
' distclean - Same as "clean", but also remove the distfiles'
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 ipkg'
63 @echo
'This does not automatically resolve package dependencies!'
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'
72 @echo
'All changed patches will be opened with your $$EDITOR,'
73 @echo
'so you can add a description and verify the modifications.'
80 @
${GMAKE_INV} _config W
=
82 oldconfig
: .prereq_done
83 @
${GMAKE_INV} _config W
=-o
86 @
${GMAKE_INV} _config W
=-A
88 download
: .prereq_done
89 @
${GMAKE_INV} toolchain
/download
90 @
${GMAKE_INV} package
/download
92 cleankernel kernelclean
: .prereq_done
93 -@
${GMAKE_INV} cleankernel
95 cleandir dirclean
: .prereq_done
96 -@
${GMAKE_INV} clean cleandir
97 @
-rm -f make.log .prereq_done
99 cleandevice deviceclean
: .prereq_done
100 -@
${GMAKE_INV} clean cleandevice
103 distclean cleandist
: .prereq_done
104 -@
${GMAKE_INV} clean cleandir
distclean
105 @
-rm -f make.log .prereq_done
113 image_clean imageclean cleanimage
: .prereq_done
114 @
${GMAKE_INV} image_clean
116 menuconfig
: .prereq_done
117 @
${GMAKE_INV} menuconfig
119 allnoconfig
: .prereq_done
120 @
${GMAKE_INV} _config W
=-n
122 allconfig
: .prereq_done
123 @
${GMAKE_INV} _mconfig W
=-y RCONFIG
=Config.in
125 allmodconfig
: .prereq_done
126 @
${GMAKE_INV} _mconfig W
=-o RCONFIG
=Config.in
128 package_index
: .prereq_done
129 @
${GMAKE_INV} package_index
136 @
${MAKE} .prereq_done
--no-print-directory
140 @
${MAKE} .prereq_done NO_ERROR
=1
144 @
-rm -rf .prereq_done
145 @if
! bash
--version
2>&1 | fgrep
'GNU bash' >/dev
/null
2>&1; then \
146 echo
"GNU bash needs to be installed."; \
149 @if
test x
"$$(umask 2>/dev/null | sed 's/00*22/OK/')" != x
"OK"; then \
150 echo
>&2 Error
: you must build with umask
022, sorry.
; \
153 @echo
"TOPDIR:=$$(readlink -nf . 2>/dev/null || pwd -P)" >prereq.mk
154 @echo
"BASH:=$$(which bash)" >>prereq.mk
155 @if
[ -z
"$$(which gmake)" ]; then \
156 echo
"GMAKE:=$$(which make)" >>prereq.mk
;\
158 echo
"GMAKE:=$$(which gmake)" >>prereq.mk
;\
160 @echo
"GNU_HOST_NAME:=$$(${CC} -dumpmachine)" >>prereq.mk
161 @echo
"HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
162 -e 's/sparc.*/sparc/' \
164 -e 's/m68k.*/m68k/' \
165 -e 's/ppc/powerpc/g' \
166 -e 's/v850.*/v850/g' \
168 -e 's/mips-.*/mips/' \
169 -e 's/mipsel-.*/mipsel/' \
170 -e 's/cris.*/cris/' \
171 -e 's/i[3-9]86/i386/' \
173 @echo
'HOSTCC:=${CC}' >>prereq.mk
174 @echo
'HOSTCFLAGS:=-O2 -fwrapv' >>prereq.mk
175 @echo
'LANGUAGE:=C' >>prereq.mk
176 @echo
'LC_ALL:=C' >>prereq.mk
177 @echo
'MAKE:=$${GMAKE}' >>prereq.mk
178 @echo
"OStype:=$$(env uname)" >>prereq.mk
179 @echo
"_PATH:=$$PATH" >>prereq.mk
180 @echo
"PATH:=\$${TOPDIR}/scripts:$$PATH" >>prereq.mk
181 @echo
"SHELL:=$$(which bash)" >>prereq.mk
182 @env NO_ERROR
=${NO_ERROR} BASH
="$$(which bash)" \
183 CC
='${CC}' CPPFLAGS
='${CPPFLAGS}' \
184 bash scripts
/scan-tools.sh
185 @echo
'===> Prerequisites checked successfully.'
188 .PHONY
: prereq prereq-noerror