1.1 --- a/samples/samples.mk Tue Jul 17 22:21:28 2012 +0200
1.2 +++ b/samples/samples.mk Mon Jul 23 22:02:23 2012 +0200
1.3 @@ -44,7 +44,7 @@
1.4 PHONY += $(patsubst %,show-%,$(CT_SAMPLES))
1.5 $(patsubst %,show-%,$(CT_SAMPLES)): config_files
1.6 @KCONFIG_CONFIG=$$(pwd)/.config.sample \
1.7 - $(CONF) --defconfig=$(call sample_dir,$(patsubst show-%,%,$(@)))/crosstool.config \
1.8 + $(CONF) --defconfig=$(call sample_dir,$(patsubst show-%,%,$(@)))/crosstool.config \
1.9 $(KCONFIG_TOP) >/dev/null
1.10 @$(CT_LIB_DIR)/scripts/showSamples.sh -v $(patsubst show-%,%,$(@))
1.11 @rm -f .config.sample
1.12 @@ -55,18 +55,45 @@
1.13
1.14 # print the list of all available samples
1.15 PHONY += list-samples
1.16 -list-samples: FORCE
1.17 - $(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
1.18 +list-samples: list-samples-pre $(patsubst %,list-%,$(CT_SAMPLES))
1.19 + @echo ' L (Local) : sample was found in current directory'
1.20 + @echo ' G (Global) : sample was installed with crosstool-NG'
1.21 + @echo ' X (EXPERIMENTAL): sample may use EXPERIMENTAL features'
1.22 + @echo ' B (BROKEN) : sample is currently broken'
1.23 +
1.24 +PHONY += list-samples-pre
1.25 +list-samples-pre: FORCE
1.26 + @echo 'Status Sample name'
1.27 +
1.28 +PHONY += $(patsubst %,list-%,$(CT_SAMPLES))
1.29 +$(patsubst %,list-%,$(CT_SAMPLES)): config_files
1.30 + @KCONFIG_CONFIG=$$(pwd)/.config.sample \
1.31 + $(CONF) --defconfig=$(call sample_dir,$(patsubst list-%,%,$(@)))/crosstool.config \
1.32 + $(KCONFIG_TOP) >/dev/null
1.33 + @$(CT_LIB_DIR)/scripts/showSamples.sh $(patsubst list-%,%,$(@))
1.34 + @rm -f .config.sample
1.35
1.36 PHONY += list-samples-short
1.37 list-samples-short: FORCE
1.38 $(SILENT)for s in $(CT_SAMPLES); do \
1.39 - printf "$${s}\n"; \
1.40 + printf "%s\n" "$${s}"; \
1.41 done
1.42
1.43 PHONY += wiki-samples
1.44 -wiki-samples:
1.45 - $(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -w $(CT_SAMPLES)
1.46 +wiki-samples: wiki-samples-pre $(patsubst %,wiki-%,$(CT_SAMPLES)) wiki-samples-post
1.47 +
1.48 +wiki-samples-pre: FORCE
1.49 + $(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -w
1.50 +
1.51 +wiki-samples-post: FORCE
1.52 + $(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -W $(CT_SAMPLES)
1.53 +
1.54 +$(patsubst %,wiki-%,$(CT_SAMPLES)): config_files
1.55 + $(SILENT)KCONFIG_CONFIG=$$(pwd)/.config.sample \
1.56 + $(CONF) --defconfig=$(call sample_dir,$(patsubst wiki-%,%,$(@)))/crosstool.config \
1.57 + $(KCONFIG_TOP) >/dev/null
1.58 + $(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -w $(patsubst wiki-%,%,$(@))
1.59 + $(SILENT)rm -f .config.sample
1.60
1.61 # ----------------------------------------------------------
1.62 # This part deals with saving/restoring samples
2.1 --- a/scripts/showSamples.sh Tue Jul 17 22:21:28 2012 +0200
2.2 +++ b/scripts/showSamples.sh Mon Jul 23 22:02:23 2012 +0200
2.3 @@ -9,6 +9,7 @@
2.4
2.5 [ "$1" = "-v" ] && opt="$1" && shift
2.6 [ "$1" = "-w" ] && opt="$1" && shift
2.7 +[ "$1" = "-W" ] && opt="$1" && shift
2.8
2.9 # GREP_OPTIONS screws things up.
2.10 export GREP_OPTIONS=
2.11 @@ -17,16 +18,15 @@
2.12 # Note: we use the specific .config.sample config file
2.13 dump_single_sample() {
2.14 local verbose=0
2.15 + local wiki=0
2.16 local complibs
2.17 [ "$1" = "-v" ] && verbose=1 && shift
2.18 [ "$1" = "-w" ] && wiki=1 && shift
2.19 - local width="$1"
2.20 - local sample="$2"
2.21 + local sample="$1"
2.22 case "${sample}" in
2.23 current)
2.24 sample_type="l"
2.25 sample="$( ${CT_NG} show-tuple )"
2.26 - width="${#sample}"
2.27 ;;
2.28 *) if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
2.29 sample_top="${CT_TOP_DIR}"
2.30 @@ -38,20 +38,20 @@
2.31 ;;
2.32 esac
2.33 . $(pwd)/.config.sample
2.34 - if [ -z "${wiki}" ]; then
2.35 - t_width=14
2.36 - printf "%-*s [%s" ${width} "${sample}" "${sample_type}"
2.37 - [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B" || printf " "
2.38 - [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf " "
2.39 - echo "]"
2.40 + if [ ${wiki} -eq 0 ]; then
2.41 + width=14
2.42 + printf "[%s" "${sample_type}"
2.43 + [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B" || printf "."
2.44 + [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf "."
2.45 + printf "] %s\n" "${sample}"
2.46 if [ ${verbose} -ne 0 ]; then
2.47 case "${CT_TOOLCHAIN_TYPE}" in
2.48 cross) ;;
2.49 canadian)
2.50 - printf " %-*s : %s\n" ${t_width} "Host" "${CT_HOST}"
2.51 + printf " %-*s : %s\n" ${width} "Host" "${CT_HOST}"
2.52 ;;
2.53 esac
2.54 - printf " %-*s : %s\n" ${t_width} "OS" "${CT_KERNEL}${CT_KERNEL_VERSION:+-}${CT_KERNEL_VERSION}"
2.55 + printf " %-*s : %s\n" ${width} "OS" "${CT_KERNEL}${CT_KERNEL_VERSION:+-}${CT_KERNEL_VERSION}"
2.56 if [ -n "${CT_GMP}" \
2.57 -o -n "${CT_MPFR}" \
2.58 -o -n "${CT_PPL}" \
2.59 @@ -65,7 +65,7 @@
2.60 -o -n "${CT_MPC_TARGET}" \
2.61 -o -n "${CT_LIBELF_TARGET}" \
2.62 ]; then
2.63 - printf " %-*s :" ${t_width} "Companion libs"
2.64 + printf " %-*s :" ${width} "Companion libs"
2.65 complibs=1
2.66 fi
2.67 [ -z "${CT_GMP}" -a -z "${CT_GMP_TARGET}" ] || printf " gmp-%s" "${CT_GMP_VERSION}"
2.68 @@ -75,8 +75,8 @@
2.69 [ -z "${CT_MPC}" -a -z "${CT_MPC_TARGET}" ] || printf " mpc-%s" "${CT_MPC_VERSION}"
2.70 [ -z "${CT_LIBELF}" -a -z "${CT_LIBELF_TARGET}" ] || printf " libelf-%s" "${CT_LIBELF_VERSION}"
2.71 [ -z "${complibs}" ] || printf "\n"
2.72 - printf " %-*s : %s\n" ${t_width} "binutils" "binutils-${CT_BINUTILS_VERSION}"
2.73 - printf " %-*s : %s" ${t_width} "C compiler" "${CT_CC}-${CT_CC_VERSION} (C"
2.74 + printf " %-*s : %s\n" ${width} "binutils" "binutils-${CT_BINUTILS_VERSION}"
2.75 + printf " %-*s : %s" ${width} "C compiler" "${CT_CC}-${CT_CC_VERSION} (C"
2.76 [ "${CT_CC_LANG_CXX}" = "y" ] && printf ",C++"
2.77 [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ",Fortran"
2.78 [ "${CT_CC_LANG_JAVA}" = "y" ] && printf ",Java"
2.79 @@ -85,8 +85,8 @@
2.80 [ "${CT_CC_LANG_OBJCXX}" = "y" ] && printf ",Objective-C++"
2.81 [ -n "${CT_CC_LANG_OTHERS}" ] && printf ",${CT_CC_LANG_OTHERS}"
2.82 printf ")\n"
2.83 - printf " %-*s : %s\n" ${t_width} "C library" "${CT_LIBC}${CT_LIBC_VERSION:+-}${CT_LIBC_VERSION}"
2.84 - printf " %-*s :" ${t_width} "Tools"
2.85 + printf " %-*s : %s\n" ${width} "C library" "${CT_LIBC}${CT_LIBC_VERSION:+-}${CT_LIBC_VERSION}"
2.86 + printf " %-*s :" ${width} "Tools"
2.87 [ "${CT_TOOL_sstrip}" ] && printf " sstrip"
2.88 [ "${CT_DEBUG_dmalloc}" ] && printf " dmalloc-${CT_DMALLOC_VERSION}"
2.89 [ "${CT_DEBUG_duma}" ] && printf " duma-${CT_DUMA_VERSION}"
2.90 @@ -153,13 +153,7 @@
2.91 fi
2.92 }
2.93
2.94 -# Get largest sample width
2.95 -width=0
2.96 -for sample in "${@}"; do
2.97 - [ ${#sample} -gt ${width} ] && width=${#sample}
2.98 -done
2.99 -
2.100 -if [ "${opt}" = -w ]; then
2.101 +if [ "${opt}" = "-w" -a ${#} -eq 0 ]; then
2.102 printf "^ %s |||||||||||||||\n" "$( date "+%Y%m%d.%H%M %z" )"
2.103 printf "^ Target "
2.104 printf "^ Host "
2.105 @@ -174,20 +168,13 @@
2.106 printf "^ Initially\\\\\\\\ reported by "
2.107 printf "^ Last\\\\\\\\ updated "
2.108 echo "^"
2.109 -elif [ -z "${opt}" ]; then
2.110 - printf "%-*s Status\n" ${width} "Sample name"
2.111 + exit 0
2.112 +elif [ "${opt}" = "-W" ]; then
2.113 + printf "^ Total: ${#} samples || **X**: sample uses features marked as being EXPERIMENTAL.\\\\\\\\ **B**: sample is currently BROKEN. |||||||||||||"
2.114 + echo ""
2.115 + exit 0
2.116 fi
2.117
2.118 for sample in "${@}"; do
2.119 - ( dump_single_sample ${opt} ${width} "${sample}" )
2.120 + ( dump_single_sample ${opt} "${sample}" )
2.121 done
2.122 -
2.123 -if [ "${opt}" = -w ]; then
2.124 - printf "^ Total: ${#@} samples || **X**: sample uses features marked as being EXPERIMENTAL.\\\\\\\\ **B**: sample is currently BROKEN. |||||||||||||"
2.125 - echo ""
2.126 -elif [ -z "${opt}" ]; then
2.127 - echo ' L (Local) : sample was found in current directory'
2.128 - echo ' G (Global) : sample was installed with crosstool-NG'
2.129 - echo ' X (EXPERIMENTAL): sample may use EXPERIMENTAL features'
2.130 - echo ' B (BROKEN) : sample is currently broken'
2.131 -fi