[U-Boot] [PATCH/RFC] MAKEALL: allow people to specify arch/cpu/soc/vendor names

Rather than maintain a hand coded list of targets which represent cpus/etc and expand into a bunch of board names, add automatic look up to all targets. This makes target selection a bit more natural imo, and keeps down on code duplication.
Signed-off-by: Mike Frysinger vapier@gentoo.org --- MAKEALL | 384 ++++++++++++++++++++------------------------------------------- 1 files changed, 120 insertions(+), 264 deletions(-)
diff --git a/MAKEALL b/MAKEALL index f582f8b..58a557d 100755 --- a/MAKEALL +++ b/MAKEALL @@ -185,304 +185,134 @@ boards_by_field() } boards_by_arch() { boards_by_field 2 "$@" ; } boards_by_cpu() { boards_by_field 3 "$@" ; } +boards_by_vend() { boards_by_field 5 "$@" ; } boards_by_soc() { boards_by_field 6 "$@" ; }
######################################################################### -## MPC5xx Systems -######################################################################### - -LIST_5xx="$(boards_by_cpu mpc5xx)" - -######################################################################### -## MPC5xxx Systems -######################################################################### - -LIST_5xxx="$(boards_by_cpu mpc5xxx)" - -######################################################################### -## MPC512x Systems -######################################################################### - -LIST_512x="$(boards_by_cpu mpc512x)" - -######################################################################### -## MPC8xx Systems -######################################################################### - -LIST_8xx="$(boards_by_cpu mpc8xx)" - -######################################################################### -## PPC4xx Systems -######################################################################### - -LIST_4xx="$(boards_by_cpu ppc4xx)" - -######################################################################### -## MPC8220 Systems -######################################################################### - -LIST_8220="$(boards_by_cpu mpc8220)" - -######################################################################### -## MPC824x Systems -######################################################################### - -LIST_824x="$(boards_by_cpu mpc824x)" - -######################################################################### -## MPC8260 Systems (includes 8250, 8255 etc.) -######################################################################### - -LIST_8260="$(boards_by_cpu mpc8260)" - -######################################################################### -## MPC83xx Systems (includes 8349, etc.) -######################################################################### - -LIST_83xx="$(boards_by_cpu mpc83xx)" - -######################################################################### -## MPC85xx Systems (includes 8540, 8560 etc.) -######################################################################### - -LIST_85xx="$(boards_by_cpu mpc85xx)" - -######################################################################### -## MPC86xx Systems -######################################################################### - -LIST_86xx="$(boards_by_cpu mpc86xx)" - -######################################################################### -## 74xx/7xx Systems -######################################################################### - -LIST_74xx_7xx="$(boards_by_cpu 74xx_7xx)" - -######################################################################### ## PowerPC groups ######################################################################### +for v in 5xx 5xxx 512x 8xx 8220 824x 8260 83xx 85xx 86xx ; do + eval LIST_${v}="$(boards_by_cpu mpc${v})" +done +LIST_4xx="$(boards_by_cpu ppc4xx)"
-LIST_TSEC=" \ - ${LIST_83xx} \ - ${LIST_85xx} \ - ${LIST_86xx} \ -" - -LIST_powerpc=" \ - ${LIST_5xx} \ - ${LIST_512x} \ - ${LIST_5xxx} \ - ${LIST_8xx} \ - ${LIST_8220} \ - ${LIST_824x} \ - ${LIST_8260} \ - ${LIST_83xx} \ - ${LIST_85xx} \ - ${LIST_86xx} \ - ${LIST_4xx} \ - ${LIST_74xx_7xx}\ +LIST_TSEC=" + ${LIST_83xx} + ${LIST_85xx} + ${LIST_86xx} "
# Alias "ppc" -> "powerpc" to not break compatibility with older scripts # still using "ppc" instead of "powerpc" -LIST_ppc=" \ - ${LIST_powerpc} \ -" +LIST_ppc="$(boards_by_arch powerpc)"
######################################################################### -## StrongARM Systems +## ARM groups #########################################################################
LIST_SA="$(boards_by_cpu sa1100)"
-######################################################################### -## ARM9 Systems -######################################################################### - -LIST_ARM9="$(boards_by_cpu arm920t) \ - $(boards_by_cpu arm926ejs) \ - $(boards_by_cpu arm925t) \ - omap1610h2 \ - omap1610inn \ - omap730p2 \ +LIST_ARM9=" + $(boards_by_cpu arm920t) + $(boards_by_cpu arm926ejs) + $(boards_by_cpu arm925t) + omap1610h2 + omap1610inn + omap730p2 "
-######################################################################### -## ARM11 Systems -######################################################################### -LIST_ARM11="$(boards_by_cpu arm1136) \ - apollon \ - imx31_phycore \ - imx31_phycore_eet \ - mx31pdk \ - mx31pdk_nand \ - smdk6400 \ +LIST_ARM11=" + $(boards_by_cpu arm1136) + apollon + imx31_phycore + imx31_phycore_eet + mx31pdk + mx31pdk_nand + smdk6400 "
-######################################################################### -## ARMV7 Systems -######################################################################### - LIST_ARMV7="$(boards_by_cpu armv7)"
-######################################################################### -## AT91 Systems -######################################################################### - -LIST_at91="$(boards_by_soc at91)" - -######################################################################### -## Xscale Systems -######################################################################### - -LIST_pxa="$(boards_by_cpu pxa)" - -LIST_ixp="$(boards_by_cpu ixp) - pdnb3 \ - scpu \ +LIST_ixp=" + $(boards_by_cpu ixp) + pdnb3 + scpu "
######################################################################### -## ARM groups -######################################################################### - -LIST_arm=" \ - ${LIST_SA} \ - ${LIST_ARM9} \ - ${LIST_ARM10} \ - ${LIST_ARM11} \ - ${LIST_ARMV7} \ - ${LIST_at91} \ - ${LIST_pxa} \ - ${LIST_ixp} \ +## MIPS groups +######################################################################### + +LIST_mips4kc=" + incaip + qemu_mips + vct_platinum + vct_platinum_small + vct_platinum_onenand + vct_platinum_onenand_small + vct_platinumavc + vct_platinumavc_small + vct_platinumavc_onenand + vct_platinumavc_onenand_small + vct_premium + vct_premium_small + vct_premium_onenand + vct_premium_onenand_small "
-######################################################################### -## MIPS Systems (default = big endian) -######################################################################### - -LIST_mips4kc=" \ - incaip \ - qemu_mips \ - vct_platinum \ - vct_platinum_small \ - vct_platinum_onenand \ - vct_platinum_onenand_small \ - vct_platinumavc \ - vct_platinumavc_small \ - vct_platinumavc_onenand \ - vct_platinumavc_onenand_small \ - vct_premium \ - vct_premium_small \ - vct_premium_onenand \ - vct_premium_onenand_small \ +LIST_au1xx0=" + dbau1000 + dbau1100 + dbau1500 + dbau1550 + dbau1550_el + gth2 "
-LIST_mips5kc="" - -LIST_au1xx0=" \ - dbau1000 \ - dbau1100 \ - dbau1500 \ - dbau1550 \ - dbau1550_el \ - gth2 \ +LIST_mips_eb=" + ${LIST_mips4kc} + ${LIST_mips5kc} + ${LIST_au1xx0} "
-LIST_mips=" \ - ${LIST_mips4kc} \ - ${LIST_mips5kc} \ - ${LIST_au1xx0} \ -" - -######################################################################### -## MIPS Systems (little endian) -######################################################################### - -LIST_mips4kc_el=" \ - qi_lb60 \ +LIST_mips4kc_el=" + qi_lb60 "
LIST_mips5kc_el=""
-LIST_au1xx0_el=" \ - dbau1550_el \ - pb1000 \ +LIST_au1xx0_el=" + dbau1550_el + pb1000 "
-LIST_mips_el=" \ - ${LIST_mips4kc_el} \ - ${LIST_mips5kc_el} \ - ${LIST_au1xx0_el} \ +LIST_mips_el=" + ${LIST_mips4kc_el} + ${LIST_mips5kc_el} + ${LIST_au1xx0_el} "
######################################################################### -## x86 Systems -######################################################################### - -LIST_x86="$(boards_by_arch x86)" - -######################################################################### -## Nios-II Systems -######################################################################### - -LIST_nios2="$(boards_by_arch nios2)" - -######################################################################### -## MicroBlaze Systems -######################################################################### - -LIST_microblaze="$(boards_by_arch microblaze)" - -######################################################################### ## ColdFire Systems #########################################################################
-LIST_m68k="$(boards_by_arch m68k) - astro_mcf5373l \ - cobra5272 \ - EB+MCF-EV123 \ - EB+MCF-EV123_internal \ - M52277EVB \ - M5235EVB \ - M5329AFEE \ - M5373EVB \ - M54451EVB \ - M54455EVB \ - M5475AFE \ - M5485AFE \ +LIST_m68k=" + $(boards_by_arch m68k) + astro_mcf5373l + cobra5272 + EB+MCF-EV123 + EB+MCF-EV123_internal + M52277EVB + M5235EVB + M5329AFEE + M5373EVB + M54451EVB + M54455EVB + M5475AFE + M5485AFE " LIST_coldfire=${LIST_m68k}
-######################################################################### -## AVR32 Systems -######################################################################### - -LIST_avr32="$(boards_by_arch avr32)" - -######################################################################### -## Blackfin Systems -######################################################################### - -LIST_blackfin="$(boards_by_arch blackfin)" - -######################################################################### -## SH Systems -######################################################################### - -LIST_sh2="$(boards_by_cpu sh2)" -LIST_sh3="$(boards_by_cpu sh3)" -LIST_sh4="$(boards_by_cpu sh4)" - -LIST_sh="$(boards_by_arch sh)" - -######################################################################### -## SPARC Systems -######################################################################### - -LIST_sparc="$(boards_by_arch sparc)" - #-----------------------------------------------------------------------
build_target() { @@ -511,20 +341,46 @@ build_target() { ${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \ | tee -a ${LOG_DIR}/$target.MAKELOG } + +expand_target() { + # Handle multiple target selectors + local list t=$1 + + # If a LIST_xxx var exists, use it. But avoid variable + # expansion in the eval when a board name contains certain + # characters that the shell interprets. + case ${t} in + *[-+=]*) list= ;; + *) list=$(eval echo '${LIST_'$t'}') ;; + esac + [ -n "${list}" ] && echo "${list}" && return 0 + + # see if this is an arch name + list=$(boards_by_arch "${t}") + [ -n "${list}" ] && echo "${list}" && return 0 + + # see if this is a cpu name + list=$(boards_by_cpu "${t}") + [ -n "${list}" ] && echo "${list}" && return 0 + + # see if this is a soc name + list=$(boards_by_soc "${t}") + [ -n "${list}" ] && echo "${list}" && return 0 + + # see if this is a vendor name + list=$(boards_by_vend "${t}") + [ -n "${list}" ] && echo "${list}" && return 0 + + # no hits, so let's just assume it's a board name + echo "${t}" +} + build_targets() { + local t tt for t in "$@" ; do - # If a LIST_xxx var exists, use it. But avoid variable - # expansion in the eval when a board name contains certain - # characters that the shell interprets. - case ${t} in - *[-+=]*) list= ;; - *) list=$(eval echo '${LIST_'$t'}') ;; - esac - if [ -n "${list}" ] ; then - build_targets ${list} - else - build_target ${t} - fi + for tt in $(expand_target "${t}") ; do + build_target ${tt} + done done }

Dear Mike Frysinger,
In message 1318964381-27632-1-git-send-email-vapier@gentoo.org you wrote:
Rather than maintain a hand coded list of targets which represent cpus/etc and expand into a bunch of board names, add automatic look up to all targets. This makes target selection a bit more natural imo, and keeps down on code duplication.
Signed-off-by: Mike Frysinger vapier@gentoo.org
MAKEALL | 384 ++++++++++++++++++++------------------------------------------- 1 files changed, 120 insertions(+), 264 deletions(-)
Sorry, this does not apply any more. Can you please rebase and resubmit?
Thanks.
Best regards,
Wolfgang Denk
participants (2)
-
Mike Frysinger
-
Wolfgang Denk