configure: handle --program-prefix

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
Yann E. MORIN" 2011-08-17 23:05:01 +02:00
parent d706bf2e6b
commit f2f6d799c5
5 changed files with 43 additions and 23 deletions

View File

@ -2,9 +2,9 @@ syntax: glob
# Generated files
Makefile
ct-ng
docs/ct-ng.1
docs/ct-ng.1.gz
*ct-ng
docs/*ct-ng.1
docs/*ct-ng.1.gz
paths.mk
scripts/crosstool-NG.sh
scripts/saveSample.sh

View File

@ -43,6 +43,7 @@ BINDIR := @@BINDIR@@
LIBDIR := @@LIBDIR@@
DOCDIR := @@DOCDIR@@
MANDIR := @@MANDIR@@
PROG_PFX:=@@PROG_PFX@@
DATE := @@DATE@@
LOCAL := @@LOCAL@@
@ -66,7 +67,7 @@ KCONFIG:= @@KCONFIG@@
MAN_SECTION := 1
MAN_SUBDIR := /man$(MAN_SECTION)
PROG_NAME := ct-ng
PROG_NAME := $(PROG_PFX)ct-ng
###############################################################################
# Sanity checks
@ -141,17 +142,26 @@ docs/$(PROG_NAME).1.gz: docs/$(PROG_NAME).1
@echo " GZIP '$@'"
@gzip -c9 $< >$@
%: %.in Makefile
define sed_it
@echo " SED '$@'"
@$(sed) -r -e 's,@@CT_BINDIR@@,$(BINDIR),g;' \
-e 's,@@CT_LIBDIR@@,$(LIBDIR),g;' \
-e 's,@@CT_DOCDIR@@,$(DOCDIR),g;' \
-e 's,@@CT_MANDIR@@,$(MANDIR),g;' \
-e 's,@@CT_VERSION@@,$(VERSION),g;' \
-e 's,@@CT_DATE@@,$(DATE),g;' \
-e 's,@@CT_make@@,$(make),g;' \
-e 's,@@CT_bash@@,$(bash),g;' \
$@.in >$@
@$(sed) -r -e 's,@@CT_BINDIR@@,$(BINDIR),g;' \
-e 's,@@CT_LIBDIR@@,$(LIBDIR),g;' \
-e 's,@@CT_DOCDIR@@,$(DOCDIR),g;' \
-e 's,@@CT_MANDIR@@,$(MANDIR),g;' \
-e 's,@@CT_PROG_PFX@@,$(PROG_PFX),g;' \
-e 's,@@CT_PROG_NAME@@,$(PROG_NAME),g;' \
-e 's,@@CT_VERSION@@,$(VERSION),g;' \
-e 's,@@CT_DATE@@,$(DATE),g;' \
-e 's,@@CT_make@@,$(make),g;' \
-e 's,@@CT_bash@@,$(bash),g;' \
$< >$@
endef
$(PROG_PFX)%: %.in Makefile
$(call sed_it)
%: %.in Makefile
$(call sed_it)
# We create a script fragment that is parseable from inside a Makefile,
# but also from inside a shell script, hence the reason why we don't

18
configure vendored
View File

@ -11,6 +11,7 @@ BINDIR_set=
LIBDIR_set=
DOCDIR_set=
MANDIR_set=
PROG_PFX=
LOCAL_set=
FORCE=
@ -60,6 +61,9 @@ set_mandir() {
MANDIR_set=1
MANDIR="$( get_optval "$1" "$2" )"
}
set_program_prefix() {
PROG_PFX="$( get_optval "$1" "$2" )"
}
set_tool() {
local var_name="${1%%=*}"
var_name="${var_name#--with-}"
@ -330,7 +334,6 @@ Fine tuning of the installation directories:
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
(ignored)
System types:
--build=BUILD configure for building on BUILD [guessed] (ignored)
@ -362,14 +365,15 @@ while [ $# -ne 0 ]; do
--docdir*) set_docdir "$1" "$2" && shift || shift 2;;
--mandir*) set_mandir "$1" "$2" && shift || shift 2;;
--with-*) set_tool "$1" "$2" && shift || shift 2;;
--program-prefix=*|--program-prefix)
set_program_prefix "$1" "$2" && shift || shift 2
;;
--force) FORCE=1; shift;;
--help|-h) do_help; exit 0;;
# Skip, auto-stuff compatibility
--build=*|--host=*|--infodir=*|--datadir=*|--sysconfdir=*|--localstatedir=*) shift;;
--build|--host|--infodir|--datadir|--sysconfdir|--localstatedir) shift 2;;
--enable-shared|--disable-shared|--enable-static|--disable-static) shift;;
--program-prefix=*) shift;;
--program-prefix) shift 2;;
*) printf "Unrecognised option: '${1}'\n"; do_help; exit 1;;
esac
done
@ -384,6 +388,7 @@ if [ "${LOCAL_set}" = "y" ]; then
set_libdir "" "$( pwd )"
set_docdir "" "$( pwd )/docs"
set_mandir "" "$( pwd )/docs"
set_program_prefix "" ""
fi
#---------------------------------------------------------------------
@ -624,9 +629,12 @@ for p in BIN LIB DOC MAN; do
eval v='"${'"${var}"'}"'
case "${v}" in
/*) ;;
*) do_error "'${var}' is not an absolute path: '${v}'"
*) do_error "'${var}' is not an absolute path: '${v}'";;
esac
done
case "${PROG_PFX}" in
*/*) do_error "program prefix '${PROG_PFX}' contains a '/'";;
esac
#---------------------------------------------------------------------
# That's all, folks!
@ -644,6 +652,7 @@ kconfig_sed="s/@@KCONFIG@@/$( for k_name in ${kconfig_list}; do
-e "s,@@LIBDIR@@,${LIBDIR},g" \
-e "s,@@DOCDIR@@,${DOCDIR},g" \
-e "s,@@MANDIR@@,${MANDIR},g" \
-e "s,@@PROG_PFX@@,${PROG_PFX},g" \
-e "s,@@VERSION@@,${VERSION},g" \
-e "s,@@DATE@@,${DATE},g" \
-e "s,@@LOCAL@@,${LOCAL_set},g" \
@ -661,6 +670,7 @@ crosstool-NG configured as follows:
LIBDIR='${LIBDIR}'
DOCDIR='${DOCDIR}'
MANDIR='${MANDIR}'
PROG_PFX='${PROG_PFX}'
Now run:
make

View File

@ -101,7 +101,7 @@ help-tail::
@echo 'Use action "menuconfig" to configure your toolchain'
@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'
@echo 'See "man 1 $(notdir $(CT_NG))" for some help as well'
help-build::
@echo ' build[.#] - Build the currently configured toolchain'

View File

@ -9,11 +9,11 @@
."
."
.SH NAME
ct-ng, crosstool-NG \- Build cross-toolchains
@@CT_PROG_NAME@@, crosstool-NG \- Build cross-toolchains
."
."
.SH SYNOPSIS
.B ct-ng ACTION
.B @@CT_PROG_NAME@@ ACTION
."
."
.SH DESCRIPTION
@ -56,7 +56,7 @@ If that was not clear:
.I `pwd`/samples/${CT_TARGET}/
Samples can be later recalled by calling
.B ct-ng
.B @@CT_PROG_NAME@@
with the target tuple they represent.
."
.TP
@ -112,7 +112,7 @@ The list of steps is viewable with the action
."
.SH EXIT VALUE
The
.B ct-ng
.B @@CT_PROG_NAME@@
frontend is in fact a
.BR make (1)
script. See the man page for