Merge the build system to trunk: ct-ng is now installable:
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 01 19:04:20 2007 +0000 (2007-07-01)
changeset 182223c84ec2d90
parent 181 ff64ca4ebe48
child 183 f8acccd11133
Merge the build system to trunk: ct-ng is now installable:
- ./configure --prefix=/some/place
- make
- make install
- export PATH="${PATH}:/some/place/bin"
- ct-ng <action>
Makefile
Makefile.in
Makefile.steps
config/config.in
configure
ct-ng.in
docs/ct-ng.1.in
docs/overview.txt
kconfig/Makefile
samples/Makefile
scripts/build/debug.sh
scripts/build/tools.sh
scripts/crosstool.sh
scripts/functions
scripts/saveSample.sh
scripts/showSamples.sh
scripts/tarball.sh
scripts/tarball.sh.broken
tools/Makefile
     1.1 --- a/Makefile	Tue Jun 26 21:23:05 2007 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,86 +0,0 @@
     1.4 -# Makefile for crosstool-NG.
     1.5 -# Copyright 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
     1.6 -
     1.7 -# Don't print directory as we descend into them
     1.8 -MAKEFLAGS += --no-print-directory
     1.9 -
    1.10 -export CT_TOP_DIR=$(shell pwd)
    1.11 -
    1.12 -# This is crosstool-ng version string
    1.13 -export CT_VERSION=$(shell cat $(CT_TOP_DIR)/version)
    1.14 -
    1.15 -export CT_STOP=$(STOP)
    1.16 -export CT_RESTART=$(RESTART)
    1.17 -
    1.18 -.PHONY: all
    1.19 -all: build
    1.20 -
    1.21 -HOST_CC = gcc -funsigned-char
    1.22 -
    1.23 -# Help system
    1.24 -help:: help-head help-config help-samples help-build help-distrib help-env help-tail
    1.25 -
    1.26 -help-head::
    1.27 -	@echo  'Available make targets:'
    1.28 -
    1.29 -help-config::
    1.30 -	@echo
    1.31 -	@echo  'Configuration targets:'
    1.32 -
    1.33 -help-samples::
    1.34 -	@echo
    1.35 -	@echo  'Preconfigured targets:'
    1.36 -
    1.37 -help-build::
    1.38 -	@echo
    1.39 -	@echo  'Build targets:'
    1.40 -
    1.41 -help-distrib::
    1.42 -	@echo
    1.43 -	@echo  'Distribution targets:'
    1.44 -
    1.45 -help-env::
    1.46 -	@echo
    1.47 -	@echo  'Environement variables (see docs/overview.txt):'
    1.48 -
    1.49 -help-tail::
    1.50 -	@echo
    1.51 -	@echo  'Execute "make" or "make all" to build all targets marked with [*]'
    1.52 -
    1.53 -# End help system
    1.54 -
    1.55 -help-build::
    1.56 -	@echo  '* build          - Build the toolchain'
    1.57 -	@echo  '  clean          - Remove generated files'
    1.58 -	@echo  '  distclean      - Remove generated files, configuration and build directories'
    1.59 -
    1.60 -include $(CT_TOP_DIR)/kconfig/Makefile
    1.61 -include $(CT_TOP_DIR)/samples/Makefile
    1.62 -include $(CT_TOP_DIR)/tools/Makefile
    1.63 -include $(CT_TOP_DIR)/Makefile.steps
    1.64 -
    1.65 -help-distrib::
    1.66 -	@echo  '  tarball        - Build a tarball of the configured toolchain'
    1.67 -
    1.68 -help-env::
    1.69 -	@echo  '  STOP           - Stop the build just after this step'
    1.70 -	@echo  '  RESTART        - Restart the build just before this step'
    1.71 -
    1.72 -.config:
    1.73 -	@echo "You must run either one of \"make config\" or \"make menuconfig\" first"
    1.74 -	@false
    1.75 -
    1.76 -# Actual build
    1.77 -build: .config
    1.78 -	@$(CT_TOP_DIR)/scripts/crosstool.sh
    1.79 -
    1.80 -.PHONY: tarball
    1.81 -tarball:
    1.82 -	@$(CT_TOP_DIR)/scripts/tarball.sh
    1.83 -
    1.84 -.PHONY: distclean
    1.85 -distclean:: clean
    1.86 -	@rm -f .config* ..config.tmp
    1.87 -	@rm -f log.*
    1.88 -	@[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
    1.89 -	@rm -rf "$(CT_TOP_DIR)/targets"
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Makefile.in	Sun Jul 01 19:04:20 2007 +0000
     2.3 @@ -0,0 +1,109 @@
     2.4 +# Makefile.in for building crosstool-ng
     2.5 +# This file serves as source for the ./configure operation
     2.6 +
     2.7 +all: build
     2.8 +
     2.9 +###############################################################################
    2.10 +# Configuration variables
    2.11 +
    2.12 +VERSION:= @@VERSION@@
    2.13 +BINDIR := @@BINDIR@@
    2.14 +LIBDIR := @@LIBDIR@@/ct-ng-$(VERSION)
    2.15 +DOCDIR := @@DOCDIR@@/ct-ng-$(VERSION)
    2.16 +MANDIR := @@MANDIR@@/man1
    2.17 +DATE   := @@DATE@@
    2.18 +MAKE   := $(shell which make || type -p make || echo /usr/bin/make)
    2.19 +
    2.20 +###############################################################################
    2.21 +# Global make rules
    2.22 +
    2.23 +build: build-bin build-lib build-doc
    2.24 +
    2.25 +install: build install-bin install-lib install-doc
    2.26 +
    2.27 +clean: clean-bin clean-lib clean-doc
    2.28 +
    2.29 +distclean: clean
    2.30 +	@rm -f Makefile
    2.31 +
    2.32 +uninstall: uninstall-bin uninstall-lib uninstall-doc
    2.33 +
    2.34 +###############################################################################
    2.35 +# Specific make rules
    2.36 +
    2.37 +#--------------------------------------
    2.38 +# Build rules
    2.39 +
    2.40 +build-bin: ct-ng
    2.41 +
    2.42 +build-lib:
    2.43 +
    2.44 +build-doc: docs/ct-ng.1
    2.45 +
    2.46 +%: %.in
    2.47 +	@sed -r -e 's,@@CT_MAKE@@,$(MAKE),g;'       \
    2.48 +	        -e 's,@@CT_BINDIR@@,$(BINDIR),g;'   \
    2.49 +	        -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;'   \
    2.50 +	        -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;'   \
    2.51 +	        -e 's,@@CT_MANDIR@@,$(MANDIR),g;'   \
    2.52 +	        -e 's,@@CT_VERSION@@,$(VERSION),g;'	\
    2.53 +	        -e 's,@@CT_DATE@@,$(DATE),g;'       \
    2.54 +	     $@.in >$@
    2.55 +
    2.56 +#--------------------------------------
    2.57 +# Clean rules
    2.58 +
    2.59 +clean-bin:
    2.60 +	@rm -f ct-ng
    2.61 +
    2.62 +clean-lib:
    2.63 +
    2.64 +clean-doc:
    2.65 +	@rm -f docs/ct-ng.1
    2.66 +
    2.67 +#--------------------------------------
    2.68 +# Install rules
    2.69 +
    2.70 +install-bin: $(BINDIR)
    2.71 +	@install -m 755 ct-ng $(BINDIR)/ct-ng
    2.72 +
    2.73 +install-lib: $(LIBDIR) install-lib-main install-lib-samples
    2.74 +
    2.75 +install-lib-main: $(LIBDIR)
    2.76 +	@for src_dir in config kconfig patches scripts tools; do            \
    2.77 +	     tar cf - --exclude=.svn $${src_dir} |(cd $(LIBDIR); tar xf -); \
    2.78 +	 done
    2.79 +	@for src_file in Makefile.steps version; do                 \
    2.80 +	     install -m 644 $${src_file} $(LIBDIR)/$${src_file};    \
    2.81 +	 done
    2.82 +
    2.83 +# Samples need a little love:
    2.84 +#  - change every occurence of CT_TOP_DIR to CT_LIB_DIR
    2.85 +install-lib-samples: $(LIBDIR) install-lib-main
    2.86 +	@tar cf - --exclude=.svn samples |(cd $(LIBDIR); tar xf -)
    2.87 +	@for samp_file in $(LIBDIR)/samples/*/crosstool.config; do					\
    2.88 +	     sed -r -i -e 's,\$$\{CT_TOP_DIR\},\$$\{CT_LIB_DIR\},g;' $${samp_file}; \
    2.89 +	 done
    2.90 +
    2.91 +install-doc: $(DOCDIR) $(MANDIR)
    2.92 +	@for doc_file in LICENSES licenses.d COPYING CREDITS docs/overview.txt; do	\
    2.93 +	     install -m 644 docs/overview.txt $(DOCDIR);    						\
    2.94 +	 done
    2.95 +	@install -m 644 docs/ct-ng.1 $(MANDIR)
    2.96 +
    2.97 +$(BINDIR) $(LIBDIR) $(DOCDIR) $(MANDIR):
    2.98 +	@install -m 755 -d $@
    2.99 +
   2.100 +
   2.101 +#--------------------------------------
   2.102 +# Uninstall rules
   2.103 +
   2.104 +uninstall-bin:
   2.105 +	@rm -f $(BINDIR)/ct-ng
   2.106 +
   2.107 +uninstall-lib:
   2.108 +	@rm -rf $(LIBDIR)
   2.109 +
   2.110 +uninstall-doc:
   2.111 +	@rm -rf $(DOCDIR)
   2.112 +	@rm -f $(MANDIR)/ct-ng.1
     3.1 --- a/Makefile.steps	Tue Jun 26 21:23:05 2007 +0000
     3.2 +++ b/Makefile.steps	Sun Jul 01 19:04:20 2007 +0000
     3.3 @@ -17,13 +17,13 @@
     3.4              debug                   \
     3.5  
     3.6  $(CT_STEPS):
     3.7 -	@make -C "$(CT_TOP_DIR)" RESTART=$@ STOP=$@
     3.8 +	@make -C "$(CT_TOP_DIR)" -f $(CT_MAKEFILE) RESTART=$@ STOP=$@
     3.9  
    3.10  $(patsubst %,-%,$(CT_STEPS)):
    3.11 -	@make -C "$(CT_TOP_DIR)" STOP=$(patsubst -%,%,$@)
    3.12 +	@make -C "$(CT_TOP_DIR)" -f $(CT_MAKEFILE) STOP=$(patsubst -%,%,$@)
    3.13  
    3.14  $(patsubst %,%-,$(CT_STEPS)):
    3.15 -	@make -C "$(CT_TOP_DIR)" RESTART=$(patsubst %-,%,$@)
    3.16 +	@make -C "$(CT_TOP_DIR)" -f $(CT_MAKEFILE) RESTART=$(patsubst %-,%,$@)
    3.17  
    3.18  help-build::
    3.19  	@echo  '  liststeps      - Lists all build steps'
     4.1 --- a/config/config.in	Tue Jun 26 21:23:05 2007 +0000
     4.2 +++ b/config/config.in	Sun Jul 01 19:04:20 2007 +0000
     4.3 @@ -5,5 +5,5 @@
     4.4  source config/binutils.in
     4.5  source config/cc.in
     4.6  source config/libc.in
     4.7 -source config/tools.in
     4.8 -source config/debug.in
     4.9 +source config.gen/tools.in
    4.10 +source config.gen/debug.in
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/configure	Sun Jul 01 19:04:20 2007 +0000
     5.3 @@ -0,0 +1,91 @@
     5.4 +#!/bin/sh
     5.5 +
     5.6 +VERSION=$(cat version)
     5.7 +DATE=$(date +%Y%m%d)
     5.8 +
     5.9 +PREFIX=/usr/local
    5.10 +BINDIR="${PREFIX}/bin"
    5.11 +LIBDIR="${PREFIX}/lib"
    5.12 +DOCDIR="${PREFIX}/share/doc"
    5.13 +MANDIR="${PREFIX}/share/man"
    5.14 +
    5.15 +BINDIR_set=
    5.16 +LIBDIR_set=
    5.17 +DOCDIR_set=
    5.18 +MANDIR_set=
    5.19 +
    5.20 +get_optval(){
    5.21 +    local ret
    5.22 +    case "$1" in
    5.23 +        --*=?*)
    5.24 +            echo "${1:9}"
    5.25 +            ret=0
    5.26 +            ;;
    5.27 +        *)
    5.28 +            echo "${2}"
    5.29 +            ret=1
    5.30 +            ;;
    5.31 +    esac
    5.32 +    return ${ret}
    5.33 +}
    5.34 +
    5.35 +set_prefix() {
    5.36 +    local ret
    5.37 +    PREFIX=$(get_optval "$1" "$2")
    5.38 +    ret=$?
    5.39 +    [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
    5.40 +    [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib"
    5.41 +    [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc"
    5.42 +    [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man"
    5.43 +    return ${ret}
    5.44 +}
    5.45 +
    5.46 +set_bindir() {
    5.47 +    local ret
    5.48 +    BINDIR=$(get_optval "$1" "$2")
    5.49 +    ret=$?
    5.50 +    BINDIR_set=1
    5.51 +    return ${ret}
    5.52 +}
    5.53 +
    5.54 +set_libdir() {
    5.55 +    local ret
    5.56 +    LIBDIR=$(get_optval "$1" "$2")
    5.57 +    ret=$?
    5.58 +    LIBDIR_set=1
    5.59 +    return ${ret}
    5.60 +}
    5.61 +
    5.62 +set_docdir() {
    5.63 +    local ret
    5.64 +    DOCDIR=$(get_optval "$1" "$2")
    5.65 +    ret=$?
    5.66 +    DOCDIR_set=1
    5.67 +    return ${ret}
    5.68 +}
    5.69 +
    5.70 +set_mandir() {
    5.71 +    local ret
    5.72 +    MANDIR=$(get_optval "$1" "$2")
    5.73 +    ret=$?
    5.74 +    MANDIR_set=1
    5.75 +    return ${ret}
    5.76 +}
    5.77 +
    5.78 +while [ $# -ne 0 ]; do
    5.79 +    case "$1" in
    5.80 +        --prefix*)  set_prefix "$1" "$2" && shift || shift 2;;
    5.81 +        --bindir*)  set_bindir "$1" "$2" && shift || shift 2;;
    5.82 +        --libdir*)  set_libdir "$1" "$2" && shift || shift 2;;
    5.83 +        --docdir*)  set_docdir "$1" "$2" && shift || shift 2;;
    5.84 +        --mandir*)  set_mandir "$1" "$2" && shift || shift 2;;
    5.85 +    esac
    5.86 +done
    5.87 +
    5.88 +sed -r -e "s,@@BINDIR@@,${BINDIR},g;"   \
    5.89 +       -e "s,@@LIBDIR@@,${LIBDIR},g;"   \
    5.90 +       -e "s,@@DOCDIR@@,${DOCDIR},g;"   \
    5.91 +       -e "s,@@MANDIR@@,${MANDIR},g;"   \
    5.92 +       -e "s,@@VERSION@@,${VERSION},g;" \
    5.93 +       -e "s,@@DATE@@,${DATE},g;"       \
    5.94 +        Makefile.in >Makefile
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/ct-ng.in	Sun Jul 01 19:04:20 2007 +0000
     6.3 @@ -0,0 +1,99 @@
     6.4 +#!@@CT_MAKE@@ -f
     6.5 +# Makefile for crosstool-NG.
     6.6 +# Copyright 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
     6.7 +
     6.8 +# Don't print directory as we descend into them
     6.9 +MAKEFLAGS += --no-print-directory
    6.10 +
    6.11 +# Remember the name of the Makefile
    6.12 +CT_MAKEFILE := $(lastword $(MAKEFILE_LIST))
    6.13 +CT_NG := $(shell echo '$(CT_MAKEFILE)' |sed -r -e 's,($(subst :,|,$(PATH)))/,,;')
    6.14 +
    6.15 +export CT_TOP_DIR:=$(shell pwd)
    6.16 +export CT_LIB_DIR:=@@CT_LIBDIR@@
    6.17 +export CT_DOC_DIR:=@@CT_DOCDIR@@
    6.18 +
    6.19 +# This is crosstool-ng version string
    6.20 +export CT_VERSION=$(shell cat $(CT_LIB_DIR)/version)
    6.21 +
    6.22 +export CT_STOP=$(STOP)
    6.23 +export CT_RESTART=$(RESTART)
    6.24 +
    6.25 +.PHONY: $(PHONY)
    6.26 +PHONY += all
    6.27 +all: build
    6.28 +
    6.29 +HOST_CC = gcc -funsigned-char
    6.30 +
    6.31 +# Help system
    6.32 +help:: help-head help-config help-samples help-build help-distrib help-env help-tail
    6.33 +
    6.34 +help-head::
    6.35 +	@echo  'Available make rules:'
    6.36 +
    6.37 +help-config::
    6.38 +	@echo
    6.39 +	@echo  'Configuration rules:'
    6.40 +
    6.41 +help-samples::
    6.42 +	@echo
    6.43 +	@echo  'Preconfigured rules:'
    6.44 +
    6.45 +help-build::
    6.46 +	@echo
    6.47 +	@echo  'Build rules:'
    6.48 +
    6.49 +help-distrib::
    6.50 +	@echo
    6.51 +	@echo  'Distribution rules:'
    6.52 +
    6.53 +help-env::
    6.54 +	@echo
    6.55 +	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
    6.56 +
    6.57 +help-tail::
    6.58 +	@echo
    6.59 +	@echo  'Execute "$(CT_NG) config" or "$(CT_NG) menuconfig" to configure ct-ng'
    6.60 +	@echo  'Execute "$(CT_NG)" or "$(CT_NG) all" to build all targets marked with [*]'
    6.61 +
    6.62 +# End help system
    6.63 +
    6.64 +help-build::
    6.65 +	@echo  '* build          - Build the toolchain'
    6.66 +	@echo  '  clean          - Remove generated files'
    6.67 +	@echo  '  distclean      - Remove generated files, configuration and build directories'
    6.68 +
    6.69 +include $(CT_LIB_DIR)/kconfig/Makefile
    6.70 +include $(CT_LIB_DIR)/samples/Makefile
    6.71 +include $(CT_LIB_DIR)/tools/Makefile
    6.72 +include $(CT_LIB_DIR)/Makefile.steps
    6.73 +
    6.74 +help-distrib::
    6.75 +	@echo  '  tarball        - Build a tarball of the configured toolchain'
    6.76 +
    6.77 +help-env::
    6.78 +	@echo  '  STOP           - Stop the build just after this step'
    6.79 +	@echo  '  RESTART        - Restart the build just before this step'
    6.80 +
    6.81 +.config:
    6.82 +	@echo  'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
    6.83 +	@false
    6.84 +
    6.85 +# Actual build
    6.86 +build:: .config
    6.87 +	@$(CT_LIB_DIR)/scripts/crosstool.sh
    6.88 +
    6.89 +PHONY += tarball
    6.90 +tarball:
    6.91 +	@$(CT_LIB_DIR)/scripts/tarball.sh
    6.92 +
    6.93 +PHONY += clean
    6.94 +clean::
    6.95 +	@rm -f $(CT_TOP_DIR)/.config.*
    6.96 +
    6.97 +PHONY += distclean
    6.98 +distclean:: clean
    6.99 +	@rm -f $(CT_TOP_DIR)/.config* $(CT_TOP_DIR)/..config.tmp
   6.100 +	@rm -f $(CT_TOP_DIR)/log.*
   6.101 +	@[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
   6.102 +	@rm -rf "$(CT_TOP_DIR)/targets"
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/docs/ct-ng.1.in	Sun Jul 01 19:04:20 2007 +0000
     7.3 @@ -0,0 +1,174 @@
     7.4 +." crosstool-ng man page
     7.5 +." Copyright 2007 Yann E. MORIN
     7.6 +." Licensed under the Creative Commons BY-SA, v2.5
     7.7 +."
     7.8 +." Beautifying URLs
     7.9 +.mso www.tmac
    7.10 +."
    7.11 +.TH ct-ng 1 "@@CT_DATE@@" "version @@CT_VERSION@@" "User Commands"
    7.12 +."
    7.13 +."
    7.14 +.SH NAME
    7.15 +ct-ng, crosstool-ng \- Build cross-toolchains
    7.16 +."
    7.17 +."
    7.18 +.SH SYNOPSIS
    7.19 +.B ct-ng ACTION
    7.20 +."
    7.21 +."
    7.22 +.SH DESCRIPTION
    7.23 +Building a cross-toolchain can be a real pain.
    7.24 +.PP
    7.25 +.B ct-ng
    7.26 +makes it easy to build cross-toolchains, and allows you to take all the juice
    7.27 +out of your target by configuring the differents components of the toolchain
    7.28 +accordingly to the targeted processor.
    7.29 +."
    7.30 +."
    7.31 +.SH ACTIONS
    7.32 +Here are the most commonly used actions. For other actions, please see
    7.33 +.I @@CT_DOCDIR@@/overview.txt
    7.34 +.TP
    7.35 +.B help
    7.36 +Prints a little help text.
    7.37 +."
    7.38 +.TP
    7.39 +.B menuconfig
    7.40 +Configures
    7.41 +.B ct-ng
    7.42 +using a configurator menu very similar to that of the Linux kernel.
    7.43 +."
    7.44 +.TP
    7.45 +.B oldconfig
    7.46 +Apply options found in an existing
    7.47 +.I .config
    7.48 +file, and ask for newer options if there are any.
    7.49 +."
    7.50 +.TP
    7.51 +.B saveconfig
    7.52 +Save the current
    7.53 +.B ct-ng
    7.54 +configuration, and associated components' config files, into a sample. Samples
    7.55 +are saved in their own sub-directory, named after the target's triplet, in the
    7.56 +.I samples
    7.57 +sub-directory of the current directory.
    7.58 +If that was not clear:
    7.59 +.I `pwd`/samples/${CT_TARGET}/
    7.60 +
    7.61 +Samples can be later recalled by calling
    7.62 +.B ct-ng
    7.63 +with the target triplet they represent.
    7.64 +."
    7.65 +.TP
    7.66 +.B build
    7.67 +Builds the configured toolchain. If
    7.68 +.B ct-ng
    7.69 +is called without action, then
    7.70 +.B build
    7.71 +is impiled.
    7.72 +."
    7.73 +.TP
    7.74 +.B liststeps
    7.75 +Lists all build steps available (see 
    7.76 +.BR ENVIRONMENT,
    7.77 +below).
    7.78 +."
    7.79 +.TP
    7.80 +.B clean
    7.81 +Remove files generated by
    7.82 +.B ct-ng
    7.83 +for itself (these are mostly the configurators' binaries).
    7.84 +."
    7.85 +.TP
    7.86 +.B distclean
    7.87 +Same as
    7.88 +.B clean
    7.89 +, but also removes the toolchain build directory, the downloaded files and the
    7.90 +.I .config
    7.91 +configuration file. The generated toolchain is left untouched, as well as
    7.92 +samples which are not removed.
    7.93 +."
    7.94 +.TP
    7.95 +.B regtest
    7.96 +Calls the
    7.97 +.B ct-ng
    7.98 +regression test suite. All samples are build, and the regression test suite is
    7.99 +run against every one of them.
   7.100 +."
   7.101 +.TP
   7.102 +.B updatetools
   7.103 +Updates the
   7.104 +.I config.guess
   7.105 +and
   7.106 +.I config.sub
   7.107 +scripts. These scripts are used by
   7.108 +.B ct-ng
   7.109 +to canonicalise the machines' name (host, build and target machines).
   7.110 +.TP
   7.111 +.B tarball
   7.112 +Builds a tarball of the generated toolchain, also saving the scripts from
   7.113 +.B ct-ng
   7.114 +that are needed to rebuild the target, and also saving the tarballs of the
   7.115 +componnents that were used.
   7.116 +."
   7.117 +.SH ENVIRONMENT
   7.118 +.TP
   7.119 +.B STOP, START
   7.120 +Respectively stops and restarts the build just before this step. To restart a
   7.121 +step, a previous build should have run at least to that step, or further.
   7.122 +
   7.123 +The list of steps is vailable with the action
   7.124 +.BR liststeps .
   7.125 +."
   7.126 +.SH EXIT VALUE
   7.127 +The
   7.128 +.B ct-ng
   7.129 +frontend is in fact a
   7.130 +.BR make (1)
   7.131 +script. See the man page for
   7.132 +.BR make (1)
   7.133 +to have the meaning of the exit values.
   7.134 +."
   7.135 +.SH BUGS
   7.136 +As of today (@@CT_DATE@@), building tarballs is broken. It is difficult to
   7.137 +foresee how every parts of
   7.138 +.B ct-ng
   7.139 +are going to be installed. Each parts is needed to build a tarball, as it
   7.140 +contains all that is needed to rebuild the toolchain from scratch: toolchain
   7.141 +components' sources,
   7.142 +.B ct-ng
   7.143 +configuration, but also all
   7.144 +.B ct-ng
   7.145 +scripts.
   7.146 +."
   7.147 +.SH SECURITY
   7.148 +.B Don't run as root!
   7.149 +Great care has been taken to avoid mistakes, but bug-free programs don't
   7.150 +exist. During normal operation,
   7.151 +.B ct-ng
   7.152 +removes entire directories. If you run as root, and there is a bug or you
   7.153 +mis-configured
   7.154 +.BR ct-ng ,
   7.155 +entire important directories could be removed (eg.
   7.156 +.IR /usr ),
   7.157 +although
   7.158 +.B ct-ng
   7.159 +will refuse to install in some well known critical directories.
   7.160 +."
   7.161 +.SH AUTHORS
   7.162 +.MTO "yann.morin.1998@anciens.enib.fr" "Yann E. MORIN" ""
   7.163 +.URL "http://ymorin.is-a-geek.org" "" ""
   7.164 +reordered
   7.165 +.B crosstool
   7.166 +(see section titled
   7.167 +.BR "SEE ALSO" )
   7.168 +scripts to be more easily maintainable, added the Kconfig configurator, some
   7.169 +patches.
   7.170 +
   7.171 +Please consult the file
   7.172 +.I @@CT_DOCDIR@@/CREDITS
   7.173 +for a list of contributors.
   7.174 +."
   7.175 +.SH SEE ALSO
   7.176 +Please have a look at the
   7.177 +.URL "http://www.kegel.com/crosstool" "original crosstool" " by Daniel KEGEL"
     8.1 --- a/docs/overview.txt	Tue Jun 26 21:23:05 2007 +0000
     8.2 +++ b/docs/overview.txt	Sun Jul 01 19:04:20 2007 +0000
     8.3 @@ -110,9 +110,9 @@
     8.4      /opt/x-tools/${CT_TARGET}
     8.5  
     8.6  CT_TOP_DIR:
     8.7 -  The top directory where crosstool-NG sits. You shouldn't need it in most
     8.8 -  cases. There is one case where you may need it: if you have local patches
     8.9 -  and you store them in your copy of crosstool-NG, you can refer to them
    8.10 +  The top directory where crosstool-NG is running. You shouldn't need it in
    8.11 +  most cases. There is one case where you may need it: if you have local
    8.12 +  patches and you store them in your running directory, you can refer to them
    8.13    by using CT_TOP_DIR, such as:
    8.14      ${CT_TOP_DIR}/patches.myproject
    8.15  
    8.16 @@ -274,13 +274,13 @@
    8.17  Makefile front-end |
    8.18  -------------------*
    8.19  
    8.20 -The Makefile defines a set of rules to call each action. You can get the
    8.21 -list, along with some terse description, by typing "make help" in your
    8.22 -favourite command line.
    8.23 +To Be Written later...
    8.24  
    8.25 -The Makefile sets the version variable from the version file in ${CT_TOP_DIR}
    8.26 -which is then available to others in the CT_VERSION environment variable.
    8.27 +Kconfig parser |
    8.28 +---------------*
    8.29  
    8.30  The kconfig language is a hacked version, vampirised from the toybox project
    8.31 -by Rob LANDLEY (http://www.landley.net/code/toybox/), adapted to my needs.
    8.32 +by Rob LANDLEY (http://www.landley.net/code/toybox/), itself coming from the
    8.33 +Linux kernel (http://www.linux.org/ http://www.kernel.org/), and (heavily)
    8.34 +adapted to my needs.
    8.35  
     9.1 --- a/kconfig/Makefile	Tue Jun 26 21:23:05 2007 +0000
     9.2 +++ b/kconfig/Makefile	Sun Jul 01 19:04:20 2007 +0000
     9.3 @@ -6,9 +6,8 @@
     9.4  export PROJECTVERSION=$(CT_VERSION)
     9.5  
     9.6  KCONFIG_TOP = config/config.in
     9.7 -obj = ./kconfig
     9.8 -PHONY += clean help oldconfig menuconfig config silentoldconfig \
     9.9 -	randconfig allyesconfig allnoconfig allmodconfig defconfig
    9.10 +obj = $(CT_TOP_DIR)/kconfig
    9.11 +PHONY += clean help oldconfig menuconfig config defoldconfig
    9.12  
    9.13  # Darwin (MacOS-X) does not have proper libintl support
    9.14  ifeq ($(shell uname -s),Darwin)
    9.15 @@ -20,14 +19,21 @@
    9.16  endif
    9.17  
    9.18  # Build a list of all config files
    9.19 -CONFIG_FILES = $(filter-out %debug.in,$(shell find $(CT_TOP_DIR)/config -type f -name '*.in'))
    9.20 -DEBUG_CONFIG_FILES = $(shell find $(CT_TOP_DIR)/config/debug -type f -name '*.in')
    9.21 -TOOLS_CONFIG_FILES = $(shell find $(CT_TOP_DIR)/config/tools -type f -name '*.in')
    9.22 +DEBUG_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/debug -type f -name '*.in')
    9.23 +TOOLS_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/tools -type f -name '*.in')
    9.24  
    9.25 -GEN_CONFIG_FILES=$(CT_TOP_DIR)/config/debug.in	\
    9.26 -				 $(CT_TOP_DIR)/config/tools.in
    9.27 +STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in')
    9.28 +GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/debug.in	\
    9.29 +				 $(CT_TOP_DIR)/config.gen/tools.in
    9.30  
    9.31 -$(CT_TOP_DIR)/config/debug.in: $(DEBUG_CONFIG_FILES)
    9.32 +CONFIG_FILES=$(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
    9.33 +
    9.34 +$(GEN_CONFIG_FILES):: $(CT_TOP_DIR)/config.gen
    9.35 +
    9.36 +$(CT_TOP_DIR)/config.gen:
    9.37 +	@mkdir -p $(CT_TOP_DIR)/config.gen
    9.38 +
    9.39 +$(CT_TOP_DIR)/config.gen/debug.in:: $(DEBUG_CONFIG_FILES)
    9.40  	@echo "# Debug facilities menu" >$@
    9.41  	@echo "# Generated file, do not edit!!!" >>$@
    9.42  	@echo "menu \"Debug facilities\"" >>$@
    9.43 @@ -36,7 +42,7 @@
    9.44  	 done >>$@
    9.45  	@echo "endmenu" >>$@
    9.46  
    9.47 -$(CT_TOP_DIR)/config/tools.in: $(TOOLS_CONFIG_FILES)
    9.48 +$(CT_TOP_DIR)/config.gen/tools.in:: $(TOOLS_CONFIG_FILES)
    9.49  	@echo "# Tools facilities menu" >$@
    9.50  	@echo "# Generated file, do not edit!!!" >>$@
    9.51  	@echo "menu \"Tools facilities\"" >>$@
    9.52 @@ -45,16 +51,21 @@
    9.53  	 done >>$@
    9.54  	@echo "endmenu" >>$@
    9.55  
    9.56 -menuconfig: $(obj)/mconf $(GEN_CONFIG_FILES)
    9.57 +config menuconfig oldconfig defoldconfig:: $(KCONFIG_TOP)
    9.58 +
    9.59 +$(KCONFIG_TOP):
    9.60 +	@ln -s $(CT_LIB_DIR)/config config
    9.61 +
    9.62 +menuconfig:: $(obj)/mconf $(CONFIG_FILES)
    9.63  	@$< $(KCONFIG_TOP)
    9.64  
    9.65 -config: $(obj)/conf $(GEN_CONFIG_FILES)
    9.66 +config:: $(obj)/conf $(CONFIG_FILES)
    9.67  	@$< $(KCONFIG_TOP)
    9.68  
    9.69 -oldconfig: $(obj)/conf $(GEN_CONFIG_FILES)
    9.70 +oldconfig:: $(obj)/conf $(CONFIG_FILES)
    9.71  	@$< -s $(KCONFIG_TOP)
    9.72  
    9.73 -defoldconfig:$(obj)/conf $(GEN_CONFIG_FILES)
    9.74 +defoldconfig:: $(obj)/conf $(CONFIG_FILES)
    9.75  	@yes "" |$< -s $(KCONFIG_TOP) >/dev/null
    9.76  
    9.77  # Help text used by make help
    9.78 @@ -65,18 +76,27 @@
    9.79  
    9.80  # Cheesy build
    9.81  
    9.82 -SHIPPED = kconfig/zconf.tab.c kconfig/lex.zconf.c kconfig/zconf.hash.c
    9.83 +SHIPPED = $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c
    9.84  
    9.85  %.c: %.c_shipped
    9.86  	@ln -s $(notdir $<) $@
    9.87  
    9.88 -kconfig/mconf: $(SHIPPED) kconfig/mconf.c
    9.89 -	@$(HOST_CC) $(CFLAGS) -o $@ kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
    9.90 +$(obj)/conf $(obj)/mconf:: $(obj)
    9.91 +
    9.92 +$(obj):
    9.93 +	@mkdir -p $(obj)
    9.94 +
    9.95 +$(obj)/mconf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/mconf.c
    9.96 +	@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
    9.97  		-lcurses "-DCURSES_LOC=<ncurses.h>"
    9.98  
    9.99 -kconfig/conf: $(SHIPPED) kconfig/conf.c
   9.100 -	@$(HOST_CC) $(CFLAGS) -o $@ kconfig/{conf.c,zconf.tab.c}
   9.101 +$(obj)/conf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c
   9.102 +	@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{conf.c,zconf.tab.c}
   9.103  
   9.104  clean::
   9.105 -	@rm -f $(wildcard kconfig/*zconf*.c) kconfig/{conf,mconf}
   9.106 -	@rm -f $(GEN_CONFIG_FILES)
   9.107 +	@rm -f $(CT_TOP_DIR)/kconfig/{,m}conf
   9.108 +	@rm -rf $(CT_TOP_DIR)/config.gen
   9.109 +
   9.110 +distclean::
   9.111 +	@rm -f $(CT_TOP_DIR)/config
   9.112 +	@[ $(CT_LIB_DIR) = $(CT_TOP_DIR) ] || rm -rf $(CT_TOP_DIR)/kconfig
    10.1 --- a/samples/Makefile	Tue Jun 26 21:23:05 2007 +0000
    10.2 +++ b/samples/Makefile	Sun Jul 01 19:04:20 2007 +0000
    10.3 @@ -1,22 +1,31 @@
    10.4  # Makefile to manage samples
    10.5  
    10.6  # Build the list of available samples
    10.7 -CT_SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
    10.8 +CT_TOP_SAMPLES := $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
    10.9 +CT_LIB_SAMPLES := $(filter-out $(CT_TOP_SAMPLES),$(patsubst $(CT_LIB_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_LIB_DIR)/samples/*/crosstool.config)))
   10.10 +
   10.11 +CT_SAMPLES := $(CT_TOP_SAMPLES) $(CT_LIB_SAMPLES)
   10.12  
   10.13  help-config::
   10.14  	@echo  '  saveconfig     - Save current config as a preconfigured target'
   10.15  
   10.16  help-samples::
   10.17 -	@$(CT_TOP_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
   10.18 +	@$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
   10.19  
   10.20  help-build::
   10.21  	@echo  '  regtest        - Regtest-build all samples'
   10.22  
   10.23  # How we do build one sample
   10.24 -.PHONY: $(CT_SAMPLES)
   10.25 +PHONY += $(CT_SAMPLES)
   10.26  $(CT_SAMPLES):
   10.27 -	@cp "$(CT_TOP_DIR)/samples/$(@)/crosstool.config" "$(CT_TOP_DIR)/.config"
   10.28 -	@$(MAKE) oldconfig
   10.29 +	@$(MAKE) -f $(CT_MAKEFILE) $(patsubst %,%_copy_config,$(@)) oldconfig
   10.30 +
   10.31 +$(patsubst %,%_copy_config,$(CT_SAMPLES)):
   10.32 +	@if [ -f $(CT_TOP_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config ]; then                    \
   10.33 +	      cp "$(CT_TOP_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
   10.34 +	 else                                                                                                       \
   10.35 +	      cp "$(CT_LIB_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
   10.36 +	 fi
   10.37  
   10.38  # And now for building all samples one after the other
   10.39  # We could use a simple rule like: 'regtest: $(CT_SAMPLES)', but that doesn't
   10.40 @@ -27,25 +36,25 @@
   10.41  # Finaly, we can't use 'make sample-name' as we need to provide default values
   10.42  # if the options set has changed, but oldconfig does not like when stdin is
   10.43  # not a terminal (eg. it is a pipe).
   10.44 -.PHONY: regtest
   10.45 +PHONY += regtest
   10.46  regtest:
   10.47  	@for samp in $(CT_SAMPLES); do                                                                          \
   10.48  	     echo -e "\rBuilding sample \"$${samp}\""                                                       &&  \
   10.49 -	     cp "$(CT_TOP_DIR)/samples/$${samp}/crosstool.config" "$(CT_TOP_DIR)/.config"                   &&  \
   10.50 -	     yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1                                     &&  \
   10.51 -	     sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config   &&  \
   10.52 +	     $(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) $${samp}_copy_config                                &&  \
   10.53 +	     yes "" |$(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) defoldconfig >/dev/null 2>&1                &&  \
   10.54 +	     sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config  &&  \
   10.55  	     sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config         &&  \
   10.56  	     sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config                                          &&  \
   10.57  	     sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config                                 &&  \
   10.58  	     sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config                                        &&  \
   10.59  	     sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config                                   &&  \
   10.60 -	     yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1                                     &&  \
   10.61 -	     make -C $(CT_TOP_DIR)                                                                          &&  \
   10.62 +	     yes "" |$(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) defoldconfig >/dev/null 2>&1                &&  \
   10.63 +	     $(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE)                                                     &&  \
   10.64  	     echo -e "\rMaking tarball for sample \"$${samp}\""                                             &&  \
   10.65 -	     make -C $(CT_TOP_DIR) tarball;                                                                     \
   10.66 -	     echo -e "\rCleaning sample \"$${samp}\"";                                                          \
   10.67 -	     make -C $(CT_TOP_DIR) distclean;                                                                   \
   10.68 +	     $(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) tarball                                             ;   \
   10.69 +	     echo -e "\rCleaning sample \"$${samp}\""                                                       ;   \
   10.70 +	     $(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) distclean                                           ;   \
   10.71  	 done
   10.72  
   10.73  saveconfig:
   10.74 -	$(CT_TOP_DIR)/scripts/saveSample.sh
   10.75 +	$(CT_LIB_DIR)/scripts/saveSample.sh
    11.1 --- a/scripts/build/debug.sh	Tue Jun 26 21:23:05 2007 +0000
    11.2 +++ b/scripts/build/debug.sh	Sun Jul 01 19:04:20 2007 +0000
    11.3 @@ -2,7 +2,7 @@
    11.4  
    11.5  # List all debug facilities, and parse their scripts
    11.6  CT_DEBUG_FACILITY_LIST=
    11.7 -for f in "${CT_TOP_DIR}/scripts/build/debug/"*.sh; do
    11.8 +for f in "${CT_LIB_DIR}/scripts/build/debug/"*.sh; do
    11.9      is_enabled=
   11.10      . "${f}"
   11.11      f=`basename "${f}" .sh`
    12.1 --- a/scripts/build/tools.sh	Tue Jun 26 21:23:05 2007 +0000
    12.2 +++ b/scripts/build/tools.sh	Sun Jul 01 19:04:20 2007 +0000
    12.3 @@ -2,7 +2,7 @@
    12.4  
    12.5  # List all tools facilities, and parse their scripts
    12.6  CT_TOOLS_FACILITY_LIST=
    12.7 -for f in "${CT_TOP_DIR}/scripts/build/tools/"*.sh; do
    12.8 +for f in "${CT_LIB_DIR}/scripts/build/tools/"*.sh; do
    12.9      is_enabled=
   12.10      . "${f}"
   12.11      f=`basename "${f}" .sh`
    13.1 --- a/scripts/crosstool.sh	Tue Jun 26 21:23:05 2007 +0000
    13.2 +++ b/scripts/crosstool.sh	Sun Jul 01 19:04:20 2007 +0000
    13.3 @@ -12,17 +12,8 @@
    13.4  # options. It also checks the existing environment for un-friendly variables,
    13.5  # and builds the tools.
    13.6  
    13.7 -# CT_TOP_DIR is set by the makefile. If we don't have it, something's gone horribly wrong...
    13.8 -if [ -z "${CT_TOP_DIR}" -o ! -d "${CT_TOP_DIR}" ]; then
    13.9 -    # We don't have the functions right now, because we don't have CT_TOP_DIR.
   13.10 -    # Do the print stuff by hand:
   13.11 -    echo "CT_TOP_DIR not set, or not a directory. Something's gone horribly wrong."
   13.12 -    echo "Please send a bug report (see README)"
   13.13 -    exit 1
   13.14 -fi
   13.15 -
   13.16  # Parse the common functions
   13.17 -. "${CT_TOP_DIR}/scripts/functions"
   13.18 +. "${CT_LIB_DIR}/scripts/functions"
   13.19  
   13.20  CT_STAR_DATE=`CT_DoDate +%s%N`
   13.21  CT_STAR_DATE_HUMAN=`CT_DoDate +%Y%m%d.%H%M%S`
   13.22 @@ -41,7 +32,7 @@
   13.23  CT_DoLog INFO "Build started ${CT_STAR_DATE_HUMAN}"
   13.24  
   13.25  CT_DoStep DEBUG "Dumping crosstool-NG configuration"
   13.26 -cat ${CT_TOP_DIR}/.config |egrep '^(# |)CT_' |CT_DoLog DEBUG
   13.27 +cat "${CT_TOP_DIR}/.config" |egrep '^(# |)CT_' |CT_DoLog DEBUG
   13.28  CT_EndStep
   13.29  
   13.30  # Some sanity checks in the environment and needed tools
   13.31 @@ -143,7 +134,7 @@
   13.32  CT_SYS_MACHINE=`uname -m`
   13.33  CT_SYS_PROCESSOR=`uname -p`
   13.34  CT_SYS_GCC=`gcc -dumpversion`
   13.35 -CT_SYS_TARGET=`${CT_TOP_DIR}/tools/config.guess`
   13.36 +CT_SYS_TARGET=`CT_DoConfigGuess`
   13.37  CT_TOOLCHAIN_ID="crosstool-${CT_VERSION} build ${CT_STAR_DATE_HUMAN} by ${CT_SYS_USER}@${CT_SYS_HOSTNAME}"
   13.38  
   13.39  CT_DoLog EXTRA "Preparing working directories"
   13.40 @@ -225,7 +216,8 @@
   13.41  if [ -z "${CT_RESTART}" ]; then
   13.42      # Determine build system if not set by the user
   13.43      CT_Test "You did not specify the build system. That's OK, I can guess..." -z "${CT_BUILD}"
   13.44 -    CT_BUILD="`${CT_TOP_DIR}/tools/config.sub \"${CT_BUILD:-\`${CT_TOP_DIR}/tools/config.guess\`}\"`"
   13.45 +    CT_BUILD="${CT_BUILD:-`CT_DoConfigGuess`}"
   13.46 +    CT_BUILD=`CT_DoConfigSub "${CT_BUILD}"`
   13.47  
   13.48      # Arrange paths depending on wether we use sys-root or not.
   13.49      if [ "${CT_USE_SYSROOT}" = "y" ]; then
   13.50 @@ -345,14 +337,14 @@
   13.51  
   13.52  # Include sub-scripts instead of calling them: that way, we do not have to
   13.53  # export any variable, nor re-parse the configuration and functions files.
   13.54 -. "${CT_TOP_DIR}/scripts/build/kernel_${CT_KERNEL}.sh"
   13.55 -. "${CT_TOP_DIR}/scripts/build/binutils.sh"
   13.56 -. "${CT_TOP_DIR}/scripts/build/libfloat.sh"
   13.57 -. "${CT_TOP_DIR}/scripts/build/libc_${CT_LIBC}.sh"
   13.58 -. "${CT_TOP_DIR}/scripts/build/cc_core_${CT_CC_CORE}.sh"
   13.59 -. "${CT_TOP_DIR}/scripts/build/cc_${CT_CC}.sh"
   13.60 -. "${CT_TOP_DIR}/scripts/build/debug.sh"
   13.61 -. "${CT_TOP_DIR}/scripts/build/tools.sh"
   13.62 +. "${CT_LIB_DIR}/scripts/build/kernel_${CT_KERNEL}.sh"
   13.63 +. "${CT_LIB_DIR}/scripts/build/binutils.sh"
   13.64 +. "${CT_LIB_DIR}/scripts/build/libfloat.sh"
   13.65 +. "${CT_LIB_DIR}/scripts/build/libc_${CT_LIBC}.sh"
   13.66 +. "${CT_LIB_DIR}/scripts/build/cc_core_${CT_CC_CORE}.sh"
   13.67 +. "${CT_LIB_DIR}/scripts/build/cc_${CT_CC}.sh"
   13.68 +. "${CT_LIB_DIR}/scripts/build/debug.sh"
   13.69 +. "${CT_LIB_DIR}/scripts/build/tools.sh"
   13.70  
   13.71  if [ -z "${CT_RESTART}" ]; then
   13.72      CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
    14.1 --- a/scripts/functions	Tue Jun 26 21:23:05 2007 +0000
    14.2 +++ b/scripts/functions	Sun Jul 01 19:04:20 2007 +0000
    14.3 @@ -425,7 +425,9 @@
    14.4          cd "${file}"
    14.5      fi
    14.6  
    14.7 -    [ "${CUSTOM_PATCH_ONLY}" = "y" ] || official_patch_dir="${CT_TOP_DIR}/patches/${base_file}/${ver_file}"
    14.8 +    official_patch_dir=
    14.9 +    custom_patch_dir=
   14.10 +    [ "${CUSTOM_PATCH_ONLY}" = "y" ] || official_patch_dir="${CT_LIB_DIR}/patches/${base_file}/${ver_file}"
   14.11      [ "${CT_CUSTOM_PATCH}" = "y" ] && custom_patch_dir="${CT_CUSTOM_PATCH_DIR}/${base_file}/${ver_file}"
   14.12      for patch_dir in "${official_patch_dir}" "${custom_patch_dir}"; do
   14.13          if [ -n "${patch_dir}" -a -d "${patch_dir}" ]; then
   14.14 @@ -442,6 +444,24 @@
   14.15      CT_Popd
   14.16  }
   14.17  
   14.18 +# Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.
   14.19 +# Those from CT_TOP_DIR, if they exist, will be be more recent than those from CT_LIB_DIR.
   14.20 +CT_DoConfigGuess() {
   14.21 +    if [ -x "${CT_TOP_DIR}/tools/config.guess" ]; then
   14.22 +        "${CT_TOP_DIR}/tools/config.guess"
   14.23 +    else
   14.24 +        "${CT_LIB_DIR}/tools/config.guess"
   14.25 +    fi
   14.26 +}
   14.27 +
   14.28 +CT_DoConfigSub() {
   14.29 +    if [ -x "${CT_TOP_DIR}/tools/config.sub" ]; then
   14.30 +        "${CT_TOP_DIR}/tools/config.sub" "$@"
   14.31 +    else
   14.32 +        "${CT_LIB_DIR}/tools/config.sub" "$@"
   14.33 +    fi
   14.34 +}
   14.35 +
   14.36  # Compute the target triplet from what is provided by the user
   14.37  # Usage: CT_DoBuildTargetTriplet
   14.38  # In fact this function takes the environment variables to build the target
   14.39 @@ -482,7 +502,7 @@
   14.40          glibc)  CT_TARGET="${CT_TARGET}-gnu";;
   14.41          uClibc) CT_TARGET="${CT_TARGET}-uclibc";;
   14.42      esac
   14.43 -    CT_TARGET="`${CT_TOP_DIR}/tools/config.sub ${CT_TARGET}`"
   14.44 +    CT_TARGET=`CT_DoConfigSub "${CT_TARGET}"`
   14.45  }
   14.46  
   14.47  # This function does pause the build until the user strikes "Return"
    15.1 --- a/scripts/saveSample.sh	Tue Jun 26 21:23:05 2007 +0000
    15.2 +++ b/scripts/saveSample.sh	Sun Jul 01 19:04:20 2007 +0000
    15.3 @@ -8,7 +8,7 @@
    15.4  #  - the kernel .config file if specified
    15.5  #  - the uClibc .config file if uClibc selected
    15.6  
    15.7 -. "${CT_TOP_DIR}/scripts/functions"
    15.8 +. "${CT_LIB_DIR}/scripts/functions"
    15.9  
   15.10  # Don't care about any log file
   15.11  exec >/dev/null
   15.12 @@ -31,12 +31,8 @@
   15.13  CT_LOG_LEVEL_MAX="INFO"
   15.14  
   15.15  # Create the sample directory
   15.16 -# In case it was manually made, add it to svn
   15.17 -if [ -d "${CT_TOP_DIR}/samples/${CT_TARGET}" ]; then
   15.18 -    # svn won't fail when adding a directory already managed by svn
   15.19 -    svn add "${CT_TOP_DIR}/samples/${CT_TARGET}" >/dev/null 2>&1
   15.20 -else
   15.21 -    svn mkdir "${CT_TOP_DIR}/samples/${CT_TARGET}" >/dev/null 2>&1
   15.22 +if [ ! -d "${CT_TOP_DIR}/samples/${CT_TARGET}" ]; then
   15.23 +    mkdir -p "${CT_TOP_DIR}/samples/${CT_TARGET}"
   15.24  fi
   15.25  
   15.26  # Save the crosstool-NG config file
   15.27 @@ -53,19 +49,24 @@
   15.28      if [ "${inode_s}" != "${inode_d}" ]; then
   15.29          cp "${source}" "${dest}"
   15.30      fi
   15.31 -    svn add "${dest}" >/dev/null 2>&1
   15.32  }
   15.33  
   15.34 +if [ "${CT_TOP_DIR}" = "${CT_LIB_DIR}" ]; then
   15.35 +    samp_top_dir="\${CT_LIB_DIR}"
   15.36 +else
   15.37 +    samp_top_dir="\${CT_TOP_DIR}"
   15.38 +fi
   15.39 +
   15.40  # Save the kernel .config file
   15.41  if [ -n "${CT_KERNEL_LINUX_CONFIG_FILE}" ]; then
   15.42      # We save the file, and then point the saved sample to this file
   15.43      CT_DoAddFileToSample "${CT_KERNEL_LINUX_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"
   15.44 -    sed -r -i -e 's|^(CT_KERNEL_LINUX_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"|;' \
   15.45 +    sed -r -i -e 's|^(CT_KERNEL_LINUX_CONFIG_FILE=).+$|\1"'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"|;' \
   15.46          "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
   15.47  else
   15.48      # remove any dangling files
   15.49      for f in "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-"*.config; do
   15.50 -        if [ -f "${f}" ]; then svn rm --force "${f}" >/dev/null 2>&1; fi
   15.51 +        if [ -f "${f}" ]; then rm -f "${f}"; fi
   15.52      done
   15.53  fi
   15.54  
   15.55 @@ -73,17 +74,11 @@
   15.56  if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
   15.57      # We save the file, and then point the saved sample to this file
   15.58      CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
   15.59 -    sed -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
   15.60 +    sed -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
   15.61          "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
   15.62  else
   15.63      # remove any dangling files
   15.64      for f in "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-"*.config; do
   15.65 -        if [ -f "${f}" ]; then svn rm --force "${f}" >/dev/null 2>&1; fi
   15.66 +        if [ -f "${f}" ]; then rm -f "${f}"; fi
   15.67      done
   15.68  fi
   15.69 -
   15.70 -# We could svn add earlier, but it's better to
   15.71 -# add a frozen file than modifying it later
   15.72 -svn add "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config" >/dev/null 2>&1
   15.73 -
   15.74 -svn stat "${CT_TOP_DIR}/samples/${CT_TARGET}" 2>/dev/null |CT_DoLog INFO
    16.1 --- a/scripts/showSamples.sh	Tue Jun 26 21:23:05 2007 +0000
    16.2 +++ b/scripts/showSamples.sh	Sun Jul 01 19:04:20 2007 +0000
    16.3 @@ -10,9 +10,16 @@
    16.4  dump_single_sample() {
    16.5      local width="$1"
    16.6      local sample="$2"
    16.7 -    printf "  %-*s" ${width} "${sample}"
    16.8 -    [ -f "${CT_TOP_DIR}/samples/${sample}/broken" ] && printf "  (broken)"
    16.9 -    echo
   16.10 +    if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
   16.11 +        sample_top="${CT_TOP_DIR}"
   16.12 +        sample_type="local"
   16.13 +    else
   16.14 +        sample_top="${CT_LIB_DIR}"
   16.15 +        sample_type="global"
   16.16 +    fi
   16.17 +    printf "  %-*s  (%s" ${width} "${sample}" "${sample_type}"
   16.18 +    [ -f "${sample_top}/samples/${sample}/broken" ] && printf ",broken"
   16.19 +    echo ")"
   16.20  }
   16.21  
   16.22  # Get largest sample width
    17.1 --- a/scripts/tarball.sh	Tue Jun 26 21:23:05 2007 +0000
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,98 +0,0 @@
    17.4 -#!/bin/bash
    17.5 -
    17.6 -# This scripts makes a tarball of the configured toolchain
    17.7 -# Pre-requisites:
    17.8 -#  - crosstool-NG is configured
    17.9 -#  - components tarball are available
   17.10 -#  - toolchain is built successfully
   17.11 -
   17.12 -# We need the functions first:
   17.13 -. "${CT_TOP_DIR}/scripts/functions"
   17.14 -
   17.15 -# Don't care about any log file
   17.16 -exec >/dev/null
   17.17 -rm -f "${tmp_log_file}"
   17.18 -
   17.19 -# Parse the configuration file:
   17.20 -. ${CT_TOP_DIR}/.config
   17.21 -
   17.22 -CT_DoBuildTargetTriplet
   17.23 -
   17.24 -# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
   17.25 -# re-parse them:
   17.26 -. "${CT_TOP_DIR}/.config"
   17.27 -
   17.28 -# Build a one-line list of files to include
   17.29 -CT_DoStep DEBUG "Building list of tarballs to add"
   17.30 -CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
   17.31 -CT_TARBALLS=""
   17.32 -for dir in '' tools debug; do
   17.33 -    CT_DoStep DEBUG "Scanning directory \"${dir}\""
   17.34 -    for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
   17.35 -        CT_DoStep DEBUG "Testing component \"${script}\""
   17.36 -        [ -n "${script}" ] || continue
   17.37 -        unset do_print_file_name
   17.38 -        . "${script}"
   17.39 -        for file in `do_print_filename`; do
   17.40 -            CT_DoLog DEBUG "Finding tarball for \"${file}\""
   17.41 -            [ -n "${file}" ] || continue
   17.42 -            ext=`CT_GetFileExtension "${file}"`
   17.43 -            CT_TestOrAbort "Missing tarball for: \"${file}\"" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
   17.44 -            CT_DoLog DEBUG "Found \"${file}${ext}\""
   17.45 -            CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
   17.46 -        done
   17.47 -        CT_EndStep
   17.48 -    done
   17.49 -    CT_EndStep
   17.50 -done    
   17.51 -CT_EndStep
   17.52 -
   17.53 -# We need to emulate a build directory:
   17.54 -CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
   17.55 -mkdir -p "${CT_BUILD_DIR}"
   17.56 -CT_MktempDir tempdir
   17.57 -
   17.58 -# Save crosstool-ng, as it is configured for the current toolchain.
   17.59 -topdir=`basename "${CT_TOP_DIR}"`
   17.60 -CT_Pushd "${CT_TOP_DIR}/.."
   17.61 -
   17.62 -botdir=`pwd`
   17.63 -
   17.64 -# Build the list of files to exclude
   17.65 -CT_DoLog DEBUG "Building list of files to exclude"
   17.66 -exclude_list="${tempdir}/${CT_TARGET}.list"
   17.67 -{ echo ".svn";                                                  \
   17.68 -  echo "${topdir}/log.*";                                       \
   17.69 -  echo "${topdir}/targets/src";                                 \
   17.70 -  echo "${topdir}/targets/tst";                                 \
   17.71 -  echo "${topdir}/targets/*-*-*-*";                             \
   17.72 -  for t in `ls -1 "${topdir}/targets/tarballs/"`; do            \
   17.73 -      case " ${CT_TARBALLS} " in                                \
   17.74 -          *" ${t} "*) ;;                                        \
   17.75 -          *)          echo "${topdir}/targets/tarballs/${t}";;  \
   17.76 -      esac;                                                     \
   17.77 -  done;                                                         \
   17.78 -} >"${exclude_list}"
   17.79 -
   17.80 -# Render the install directory writable
   17.81 -chmod u+w "${CT_PREFIX_DIR}"
   17.82 -
   17.83 -CT_DoLog INFO "Saving crosstool-ng into the toolchain directory"
   17.84 -tar cvjf "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"    \
   17.85 -    --no-wildcards-match-slash                                  \
   17.86 -    -X "${exclude_list}"                                        \
   17.87 -    "${topdir}"                                                 2>&1 |CT_DoLog ALL
   17.88 -
   17.89 -CT_Popd
   17.90 -
   17.91 -CT_DoLog INFO "Saving the toolchain"
   17.92 -tar cvjf "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}"    2>&1 |CT_DoLog ALL
   17.93 -
   17.94 -CT_DoLog DEBUG "Getting rid of working directories"
   17.95 -rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
   17.96 -rm -rf "${tempdir}"
   17.97 -
   17.98 -if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
   17.99 -    # Render the install directory non-writable
  17.100 -    chmod u-w "${CT_PREFIX_DIR}"
  17.101 -fi
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/scripts/tarball.sh.broken	Sun Jul 01 19:04:20 2007 +0000
    18.3 @@ -0,0 +1,98 @@
    18.4 +#!/bin/bash
    18.5 +
    18.6 +# This scripts makes a tarball of the configured toolchain
    18.7 +# Pre-requisites:
    18.8 +#  - crosstool-NG is configured
    18.9 +#  - components tarball are available
   18.10 +#  - toolchain is built successfully
   18.11 +
   18.12 +# We need the functions first:
   18.13 +. "${CT_TOP_DIR}/scripts/functions"
   18.14 +
   18.15 +# Don't care about any log file
   18.16 +exec >/dev/null
   18.17 +rm -f "${tmp_log_file}"
   18.18 +
   18.19 +# Parse the configuration file:
   18.20 +. ${CT_TOP_DIR}/.config
   18.21 +
   18.22 +CT_DoBuildTargetTriplet
   18.23 +
   18.24 +# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
   18.25 +# re-parse them:
   18.26 +. "${CT_TOP_DIR}/.config"
   18.27 +
   18.28 +# Build a one-line list of files to include
   18.29 +CT_DoStep DEBUG "Building list of tarballs to add"
   18.30 +CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
   18.31 +CT_TARBALLS=""
   18.32 +for dir in '' tools debug; do
   18.33 +    CT_DoStep DEBUG "Scanning directory \"${dir}\""
   18.34 +    for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
   18.35 +        CT_DoStep DEBUG "Testing component \"${script}\""
   18.36 +        [ -n "${script}" ] || continue
   18.37 +        unset do_print_file_name
   18.38 +        . "${script}"
   18.39 +        for file in `do_print_filename`; do
   18.40 +            CT_DoLog DEBUG "Finding tarball for \"${file}\""
   18.41 +            [ -n "${file}" ] || continue
   18.42 +            ext=`CT_GetFileExtension "${file}"`
   18.43 +            CT_TestOrAbort "Missing tarball for: \"${file}\"" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
   18.44 +            CT_DoLog DEBUG "Found \"${file}${ext}\""
   18.45 +            CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
   18.46 +        done
   18.47 +        CT_EndStep
   18.48 +    done
   18.49 +    CT_EndStep
   18.50 +done    
   18.51 +CT_EndStep
   18.52 +
   18.53 +# We need to emulate a build directory:
   18.54 +CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
   18.55 +mkdir -p "${CT_BUILD_DIR}"
   18.56 +CT_MktempDir tempdir
   18.57 +
   18.58 +# Save crosstool-ng, as it is configured for the current toolchain.
   18.59 +topdir=`basename "${CT_TOP_DIR}"`
   18.60 +CT_Pushd "${CT_TOP_DIR}/.."
   18.61 +
   18.62 +botdir=`pwd`
   18.63 +
   18.64 +# Build the list of files to exclude
   18.65 +CT_DoLog DEBUG "Building list of files to exclude"
   18.66 +exclude_list="${tempdir}/${CT_TARGET}.list"
   18.67 +{ echo ".svn";                                                  \
   18.68 +  echo "${topdir}/log.*";                                       \
   18.69 +  echo "${topdir}/targets/src";                                 \
   18.70 +  echo "${topdir}/targets/tst";                                 \
   18.71 +  echo "${topdir}/targets/*-*-*-*";                             \
   18.72 +  for t in `ls -1 "${topdir}/targets/tarballs/"`; do            \
   18.73 +      case " ${CT_TARBALLS} " in                                \
   18.74 +          *" ${t} "*) ;;                                        \
   18.75 +          *)          echo "${topdir}/targets/tarballs/${t}";;  \
   18.76 +      esac;                                                     \
   18.77 +  done;                                                         \
   18.78 +} >"${exclude_list}"
   18.79 +
   18.80 +# Render the install directory writable
   18.81 +chmod u+w "${CT_PREFIX_DIR}"
   18.82 +
   18.83 +CT_DoLog INFO "Saving crosstool-ng into the toolchain directory"
   18.84 +tar cvjf "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"    \
   18.85 +    --no-wildcards-match-slash                                  \
   18.86 +    -X "${exclude_list}"                                        \
   18.87 +    "${topdir}"                                                 2>&1 |CT_DoLog ALL
   18.88 +
   18.89 +CT_Popd
   18.90 +
   18.91 +CT_DoLog INFO "Saving the toolchain"
   18.92 +tar cvjf "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}"    2>&1 |CT_DoLog ALL
   18.93 +
   18.94 +CT_DoLog DEBUG "Getting rid of working directories"
   18.95 +rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
   18.96 +rm -rf "${tempdir}"
   18.97 +
   18.98 +if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
   18.99 +    # Render the install directory non-writable
  18.100 +    chmod u-w "${CT_PREFIX_DIR}"
  18.101 +fi
    19.1 --- a/tools/Makefile	Tue Jun 26 21:23:05 2007 +0000
    19.2 +++ b/tools/Makefile	Sun Jul 01 19:04:20 2007 +0000
    19.3 @@ -1,11 +1,31 @@
    19.4 +# Makefile for the tools/ sub-directory
    19.5 +
    19.6 +# Here, we can update the config.* scripts.
    19.7 +# If we're in CT_LIB_DIR, then CT_LIB_DIR == CT_TOP_DIR, and we can update those
    19.8 +# scripts for later inclusion mainline. If CT_LIB_DIR != CT_TOP_DIR, then those
    19.9 +# scripts are downloaded only for use in CT_TOP_DIR.
   19.10 +
   19.11  CONFIG_SUB_SRC="http://cvs.savannah.gnu.org/viewcvs/*checkout*/config/config/config.sub"
   19.12  CONFIG_SUB_DEST="$(CT_TOP_DIR)/tools/config.sub"
   19.13  CONFIG_GUESS_SRC="http://cvs.savannah.gnu.org/viewcvs/*checkout*/config/config/config.guess"
   19.14  CONFIG_GUESS_DEST="$(CT_TOP_DIR)/tools/config.guess"
   19.15  
   19.16 -updatetools:
   19.17 -	@wget "$(CONFIG_SUB_SRC)" -O "$(CONFIG_SUB_DEST)"
   19.18 -	@wget "$(CONFIG_GUESS_SRC)" -O "$(CONFIG_GUESS_DEST)"
   19.19 +$(CT_TOP_DIR)/tools:
   19.20 +	@mkdir -p $(CT_TOP_DIR)/tools
   19.21 +
   19.22 +PHONY += updatetools
   19.23 +updatetools: $(CT_TOP_DIR)/tools $(CONFIG_SUB_DEST) $(CONFIG_GUESS_DEST)
   19.24 +
   19.25 +$(CONFIG_SUB_DEST):
   19.26 +	@wget $(CONFIG_SUB_SRC) -O $@
   19.27 +	@chmod u+rwx,go+rx-w $@
   19.28 +
   19.29 +$(CONFIG_GUESS_DEST):
   19.30 +	@wget $(CONFIG_GUESS_SRC) -O $@
   19.31 +	@chmod u+rwx,go+rx-w $@
   19.32  
   19.33  help-distrib::
   19.34  	@echo  '  updatetools    - Update the config tools'
   19.35 +
   19.36 +distclean::
   19.37 +	@[ $(CT_TOP_DIR) = $(CT_LIB_DIR) ] || rm -rf $(CT_TOP_DIR)/tools