From f2f6d799c55e5be1b1c4d38a9b61d9bfc1f692f2 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Wed, 17 Aug 2011 23:05:01 +0200 Subject: configure: handle --program-prefix Signed-off-by: "Yann E. MORIN" diff --git a/.hgignore b/.hgignore index d39c8bd..66544d7 100644 --- a/.hgignore +++ b/.hgignore @@ -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 diff --git a/Makefile.in b/Makefile.in index b095089..699a968 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/configure b/configure index d498949..abf8457 100755 --- a/configure +++ b/configure @@ -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 diff --git a/ct-ng.in b/ct-ng.in index 096e134..bcac6d8 100644 --- a/ct-ng.in +++ b/ct-ng.in @@ -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' diff --git a/docs/ct-ng.1.in b/docs/ct-ng.1.in index d711369..a788516 100644 --- a/docs/ct-ng.1.in +++ b/docs/ct-ng.1.in @@ -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 -- cgit v0.10.2-6-g49f6