scripts: misc help and auto-complete fixes

- don't list samples in the main help screen
- improve the samples listing in list-samples
- don't document the 'config' action, it's long dead
- document the 'V' environment variable
- improve on START, STOP and PREFIX environment variables
- add PREFIX and V to autocomplete
- advertise auto-complete at install time
This commit is contained in:
Yann E. MORIN" 2010-04-02 00:18:26 +02:00
parent 5807b7dfb7
commit e5a007415a
6 changed files with 25 additions and 19 deletions

View File

@ -182,7 +182,7 @@ else
#--------------------------------------
# Install rules
real-install: $(patsubst %,install-%,$(TARGETS))
real-install: $(patsubst %,install-%,$(TARGETS)) install-post
install-bin: $(DESTDIR)$(BINDIR)
@echo " INST 'ct-ng'"
@ -232,6 +232,10 @@ $(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(M
@echo " MKDIR '$@'"
@$(install) -m 755 -d "$@"
install-post:
@echo
@echo "For auto-completion, do not forget to install 'ct-ng.comp'"
@echo "into you 'bash_completion.d'"
#--------------------------------------
# Uninstall rules

View File

@ -6,8 +6,8 @@ _ct-ng () {
cur=$(_get_cword)
prev=${COMP_WORDS[COMP_CWORD-1]}
samples=$( ${COMP_WORDS[0]} list-samples 2>/dev/null \
|sed -r -e 's/^(.*) \(host: (.*)\)$/\2,\1/;' \
samples=$( "${COMP_WORDS[0]}" list-samples 2>/dev/null \
|tail -n +2 |sed -e '/^ /d; s/ .*//;' \
)
show_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1show-/g;')
build_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1build-/g;')
@ -22,7 +22,7 @@ _ct-ng () {
clean distclean wiki-samples updatetools
tarball version'
vars="RESTART= STOP="
vars="RESTART= STOP= PREFIX= V="
ct_ng_opts="${samples} ${show_samples} ${build_samples}
${steps} ${start_steps} ${stop_steps}

View File

@ -98,7 +98,7 @@ help-env::
help-tail::
@echo
@echo 'Use action "config" or "menuconfig" to configure crosstool-NG'
@echo 'Use action "menuconfig" to configure crosstool-NG'
@echo 'Use action "build" to build your toolchain'
@echo 'Use action "version" to see the version'
@echo 'See "man 1 ct-ng" for some help as well'
@ -123,6 +123,9 @@ help-distrib::
@echo ' tarball - Build a tarball of the configured toolchain'
help-env::
@echo ' V=0|1|2 - 0 => show only human-readable messages (default)'
@echo ' 1 => show only the commands being executed'
@echo ' 2 => show both'
# End help system

View File

@ -19,19 +19,16 @@ help-config::
help-samples::
@echo ' list-samples - prints the list of all samples (for scripting)'
@echo ' show-<sample> - show a brief overview of <sample> (list below)'
@echo ' <sample> - preconfigure crosstool-NG with <sample> (list below)'
@echo ' build-all[.#] - Build *all* samples (list below) and install in'
@echo ' show-<sample> - show a brief overview of <sample> (list with list-samples)'
@echo ' <sample> - preconfigure crosstool-NG with <sample> (list with list-samples)'
@echo ' build-all[.#] - Build *all* samples (list with list-samples) and install in'
@echo ' $${CT_PREFIX} (which you must set)'
@echo ' Available samples:'
@$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
help-distrib::
@echo ' wiki-samples - Print a DokuWiki table of samples'
help-env::
@echo ' CT_PREFIX - directory in which to auto-install samples'
@echo ' (see action "build-all", above).'
@echo ' CT_PREFIX=dir - install samples in dir (see action "build-all", above).'
# ----------------------------------------------------------
# This part deals with printing samples information
@ -54,7 +51,7 @@ show-all: $(patsubst %,show-%,$(CT_SAMPLES))
# print the list of all available samples
PHONY += list-samples
list-samples: FORCE
@echo $(CT_SAMPLES) |$(sed) -r -e 's/ /\n/g;' |sed -r -e 's/(.*),(.*)/\2 \(host: \1\)/;'
$(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
wiki-samples:
$(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -w $(CT_SAMPLES)

View File

@ -30,10 +30,10 @@ dump_single_sample() {
;;
*) if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
sample_top="${CT_TOP_DIR}"
sample_type="l"
sample_type="L"
else
sample_top="${CT_LIB_DIR}"
sample_type="g"
sample_type="G"
fi
. "${sample_top}/samples/${sample}/crosstool.config"
;;
@ -174,6 +174,8 @@ if [ "${opt}" = -w ]; then
printf "^ Initially\\\\\\\\ reported by "
printf "^ Last\\\\\\\\ updated "
echo "^"
elif [ -z "${opt}" ]; then
printf "%-*s Status\n" ${width} "Sample name"
fi
for sample in "${@}"; do
@ -184,8 +186,8 @@ if [ "${opt}" = -w ]; then
printf "^ Total: ${#@} samples || **X**: sample uses features marked as being EXPERIMENTAL.\\\\\\\\ **B**: sample is curently BROKEN. |||||||||||||"
echo ""
elif [ -z "${opt}" ]; then
echo ' l (local) : sample was found in current directory'
echo ' g (global) : sample was installed with crosstool-NG'
echo ' L (Local) : sample was found in current directory'
echo ' G (Global) : sample was installed with crosstool-NG'
echo ' X (EXPERIMENTAL): sample may use EXPERIMENTAL features'
echo ' B (BROKEN) : sample is currently broken'
fi

View File

@ -8,8 +8,8 @@ help-build::
@echo ' list-steps - List all build steps'
help-env::
@echo ' STOP - Stop the build just after this step'
@echo ' RESTART - Restart the build just before this step'
@echo ' STOP=step - Stop the build just after this step (list with list-steps)'
@echo ' RESTART=step - Restart the build just before this step (list with list-steps)'
# ----------------------------------------------------------
# The steps list