From e5a007415a0fa8bb4a6d6d9b6a9d1fd3e45acb74 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Fri, 2 Apr 2010 00:18:26 +0200 Subject: 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 diff --git a/Makefile.in b/Makefile.in index 462b8bf..6080fdf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/ct-ng.comp b/ct-ng.comp index a6ad19c..c8c6301 100644 --- a/ct-ng.comp +++ b/ct-ng.comp @@ -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} diff --git a/ct-ng.in b/ct-ng.in index 8efe168..c006c86 100644 --- a/ct-ng.in +++ b/ct-ng.in @@ -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 diff --git a/samples/samples.mk b/samples/samples.mk index 6d30d5f..3c67dbb 100644 --- a/samples/samples.mk +++ b/samples/samples.mk @@ -19,19 +19,16 @@ help-config:: help-samples:: @echo ' list-samples - prints the list of all samples (for scripting)' - @echo ' show- - show a brief overview of (list below)' - @echo ' - preconfigure crosstool-NG with (list below)' - @echo ' build-all[.#] - Build *all* samples (list below) and install in' + @echo ' show- - show a brief overview of (list with list-samples)' + @echo ' - preconfigure crosstool-NG with (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) diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh index 2c3f0cf..00490a9 100755 --- a/scripts/showSamples.sh +++ b/scripts/showSamples.sh @@ -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 diff --git a/steps.mk b/steps.mk index 4afb6a7..7d6ea80 100644 --- a/steps.mk +++ b/steps.mk @@ -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 -- cgit v0.10.2-6-g49f6