]>
Commit | Line | Data |
---|---|---|
f2352877 | 1 | #!/bin/bash |
0777eafb WD |
2 | # Tool mainly for U-Boot Quality Assurance: build one or more board |
3 | # configurations with minimal verbosity, showing only warnings and | |
4 | # errors. | |
0777eafb | 5 | |
d8e392d9 MF |
6 | usage() |
7 | { | |
8 | # if exiting with 0, write to stdout, else write to stderr | |
9 | local ret=${1:-0} | |
10 | [ "${ret}" -eq 1 ] && exec 1>&2 | |
11 | cat <<-EOF | |
12 | Usage: MAKEALL [options] [--] [boards-to-build] | |
13 | ||
14 | Options: | |
15 | -a ARCH, --arch ARCH Build all boards with arch ARCH | |
16 | -c CPU, --cpu CPU Build all boards with cpu CPU | |
17 | -v VENDOR, --vendor VENDOR Build all boards with vendor VENDOR | |
18 | -s SOC, --soc SOC Build all boards with soc SOC | |
7f79c6f2 | 19 | -l, --list List all targets to be built |
9b96c6b1 MV |
20 | -m, --maintainers List all targets and maintainer email |
21 | -M, --mails List all targets and all affilated emails | |
d8e392d9 MF |
22 | -h, --help This help output |
23 | ||
24 | Selections by these options are logically ANDed; if the same option | |
25 | is used repeatedly, such selections are ORed. So "-v FOO -v BAR" | |
26 | will select all configurations where the vendor is either FOO or | |
27 | BAR. Any additional arguments specified on the command line are | |
28 | always build additionally. See the boards.cfg file for more info. | |
29 | ||
30 | If no boards are specified, then the default is "powerpc". | |
31 | ||
32 | Environment variables: | |
33 | BUILD_NCPUS number of parallel make jobs (default: auto) | |
34 | CROSS_COMPILE cross-compiler toolchain prefix (default: "") | |
35 | MAKEALL_LOGDIR output all logs to here (default: ./LOG/) | |
36 | BUILD_DIR output build directory (default: ./) | |
37 | ||
38 | Examples: | |
39 | - build all Power Architecture boards: | |
40 | MAKEALL -a powerpc | |
41 | MAKEALL --arch powerpc | |
42 | MAKEALL powerpc | |
43 | - build all PowerPC boards manufactured by vendor "esd": | |
44 | MAKEALL -a powerpc -v esd | |
45 | - build all PowerPC boards manufactured either by "keymile" or "siemens": | |
46 | MAKEALL -a powerpc -v keymile -v siemens | |
47 | - build all Freescale boards with MPC83xx CPUs, plus all 4xx boards: | |
48 | MAKEALL -c mpc83xx -v freescale 4xx | |
49 | EOF | |
50 | exit ${ret} | |
51 | } | |
52 | ||
9b96c6b1 MV |
53 | SHORT_OPTS="ha:c:v:s:lmM" |
54 | LONG_OPTS="help,arch:,cpu:,vendor:,soc:,list,maintainers,mails" | |
0777eafb WD |
55 | |
56 | # Option processing based on util-linux-2.13/getopt-parse.bash | |
57 | ||
071bc923 | 58 | # Note that we use `"$@"' to let each command-line parameter expand to a |
0777eafb WD |
59 | # separate word. The quotes around `$@' are essential! |
60 | # We need TEMP as the `eval set --' would nuke the return value of | |
61 | # getopt. | |
62 | TEMP=`getopt -o ${SHORT_OPTS} --long ${LONG_OPTS} \ | |
63 | -n 'MAKEALL' -- "$@"` | |
64 | ||
d8e392d9 | 65 | [ $? != 0 ] && usage 1 |
0777eafb WD |
66 | |
67 | # Note the quotes around `$TEMP': they are essential! | |
68 | eval set -- "$TEMP" | |
69 | ||
70 | SELECTED='' | |
7f79c6f2 | 71 | ONLY_LIST='' |
9b96c6b1 MV |
72 | PRINT_MAINTS='' |
73 | MAINTAINERS_ONLY='' | |
0777eafb WD |
74 | |
75 | while true ; do | |
76 | case "$1" in | |
77 | -a|--arch) | |
78 | # echo "Option ARCH: argument \`$2'" | |
79 | if [ "$opt_a" ] ; then | |
80 | opt_a="${opt_a%)} || \$2 == \"$2\")" | |
81 | else | |
82 | opt_a="(\$2 == \"$2\")" | |
83 | fi | |
84 | SELECTED='y' | |
85 | shift 2 ;; | |
86 | -c|--cpu) | |
87 | # echo "Option CPU: argument \`$2'" | |
88 | if [ "$opt_c" ] ; then | |
89 | opt_c="${opt_c%)} || \$3 == \"$2\")" | |
90 | else | |
91 | opt_c="(\$3 == \"$2\")" | |
92 | fi | |
93 | SELECTED='y' | |
94 | shift 2 ;; | |
95 | -s|--soc) | |
96 | # echo "Option SoC: argument \`$2'" | |
97 | if [ "$opt_s" ] ; then | |
98 | opt_s="${opt_s%)} || \$6 == \"$2\")" | |
99 | else | |
100 | opt_s="(\$6 == \"$2\")" | |
101 | fi | |
102 | SELECTED='y' | |
103 | shift 2 ;; | |
104 | -v|--vendor) | |
105 | # echo "Option VENDOR: argument \`$2'" | |
106 | if [ "$opt_v" ] ; then | |
107 | opt_v="${opt_v%)} || \$5 == \"$2\")" | |
108 | else | |
109 | opt_v="(\$5 == \"$2\")" | |
110 | fi | |
111 | SELECTED='y' | |
112 | shift 2 ;; | |
7f79c6f2 MV |
113 | -l|--list) |
114 | ONLY_LIST='y' | |
115 | shift ;; | |
9b96c6b1 MV |
116 | -m|--maintainers) |
117 | ONLY_LIST='y' | |
118 | PRINT_MAINTS='y' | |
119 | MAINTAINERS_ONLY='y' | |
120 | shift ;; | |
121 | -M|--mails) | |
122 | ONLY_LIST='y' | |
123 | PRINT_MAINTS='y' | |
124 | shift ;; | |
d8e392d9 MF |
125 | -h|--help) |
126 | usage ;; | |
0777eafb WD |
127 | --) |
128 | shift ; break ;; | |
129 | *) | |
130 | echo "Internal error!" >&2 ; exit 1 ;; | |
131 | esac | |
132 | done | |
133 | # echo "Remaining arguments:" | |
134 | # for arg do echo '--> '"\`$arg'" ; done | |
135 | ||
136 | FILTER="\$1 !~ /^#/" | |
137 | [ "$opt_a" ] && FILTER="${FILTER} && $opt_a" | |
138 | [ "$opt_c" ] && FILTER="${FILTER} && $opt_c" | |
139 | [ "$opt_s" ] && FILTER="${FILTER} && $opt_s" | |
140 | [ "$opt_v" ] && FILTER="${FILTER} && $opt_v" | |
141 | ||
142 | if [ "$SELECTED" ] ; then | |
143 | SELECTED=$(awk '('"$FILTER"') { print $1 }' boards.cfg) | |
cd57b0bb PT |
144 | |
145 | # Make sure some boards from boards.cfg are actually found | |
146 | if [ -z "$SELECTED" ] ; then | |
147 | echo "Error: No boards selected, invalid arguments" | |
148 | exit 1 | |
149 | fi | |
0777eafb WD |
150 | fi |
151 | ||
152 | ######################################################################### | |
153 | ||
40a28f08 PT |
154 | # Print statistics when we exit |
155 | trap exit 1 2 3 15 | |
156 | trap print_stats 0 | |
157 | ||
7fa6a2f3 WD |
158 | # Determine number of CPU cores if no default was set |
159 | : ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"} | |
160 | ||
161 | if [ "$BUILD_NCPUS" -gt 1 ] | |
162 | then | |
55f786d8 | 163 | JOBS="-j $((BUILD_NCPUS + 1))" |
7fa6a2f3 WD |
164 | else |
165 | JOBS="" | |
166 | fi | |
167 | ||
a8c7c708 | 168 | |
7ebf7443 WD |
169 | if [ "${CROSS_COMPILE}" ] ; then |
170 | MAKE="make CROSS_COMPILE=${CROSS_COMPILE}" | |
171 | else | |
172 | MAKE=make | |
173 | fi | |
174 | ||
f9328639 MB |
175 | if [ "${MAKEALL_LOGDIR}" ] ; then |
176 | LOG_DIR=${MAKEALL_LOGDIR} | |
177 | else | |
178 | LOG_DIR="LOG" | |
179 | fi | |
887e2ec9 | 180 | |
f9328639 MB |
181 | if [ ! "${BUILD_DIR}" ] ; then |
182 | BUILD_DIR="." | |
183 | fi | |
184 | ||
4f0645eb | 185 | [ -d ${LOG_DIR} ] || mkdir ${LOG_DIR} || exit 1 |
7ebf7443 WD |
186 | |
187 | LIST="" | |
188 | ||
40a28f08 PT |
189 | # Keep track of the number of builds and errors |
190 | ERR_CNT=0 | |
191 | ERR_LIST="" | |
192 | TOTAL_CNT=0 | |
f2352877 | 193 | RC=0 |
40a28f08 | 194 | |
9ec49f8f MF |
195 | # Helper funcs for parsing boards.cfg |
196 | boards_by_field() | |
197 | { | |
198 | awk \ | |
199 | -v field="$1" \ | |
200 | -v select="$2" \ | |
201 | '($1 !~ /^#/ && $field == select) { print $1 }' \ | |
202 | boards.cfg | |
203 | } | |
204 | boards_by_arch() { boards_by_field 2 "$@" ; } | |
205 | boards_by_cpu() { boards_by_field 3 "$@" ; } | |
0a41edaa | 206 | boards_by_soc() { boards_by_field 6 "$@" ; } |
9ec49f8f | 207 | |
0db5bca8 WD |
208 | ######################################################################### |
209 | ## MPC5xx Systems | |
210 | ######################################################################### | |
211 | ||
9ec49f8f | 212 | LIST_5xx="$(boards_by_cpu mpc5xx)" |
0db5bca8 | 213 | |
945af8d7 WD |
214 | ######################################################################### |
215 | ## MPC5xxx Systems | |
216 | ######################################################################### | |
217 | ||
2ae18241 | 218 | LIST_5xxx="$(boards_by_cpu mpc5xxx)" |
945af8d7 | 219 | |
8993e54b RJ |
220 | ######################################################################### |
221 | ## MPC512x Systems | |
222 | ######################################################################### | |
223 | ||
2ae18241 | 224 | LIST_512x="$(boards_by_cpu mpc512x)" |
945af8d7 | 225 | |
7ebf7443 WD |
226 | ######################################################################### |
227 | ## MPC8xx Systems | |
228 | ######################################################################### | |
9ec49f8f | 229 | |
2ae18241 | 230 | LIST_8xx="$(boards_by_cpu mpc8xx)" |
7ebf7443 WD |
231 | |
232 | ######################################################################### | |
233 | ## PPC4xx Systems | |
234 | ######################################################################### | |
235 | ||
2ae18241 | 236 | LIST_4xx="$(boards_by_cpu ppc4xx)" |
7ebf7443 | 237 | |
983fda83 WD |
238 | ######################################################################### |
239 | ## MPC8220 Systems | |
240 | ######################################################################### | |
241 | ||
9ec49f8f | 242 | LIST_8220="$(boards_by_cpu mpc8220)" |
983fda83 | 243 | |
7ebf7443 WD |
244 | ######################################################################### |
245 | ## MPC824x Systems | |
246 | ######################################################################### | |
247 | ||
2ae18241 | 248 | LIST_824x="$(boards_by_cpu mpc824x)" |
592c5cab | 249 | |
7ebf7443 | 250 | ######################################################################### |
7aa78614 | 251 | ## MPC8260 Systems (includes 8250, 8255 etc.) |
7ebf7443 WD |
252 | ######################################################################### |
253 | ||
2ae18241 | 254 | LIST_8260="$(boards_by_cpu mpc8260)" |
7ebf7443 | 255 | |
f046ccd1 EL |
256 | ######################################################################### |
257 | ## MPC83xx Systems (includes 8349, etc.) | |
258 | ######################################################################### | |
259 | ||
2ae18241 | 260 | LIST_83xx="$(boards_by_cpu mpc83xx)" |
f046ccd1 | 261 | |
42d1f039 WD |
262 | ######################################################################### |
263 | ## MPC85xx Systems (includes 8540, 8560 etc.) | |
264 | ######################################################################### | |
265 | ||
2ae18241 | 266 | LIST_85xx="$(boards_by_cpu mpc85xx)" |
42d1f039 | 267 | |
822d5536 JL |
268 | ######################################################################### |
269 | ## MPC86xx Systems | |
270 | ######################################################################### | |
271 | ||
2ae18241 | 272 | LIST_86xx="$(boards_by_cpu mpc86xx)" |
822d5536 | 273 | |
7ebf7443 WD |
274 | ######################################################################### |
275 | ## 74xx/7xx Systems | |
276 | ######################################################################### | |
277 | ||
2ae18241 | 278 | LIST_74xx_7xx="$(boards_by_cpu 74xx_7xx)" |
7ebf7443 | 279 | |
d9a42c0a WD |
280 | ######################################################################### |
281 | ## PowerPC groups | |
282 | ######################################################################### | |
283 | ||
284 | LIST_TSEC=" \ | |
285 | ${LIST_83xx} \ | |
286 | ${LIST_85xx} \ | |
287 | ${LIST_86xx} \ | |
288 | " | |
289 | ||
a47a12be | 290 | LIST_powerpc=" \ |
fb56579f | 291 | ${LIST_5xx} \ |
3deca9d4 | 292 | ${LIST_512x} \ |
fb56579f KP |
293 | ${LIST_5xxx} \ |
294 | ${LIST_8xx} \ | |
295 | ${LIST_8220} \ | |
296 | ${LIST_824x} \ | |
297 | ${LIST_8260} \ | |
298 | ${LIST_83xx} \ | |
299 | ${LIST_85xx} \ | |
300 | ${LIST_86xx} \ | |
301 | ${LIST_4xx} \ | |
2ae18241 | 302 | ${LIST_74xx_7xx}\ |
fb56579f | 303 | " |
7ebf7443 | 304 | |
a47a12be SR |
305 | # Alias "ppc" -> "powerpc" to not break compatibility with older scripts |
306 | # still using "ppc" instead of "powerpc" | |
307 | LIST_ppc=" \ | |
308 | ${LIST_powerpc} \ | |
309 | " | |
310 | ||
7ebf7443 WD |
311 | ######################################################################### |
312 | ## StrongARM Systems | |
313 | ######################################################################### | |
314 | ||
9ec49f8f | 315 | LIST_SA="$(boards_by_cpu sa1100)" |
7ebf7443 | 316 | |
7ebf7443 WD |
317 | ######################################################################### |
318 | ## ARM9 Systems | |
319 | ######################################################################### | |
320 | ||
6a8760d7 WD |
321 | LIST_ARM9="$(boards_by_cpu arm920t) \ |
322 | $(boards_by_cpu arm926ejs) \ | |
323 | $(boards_by_cpu arm925t) \ | |
6f21347d | 324 | " |
7ebf7443 | 325 | |
8ed96046 WD |
326 | ######################################################################### |
327 | ## ARM11 Systems | |
328 | ######################################################################### | |
6a8760d7 | 329 | LIST_ARM11="$(boards_by_cpu arm1136) \ |
0c692673 GL |
330 | imx31_phycore \ |
331 | imx31_phycore_eet \ | |
8449f287 | 332 | mx31pdk \ |
0c692673 | 333 | smdk6400 \ |
74f4304e | 334 | " |
8ed96046 | 335 | |
f904cdbb | 336 | ######################################################################### |
f56348af | 337 | ## ARMV7 Systems |
f904cdbb | 338 | ######################################################################### |
f37586bb DB |
339 | |
340 | LIST_ARMV7="$(boards_by_cpu armv7)" | |
f904cdbb | 341 | |
602cac13 JCPV |
342 | ######################################################################### |
343 | ## AT91 Systems | |
344 | ######################################################################### | |
345 | ||
5cfeec51 | 346 | LIST_at91="$(boards_by_soc at91)" |
602cac13 | 347 | |
7ebf7443 WD |
348 | ######################################################################### |
349 | ## Xscale Systems | |
350 | ######################################################################### | |
351 | ||
7c957c0e | 352 | LIST_pxa="$(boards_by_cpu pxa)" |
7ebf7443 | 353 | |
9ec49f8f | 354 | LIST_ixp="$(boards_by_cpu ixp) |
fb56579f KP |
355 | pdnb3 \ |
356 | scpu \ | |
357 | " | |
7ebf7443 | 358 | |
d9a42c0a WD |
359 | ######################################################################### |
360 | ## ARM groups | |
361 | ######################################################################### | |
2d5b561e | 362 | |
f904cdbb DB |
363 | LIST_arm=" \ |
364 | ${LIST_SA} \ | |
f904cdbb DB |
365 | ${LIST_ARM9} \ |
366 | ${LIST_ARM10} \ | |
367 | ${LIST_ARM11} \ | |
f56348af | 368 | ${LIST_ARMV7} \ |
f904cdbb DB |
369 | ${LIST_at91} \ |
370 | ${LIST_pxa} \ | |
371 | ${LIST_ixp} \ | |
8ed96046 | 372 | " |
7ebf7443 | 373 | |
c021880a | 374 | ######################################################################### |
b62bdffb | 375 | ## MIPS Systems (default = big endian) |
c021880a WD |
376 | ######################################################################### |
377 | ||
fb56579f KP |
378 | LIST_mips4kc=" \ |
379 | incaip \ | |
0764c164 | 380 | qemu_mips \ |
2a61eff6 SR |
381 | vct_platinum \ |
382 | vct_platinum_small \ | |
383 | vct_platinum_onenand \ | |
384 | vct_platinum_onenand_small \ | |
385 | vct_platinumavc \ | |
386 | vct_platinumavc_small \ | |
387 | vct_platinumavc_onenand \ | |
388 | vct_platinumavc_onenand_small \ | |
389 | vct_premium \ | |
390 | vct_premium_small \ | |
391 | vct_premium_onenand \ | |
392 | vct_premium_onenand_small \ | |
fb56579f | 393 | " |
c021880a | 394 | |
fb56579f KP |
395 | LIST_au1xx0=" \ |
396 | dbau1000 \ | |
397 | dbau1100 \ | |
398 | dbau1500 \ | |
399 | dbau1550 \ | |
fb56579f KP |
400 | gth2 \ |
401 | " | |
5da627a4 | 402 | |
fb56579f KP |
403 | LIST_mips=" \ |
404 | ${LIST_mips4kc} \ | |
405 | ${LIST_mips5kc} \ | |
406 | ${LIST_au1xx0} \ | |
407 | " | |
c021880a | 408 | |
b62bdffb WD |
409 | ######################################################################### |
410 | ## MIPS Systems (little endian) | |
411 | ######################################################################### | |
412 | ||
92b09095 | 413 | LIST_xburst_el=" \ |
3c945542 XL |
414 | qi_lb60 \ |
415 | " | |
b62bdffb | 416 | |
fb56579f KP |
417 | LIST_au1xx0_el=" \ |
418 | dbau1550_el \ | |
b09258c5 | 419 | pb1000 \ |
fb56579f | 420 | " |
fb56579f | 421 | LIST_mips_el=" \ |
92b09095 | 422 | ${LIST_xburst_el} \ |
fb56579f KP |
423 | ${LIST_au1xx0_el} \ |
424 | " | |
deddf5d2 SK |
425 | ######################################################################### |
426 | ## OpenRISC Systems | |
427 | ######################################################################### | |
428 | ||
429 | LIST_openrisc="$(boards_by_arch openrisc)" | |
b62bdffb | 430 | |
7a8e9bed | 431 | ######################################################################### |
fea25720 | 432 | ## x86 Systems |
7a8e9bed WD |
433 | ######################################################################### |
434 | ||
fea25720 | 435 | LIST_x86="$(boards_by_arch x86)" |
7a8e9bed | 436 | |
5c952cf0 WD |
437 | ######################################################################### |
438 | ## Nios-II Systems | |
439 | ######################################################################### | |
440 | ||
4827d067 | 441 | LIST_nios2="$(boards_by_arch nios2)" |
5c952cf0 | 442 | |
857cad37 WD |
443 | ######################################################################### |
444 | ## MicroBlaze Systems | |
445 | ######################################################################### | |
446 | ||
9ec49f8f | 447 | LIST_microblaze="$(boards_by_arch microblaze)" |
857cad37 | 448 | |
f8c3b4f3 ZL |
449 | ######################################################################### |
450 | ## ColdFire Systems | |
451 | ######################################################################### | |
452 | ||
c13f47b0 | 453 | LIST_m68k="$(boards_by_arch m68k) |
fb56579f KP |
454 | EB+MCF-EV123 \ |
455 | EB+MCF-EV123_internal \ | |
1552af70 | 456 | M52277EVB \ |
4a442d31 | 457 | M5235EVB \ |
05316f8e | 458 | M54451EVB \ |
8ae158cd | 459 | M54455EVB \ |
9acb626f | 460 | " |
c13f47b0 | 461 | LIST_coldfire=${LIST_m68k} |
f8c3b4f3 | 462 | |
6ccec449 WD |
463 | ######################################################################### |
464 | ## AVR32 Systems | |
465 | ######################################################################### | |
466 | ||
9ec49f8f | 467 | LIST_avr32="$(boards_by_arch avr32)" |
6ccec449 | 468 | |
ef26a08f AL |
469 | ######################################################################### |
470 | ## Blackfin Systems | |
471 | ######################################################################### | |
472 | ||
36cf8cb4 | 473 | LIST_blackfin="$(boards_by_arch blackfin)" |
ef26a08f | 474 | |
c7144373 JCPV |
475 | ######################################################################### |
476 | ## SH Systems | |
477 | ######################################################################### | |
478 | ||
e0f0e527 | 479 | LIST_sh2="$(boards_by_cpu sh2)" |
3771c69d | 480 | LIST_sh3="$(boards_by_cpu sh3)" |
03626be3 | 481 | LIST_sh4="$(boards_by_cpu sh4)" |
d9a42c0a | 482 | |
03626be3 | 483 | LIST_sh="$(boards_by_arch sh)" |
c7144373 | 484 | |
c2f02da2 DH |
485 | ######################################################################### |
486 | ## SPARC Systems | |
487 | ######################################################################### | |
488 | ||
9ec49f8f | 489 | LIST_sparc="$(boards_by_arch sparc)" |
7ebf7443 | 490 | |
5f1719c1 ML |
491 | ######################################################################### |
492 | ## NDS32 Systems | |
493 | ######################################################################### | |
494 | ||
495 | LIST_nds32="$(boards_by_arch nds32)" | |
496 | ||
7ebf7443 WD |
497 | #----------------------------------------------------------------------- |
498 | ||
9b96c6b1 MV |
499 | get_target_location() { |
500 | local target=$1 | |
501 | local BOARD_NAME="" | |
502 | local CONFIG_NAME="" | |
503 | local board="" | |
504 | local vendor="" | |
505 | ||
506 | # Automatic mode | |
507 | local line=`egrep -i "^[[:space:]]*${target}[[:space:]]" boards.cfg` | |
508 | ||
509 | if [ -z "${line}" ] ; then echo "" ; return ; fi | |
510 | ||
511 | set ${line} | |
512 | ||
513 | # add default board name if needed | |
514 | [ $# = 3 ] && set ${line} ${1} | |
515 | ||
516 | CONFIG_NAME="${1%_config}" | |
517 | ||
518 | [ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}" | |
519 | ||
520 | if [ "$4" = "-" ] ; then | |
521 | board=${BOARD_NAME} | |
522 | else | |
523 | board="$4" | |
524 | fi | |
525 | ||
526 | [ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5" | |
527 | [ $# -gt 6 ] && [ "$7" != "-" ] && { | |
528 | tmp="${7%:*}" | |
529 | if [ "$tmp" ] ; then | |
530 | CONFIG_NAME="$tmp" | |
531 | fi | |
532 | } | |
533 | ||
534 | # Assign board directory to BOARDIR variable | |
535 | if [ -z "${vendor}" ] ; then | |
536 | BOARDDIR=${board} | |
537 | else | |
538 | BOARDDIR=${vendor}/${board} | |
539 | fi | |
540 | ||
541 | echo "${CONFIG_NAME}:${BOARDDIR}" | |
542 | } | |
543 | ||
544 | get_target_maintainers() { | |
545 | local name=`echo $1 | cut -d : -f 1` | |
546 | ||
547 | if ! grep -qsi "[[:blank:]]${name}[[:blank:]]" MAINTAINERS ; then | |
548 | echo "" | |
549 | return ; | |
550 | fi | |
551 | ||
552 | local line=`tac MAINTAINERS | grep -ni "[[:blank:]]${name}[[:blank:]]" | cut -d : -f 1` | |
553 | local mail=`tac MAINTAINERS | tail -n +${line} | \ | |
554 | sed -n ":start /.*@.*/ { b mail } ; n ; b start ; :mail /.*@.*/ { p ; n ; b mail } ; q" | \ | |
555 | sed "s/^.*<//;s/>.*$//"` | |
556 | echo "$mail" | |
557 | } | |
558 | ||
559 | list_target() { | |
560 | if [ "$PRINT_MAINTS" != 'y' ] ; then | |
561 | echo "$1" | |
562 | return | |
563 | fi | |
564 | ||
565 | echo -n "$1:" | |
566 | ||
567 | local loc=`get_target_location $1` | |
568 | ||
569 | if [ -z "${loc}" ] ; then echo "ERROR" ; return ; fi | |
570 | ||
571 | local maintainers_result=`get_target_maintainers ${loc} | tr " " "\n"` | |
572 | ||
573 | if [ "$MAINTAINERS_ONLY" != 'y' ] ; then | |
574 | ||
575 | local dir=`echo ${loc} | cut -d ":" -f 2` | |
576 | local cfg=`echo ${loc} | cut -d ":" -f 1` | |
577 | local git_result=`git log --format=%aE board/${dir} \ | |
578 | include/configs/${cfg}.h | grep "@"` | |
579 | local git_result_recent=`echo ${git_result} | tr " " "\n" | \ | |
580 | head -n 3` | |
581 | local git_result_top=`echo ${git_result} | tr " " "\n" | \ | |
582 | sort | uniq -c | sort -nr | head -n 3 | \ | |
583 | sed "s/^ \+[0-9]\+ \+//"` | |
584 | ||
585 | echo -e "$git_result_recent\n$git_result_top\n$maintainers_result" | \ | |
586 | sort -u | tr "\n" " " | sed "s/ $//" ; | |
587 | else | |
588 | echo -e "$maintainers_result" | sort -u | tr "\n" " " | \ | |
589 | sed "s/ $//" ; | |
590 | fi | |
591 | ||
592 | echo "" | |
593 | } | |
594 | ||
7ebf7443 WD |
595 | build_target() { |
596 | target=$1 | |
597 | ||
7f79c6f2 | 598 | if [ "$ONLY_LIST" == 'y' ] ; then |
9b96c6b1 | 599 | list_target ${target} |
7f79c6f2 MV |
600 | return |
601 | fi | |
602 | ||
7ebf7443 | 603 | ${MAKE} distclean >/dev/null |
d70d8ccc | 604 | ${MAKE} -s ${target}_config |
f9328639 MB |
605 | |
606 | ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \ | |
607 | | tee ${LOG_DIR}/$target.ERR | |
f2352877 PT |
608 | |
609 | # Check for 'make' errors | |
610 | if [ ${PIPESTATUS[0]} -ne 0 ] ; then | |
611 | RC=1 | |
612 | fi | |
613 | ||
40a28f08 PT |
614 | if [ -s ${LOG_DIR}/$target.ERR ] ; then |
615 | ERR_CNT=$((ERR_CNT + 1)) | |
616 | ERR_LIST="${ERR_LIST} $target" | |
617 | else | |
618 | rm ${LOG_DIR}/$target.ERR | |
619 | fi | |
620 | ||
621 | TOTAL_CNT=$((TOTAL_CNT + 1)) | |
f9328639 | 622 | |
0c185696 SW |
623 | OBJS=${BUILD_DIR}/u-boot |
624 | if [ -e ${BUILD_DIR}/spl/u-boot-spl ]; then | |
625 | OBJS="${OBJS} ${BUILD_DIR}/spl/u-boot-spl" | |
626 | fi | |
627 | ||
628 | ${CROSS_COMPILE}size ${OBJS} | tee -a ${LOG_DIR}/$target.MAKELOG | |
7ebf7443 | 629 | } |
9ec49f8f MF |
630 | build_targets() { |
631 | for t in "$@" ; do | |
632 | # If a LIST_xxx var exists, use it. But avoid variable | |
633 | # expansion in the eval when a board name contains certain | |
634 | # characters that the shell interprets. | |
635 | case ${t} in | |
636 | *[-+=]*) list= ;; | |
637 | *) list=$(eval echo '${LIST_'$t'}') ;; | |
638 | esac | |
639 | if [ -n "${list}" ] ; then | |
640 | build_targets ${list} | |
641 | else | |
642 | build_target ${t} | |
643 | fi | |
644 | done | |
645 | } | |
7ebf7443 WD |
646 | |
647 | #----------------------------------------------------------------------- | |
648 | ||
40a28f08 | 649 | print_stats() { |
7f79c6f2 | 650 | if [ "$ONLY_LIST" == 'y' ] ; then return ; fi |
40a28f08 PT |
651 | echo "" |
652 | echo "--------------------- SUMMARY ----------------------------" | |
653 | echo "Boards compiled: ${TOTAL_CNT}" | |
654 | if [ ${ERR_CNT} -gt 0 ] ; then | |
655 | echo "Boards with warnings or errors: ${ERR_CNT} (${ERR_LIST} )" | |
656 | fi | |
657 | echo "----------------------------------------------------------" | |
f2352877 PT |
658 | |
659 | exit $RC | |
40a28f08 | 660 | } |
7ebf7443 | 661 | |
40a28f08 | 662 | #----------------------------------------------------------------------- |
9ec49f8f | 663 | |
0777eafb WD |
664 | # Build target groups selected by options, plus any command line args |
665 | set -- ${SELECTED} "$@" | |
666 | # run PowerPC by default | |
9ec49f8f | 667 | [ $# = 0 ] && set -- powerpc |
9ec49f8f | 668 | build_targets "$@" |