Makefile: move all Power Architecture boards into boards.cfg
[pandora-u-boot.git] / MAKEALL
1 #!/bin/bash
2
3 # Print statistics when we exit
4 trap exit 1 2 3 15
5 trap print_stats 0
6
7 # Determine number of CPU cores if no default was set
8 : ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"}
9
10 if [ "$BUILD_NCPUS" -gt 1 ]
11 then
12         JOBS="-j $((BUILD_NCPUS + 1))"
13 else
14         JOBS=""
15 fi
16
17
18 if [ "${CROSS_COMPILE}" ] ; then
19         MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
20 else
21         MAKE=make
22 fi
23
24 if [ "${MAKEALL_LOGDIR}" ] ; then
25         LOG_DIR=${MAKEALL_LOGDIR}
26 else
27         LOG_DIR="LOG"
28 fi
29
30 if [ ! "${BUILD_DIR}" ] ; then
31         BUILD_DIR="."
32 fi
33
34 [ -d ${LOG_DIR} ] || mkdir ${LOG_DIR} || exit 1
35
36 LIST=""
37
38 # Keep track of the number of builds and errors
39 ERR_CNT=0
40 ERR_LIST=""
41 TOTAL_CNT=0
42 RC=0
43
44 # Helper funcs for parsing boards.cfg
45 boards_by_field()
46 {
47         awk \
48                 -v field="$1" \
49                 -v select="$2" \
50                 '($1 !~ /^#/ && $field == select) { print $1 }' \
51                 boards.cfg
52 }
53 boards_by_arch() { boards_by_field 2 "$@" ; }
54 boards_by_cpu()  { boards_by_field 3 "$@" ; }
55
56 #########################################################################
57 ## MPC5xx Systems
58 #########################################################################
59
60 LIST_5xx="$(boards_by_cpu mpc5xx)"
61
62 #########################################################################
63 ## MPC5xxx Systems
64 #########################################################################
65
66 LIST_5xxx="$(boards_by_cpu mpc5xxx)"
67
68 #########################################################################
69 ## MPC512x Systems
70 #########################################################################
71
72 LIST_512x="$(boards_by_cpu mpc512x)"
73
74 #########################################################################
75 ## MPC8xx Systems
76 #########################################################################
77
78 LIST_8xx="$(boards_by_cpu mpc8xx)"
79
80 #########################################################################
81 ## PPC4xx Systems
82 #########################################################################
83
84 LIST_4xx="$(boards_by_cpu ppc4xx)"
85
86 #########################################################################
87 ## MPC8220 Systems
88 #########################################################################
89
90 LIST_8220="$(boards_by_cpu mpc8220)"
91
92 #########################################################################
93 ## MPC824x Systems
94 #########################################################################
95
96 LIST_824x="$(boards_by_cpu mpc824x)"
97
98 #########################################################################
99 ## MPC8260 Systems (includes 8250, 8255 etc.)
100 #########################################################################
101
102 LIST_8260="$(boards_by_cpu mpc8260)"
103
104 #########################################################################
105 ## MPC83xx Systems (includes 8349, etc.)
106 #########################################################################
107
108 LIST_83xx="$(boards_by_cpu mpc83xx)"
109
110 #########################################################################
111 ## MPC85xx Systems (includes 8540, 8560 etc.)
112 #########################################################################
113
114 LIST_85xx="$(boards_by_cpu mpc85xx)"
115
116 #########################################################################
117 ## MPC86xx Systems
118 #########################################################################
119
120 LIST_86xx="$(boards_by_cpu mpc86xx)"
121
122 #########################################################################
123 ## 74xx/7xx Systems
124 #########################################################################
125
126 LIST_74xx_7xx="$(boards_by_cpu 74xx_7xx)"
127
128 #########################################################################
129 ## PowerPC groups
130 #########################################################################
131
132 LIST_TSEC="             \
133         ${LIST_83xx}    \
134         ${LIST_85xx}    \
135         ${LIST_86xx}    \
136 "
137
138 LIST_powerpc="          \
139         ${LIST_5xx}     \
140         ${LIST_512x}    \
141         ${LIST_5xxx}    \
142         ${LIST_8xx}     \
143         ${LIST_8220}    \
144         ${LIST_824x}    \
145         ${LIST_8260}    \
146         ${LIST_83xx}    \
147         ${LIST_85xx}    \
148         ${LIST_86xx}    \
149         ${LIST_4xx}     \
150         ${LIST_74xx_7xx}\
151 "
152
153 # Alias "ppc" -> "powerpc" to not break compatibility with older scripts
154 # still using "ppc" instead of "powerpc"
155 LIST_ppc="              \
156         ${LIST_powerpc} \
157 "
158
159 #########################################################################
160 ## StrongARM Systems
161 #########################################################################
162
163 LIST_SA="$(boards_by_cpu sa1100)"
164
165 #########################################################################
166 ## ARM7 Systems
167 #########################################################################
168
169 LIST_ARM7="             \
170         ap7             \
171         ap720t          \
172         armadillo       \
173         B2              \
174         ep7312          \
175         evb4510         \
176         impa7           \
177         integratorap    \
178         lpc2292sodimm   \
179         modnet50        \
180         SMN42           \
181 "
182
183 #########################################################################
184 ## ARM9 Systems
185 #########################################################################
186
187 LIST_ARM9="                     \
188         a320evb                 \
189         ap920t                  \
190         ap922_XA10              \
191         ap926ejs                \
192         ap946es                 \
193         ap966                   \
194         cp920t                  \
195         cp922_XA10              \
196         cp926ejs                \
197         cp946es                 \
198         cp966                   \
199         da830evm                \
200         da850evm                \
201         edb9301                 \
202         edb9302                 \
203         edb9302a                \
204         edb9307                 \
205         edb9307a                \
206         edb9312                 \
207         edb9315                 \
208         edb9315a                \
209         edminiv2                \
210         guruplug                \
211         imx27lite               \
212         jadecpu                 \
213         lpd7a400                \
214         magnesium               \
215         mv88f6281gtw_ge         \
216         mx1ads                  \
217         mx1fs2                  \
218         netstar                 \
219         nhk8815                 \
220         nhk8815_onenand         \
221         omap1510inn             \
222         omap1610h2              \
223         omap1610inn             \
224         omap5912osk             \
225         omap730p2               \
226         openrd_base             \
227         rd6281a                 \
228         sbc2410x                \
229         scb9328                 \
230         sheevaplug              \
231         smdk2400                \
232         smdk2410                \
233         spear300                \
234         spear310                \
235         spear320                \
236         spear600                \
237         suen3                   \
238         trab                    \
239         VCMA9                   \
240         versatile               \
241         versatileab             \
242         versatilepb             \
243         voiceblue               \
244         davinci_dvevm           \
245         davinci_schmoogie       \
246         davinci_sffsdr          \
247         davinci_sonata          \
248         davinci_dm355evm        \
249         davinci_dm355leopard    \
250         davinci_dm365evm        \
251         davinci_dm6467evm       \
252 "
253
254 #########################################################################
255 ## ARM10 Systems
256 #########################################################################
257 LIST_ARM10="            \
258         integratorcp    \
259         cp1026          \
260 "
261
262 #########################################################################
263 ## ARM11 Systems
264 #########################################################################
265 LIST_ARM11="                    \
266         cp1136                  \
267         omap2420h4              \
268         apollon                 \
269         imx31_litekit           \
270         imx31_phycore           \
271         imx31_phycore_eet       \
272         mx31ads                 \
273         mx31pdk                 \
274         mx31pdk_nand            \
275         qong                    \
276         smdk6400                \
277         tnetv107x_evm           \
278 "
279
280 #########################################################################
281 ## ARMV7 Systems
282 #########################################################################
283 LIST_ARMV7="            \
284         am3517_evm              \
285         ca9x4_ct_vxp            \
286         devkit8000              \
287         igep0020                \
288         igep0030                \
289         mx51evk                 \
290         omap3_beagle            \
291         omap3_overo             \
292         omap3_evm               \
293         omap3_pandora           \
294         omap3_sdp3430           \
295         omap3_zoom1             \
296         omap3_zoom2             \
297         omap4_panda             \
298         omap4_sdp4430           \
299         s5p_goni                \
300         smdkc100                \
301 "
302
303 #########################################################################
304 ## AT91 Systems
305 #########################################################################
306
307 LIST_at91="                     \
308         afeb9260                \
309         at91cap9adk             \
310         at91rm9200dk            \
311         at91rm9200ek            \
312         at91sam9260ek           \
313         at91sam9261ek           \
314         at91sam9263ek           \
315         at91sam9g10ek           \
316         at91sam9g20ek           \
317         at91sam9m10g45ek        \
318         at91sam9rlek            \
319         cmc_pu2                 \
320         CPUAT91                 \
321         CPU9260                 \
322         CPU9G20                 \
323         csb637                  \
324         eb_cpux9k2              \
325         kb9202                  \
326         meesc                   \
327         mp2usb                  \
328         m501sk                  \
329         otc570                  \
330         pm9261                  \
331         pm9263                  \
332         pm9g45                  \
333         SBC35_A9G20             \
334         TNY_A9260               \
335         TNY_A9G20               \
336 "
337
338 #########################################################################
339 ## Xscale Systems
340 #########################################################################
341
342 LIST_pxa="$(boards_by_cpu pxa)
343         polaris         \
344         trizepsiv       \
345         vpac270_nor     \
346         vpac270_onenand \
347 "
348
349 LIST_ixp="$(boards_by_cpu ixp)
350         pdnb3           \
351         scpu            \
352 "
353
354 #########################################################################
355 ## ARM groups
356 #########################################################################
357
358 LIST_arm="                      \
359         ${LIST_SA}              \
360         ${LIST_ARM7}            \
361         ${LIST_ARM9}            \
362         ${LIST_ARM10}           \
363         ${LIST_ARM11}           \
364         ${LIST_ARMV7}   \
365         ${LIST_at91}            \
366         ${LIST_pxa}             \
367         ${LIST_ixp}             \
368 "
369
370 #########################################################################
371 ## MIPS Systems         (default = big endian)
372 #########################################################################
373
374 LIST_mips4kc="          \
375         incaip          \
376         qemu_mips       \
377         vct_platinum    \
378         vct_platinum_small      \
379         vct_platinum_onenand    \
380         vct_platinum_onenand_small      \
381         vct_platinumavc \
382         vct_platinumavc_small   \
383         vct_platinumavc_onenand \
384         vct_platinumavc_onenand_small   \
385         vct_premium     \
386         vct_premium_small       \
387         vct_premium_onenand     \
388         vct_premium_onenand_small       \
389 "
390
391 LIST_mips5kc="          \
392         purple          \
393 "
394
395 LIST_au1xx0="           \
396         dbau1000        \
397         dbau1100        \
398         dbau1500        \
399         dbau1550        \
400         dbau1550_el     \
401         gth2            \
402 "
403
404 LIST_mips="             \
405         ${LIST_mips4kc} \
406         ${LIST_mips5kc} \
407         ${LIST_au1xx0}  \
408 "
409
410 #########################################################################
411 ## MIPS Systems         (little endian)
412 #########################################################################
413
414 LIST_mips4kc_el=""
415
416 LIST_mips5kc_el=""
417
418 LIST_au1xx0_el="        \
419         dbau1550_el     \
420         pb1000          \
421 "
422
423 LIST_mips_el="                  \
424         ${LIST_mips4kc_el}      \
425         ${LIST_mips5kc_el}      \
426         ${LIST_au1xx0_el}       \
427 "
428
429 #########################################################################
430 ## i386 Systems
431 #########################################################################
432
433 LIST_x86="$(boards_by_arch i386)
434         sc520_eNET      \
435 "
436
437 #########################################################################
438 ## Nios-II Systems
439 #########################################################################
440
441 LIST_nios2="$(boards_by_arch nios2)
442         nios2-generic   \
443 "
444
445 #########################################################################
446 ## MicroBlaze Systems
447 #########################################################################
448
449 LIST_microblaze="$(boards_by_arch microblaze)"
450
451 #########################################################################
452 ## ColdFire Systems
453 #########################################################################
454
455 LIST_coldfire="$(boards_by_arch m68k)
456         astro_mcf5373l          \
457         cobra5272               \
458         EB+MCF-EV123            \
459         EB+MCF-EV123_internal   \
460         M52277EVB               \
461         M5235EVB                \
462         M5329AFEE               \
463         M5373EVB                \
464         M54451EVB               \
465         M54455EVB               \
466         M5475AFE                \
467         M5485AFE                \
468 "
469
470 #########################################################################
471 ## AVR32 Systems
472 #########################################################################
473
474 LIST_avr32="$(boards_by_arch avr32)"
475
476 #########################################################################
477 ## Blackfin Systems
478 #########################################################################
479
480 LIST_blackfin="$(boards_by_arch blackfin)
481         bf527-ezkit-v2
482 "
483
484 #########################################################################
485 ## SH Systems
486 #########################################################################
487
488 LIST_sh2="              \
489         rsk7203         \
490 "
491 LIST_sh3="              \
492         mpr2            \
493         ms7720se        \
494 "
495
496 LIST_sh4="              \
497         ms7750se        \
498         ms7722se        \
499         MigoR           \
500         r7780mp         \
501         r2dplus         \
502         sh7763rdp       \
503         sh7785lcr       \
504         ap325rxa        \
505         espt            \
506 "
507
508 LIST_sh="               \
509         ${LIST_sh2}     \
510         ${LIST_sh3}     \
511         ${LIST_sh4}     \
512 "
513
514 #########################################################################
515 ## SPARC Systems
516 #########################################################################
517
518 LIST_sparc="$(boards_by_arch sparc)"
519
520 #-----------------------------------------------------------------------
521
522 build_target() {
523         target=$1
524
525         ${MAKE} distclean >/dev/null
526         ${MAKE} -s ${target}_config
527
528         ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
529                                 | tee ${LOG_DIR}/$target.ERR
530
531         # Check for 'make' errors
532         if [ ${PIPESTATUS[0]} -ne 0 ] ; then
533                 RC=1
534         fi
535
536         if [ -s ${LOG_DIR}/$target.ERR ] ; then
537                 ERR_CNT=$((ERR_CNT + 1))
538                 ERR_LIST="${ERR_LIST} $target"
539         else
540                 rm ${LOG_DIR}/$target.ERR
541         fi
542
543         TOTAL_CNT=$((TOTAL_CNT + 1))
544
545         ${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \
546                                 | tee -a ${LOG_DIR}/$target.MAKELOG
547 }
548 build_targets() {
549         for t in "$@" ; do
550                 # If a LIST_xxx var exists, use it.  But avoid variable
551                 # expansion in the eval when a board name contains certain
552                 # characters that the shell interprets.
553                 case ${t} in
554                         *[-+=]*) list= ;;
555                         *)       list=$(eval echo '${LIST_'$t'}') ;;
556                 esac
557                 if [ -n "${list}" ] ; then
558                         build_targets ${list}
559                 else
560                         build_target ${t}
561                 fi
562         done
563 }
564
565 #-----------------------------------------------------------------------
566
567 print_stats() {
568         echo ""
569         echo "--------------------- SUMMARY ----------------------------"
570         echo "Boards compiled: ${TOTAL_CNT}"
571         if [ ${ERR_CNT} -gt 0 ] ; then
572                 echo "Boards with warnings or errors: ${ERR_CNT} (${ERR_LIST} )"
573         fi
574         echo "----------------------------------------------------------"
575
576         exit $RC
577 }
578
579 #-----------------------------------------------------------------------
580
581 #----- for now, just run PowerPC by default -----
582 [ $# = 0 ] && set -- powerpc
583
584 build_targets "$@"