Print the major components and their version when calling "make help".
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 08 10:57:34 2007 +0000 (2007-05-08)
changeset 747987069e8312
parent 73 b8924cbdca26
child 75 56db62f2932a
Print the major components and their version when calling "make help".
samples/Makefile
scripts/showSamples.sh
     1.1 --- a/samples/Makefile	Tue May 08 10:52:39 2007 +0000
     1.2 +++ b/samples/Makefile	Tue May 08 10:57:34 2007 +0000
     1.3 @@ -1,16 +1,14 @@
     1.4  # Build a list of all available samples
     1.5  
     1.6 -SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%,%,$(filter-out %Makefile,$(wildcard $(CT_TOP_DIR)/samples/*)))
     1.7 +CT_SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(filter-out %Makefile,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config)))
     1.8  .PHONY: $(SAMPLES)
     1.9 -$(SAMPLES):
    1.10 +$(CT_SAMPLES):
    1.11  	@cp "$(CT_TOP_DIR)/samples/$(@)/crosstool.config" "$(CT_TOP_DIR)/.config"
    1.12  	@$(MAKE) oldconfig
    1.13  
    1.14  help::
    1.15  	@echo  'Preconfigured targets:'
    1.16 -	@for s in $(SAMPLES); do   \
    1.17 -	    echo  "  $${s}"; \
    1.18 -	 done
    1.19 +	@$(CT_TOP_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
    1.20  	@echo  ''
    1.21  
    1.22  saveconfig:
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/scripts/showSamples.sh	Tue May 08 10:57:34 2007 +0000
     2.3 @@ -0,0 +1,30 @@
     2.4 +#!/bin/bash
     2.5 +
     2.6 +# Parses all samples on the command line, and for each of them, prints
     2.7 +# the versions of the main tools
     2.8 +
     2.9 +# GREP_OPTIONS screws things up.
    2.10 +export GREP_OPTIONS=
    2.11 +
    2.12 +# Dump a single sample
    2.13 +dump_single_sample() {
    2.14 +    local width="$1"
    2.15 +    local sample="$2"
    2.16 +    . "${CT_TOP_DIR}/samples/${sample}/crosstool.config"
    2.17 +    # Build the components string
    2.18 +    local str="${CT_KERNEL}-${CT_KERNEL_VERSION}"
    2.19 +    str="${str} binutils-${CT_BINUTILS_VERSION}"
    2.20 +    str="${str} ${CT_CC}-${CT_CC_VERSION}"
    2.21 +    str="${str} ${CT_LIBC}-${CT_LIBC_VERSION}"
    2.22 +    printf "  %-*s - %s\n" ${width} "${sample}" "${str}"
    2.23 +}
    2.24 +
    2.25 +# Get largest sample width
    2.26 +width=0
    2.27 +for sample in "${@}"; do
    2.28 +    [ ${#sample} -gt ${width} ] && width=${#sample}
    2.29 +done
    2.30 +
    2.31 +for sample in "${@}"; do
    2.32 +    ( dump_single_sample ${width} "${sample}" )
    2.33 +done