Add the "regtest" make target: call "make regtest", and all samples wil be built, and a tarball made for each of them. First sample to fail causes the test to stop.
1.1 --- a/samples/Makefile Sat Jun 16 22:23:53 2007 +0000
1.2 +++ b/samples/Makefile Sun Jun 17 11:13:48 2007 +0000
1.3 @@ -1,15 +1,48 @@
1.4 -# Build a list of all available samples
1.5 +# Makefile to manage samples
1.6
1.7 -CT_SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(filter-out %Makefile,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config)))
1.8 -.PHONY: $(SAMPLES)
1.9 -$(CT_SAMPLES):
1.10 - @cp "$(CT_TOP_DIR)/samples/$(@)/crosstool.config" "$(CT_TOP_DIR)/.config"
1.11 - @$(MAKE) oldconfig
1.12 +# Build the list of available samples
1.13 +CT_SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
1.14
1.15 help::
1.16 @echo 'Preconfigured targets:'
1.17 @$(CT_TOP_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
1.18 @echo ''
1.19
1.20 +# How we do build one sample
1.21 +.PHONY: $(CT_SAMPLES)
1.22 +$(CT_SAMPLES):
1.23 + @cp "$(CT_TOP_DIR)/samples/$(@)/crosstool.config" "$(CT_TOP_DIR)/.config"
1.24 + @$(MAKE) oldconfig
1.25 +
1.26 +# And now for building all samples one after the other
1.27 +# We could use a simple rule like: 'regtest: $(CT_SAMPLES)', but that doesn't
1.28 +# work because we want to save the samples as well.
1.29 +# Also, we don't want to see anylog at all, save for the elapsed time, and we
1.30 +# want to save the log file in a specific place
1.31 +# Furthermore, force the location where the toolchain will be installed.
1.32 +# Finaly, we can't use 'make sample-name' as we need to provide default values
1.33 +# if the options set has changed, but oldconfig does not like when stdin is
1.34 +# not a terminal (eg. it is a pipe).
1.35 +.PHONY: regtest
1.36 +regtest:
1.37 + @for samp in $(CT_SAMPLES); do \
1.38 + echo "Building sample \"$${samp}\"" && \
1.39 + cp "$(CT_TOP_DIR)/samples/$${samp}/crosstool.config" "$(CT_TOP_DIR)/.config" && \
1.40 + yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1 && \
1.41 + sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config && \
1.42 + sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config && \
1.43 + sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config && \
1.44 + sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config && \
1.45 + sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config && \
1.46 + sed -i -r -e 's:^.*(CT_LOG_FILE).*$$:\1="$${CT_PREFIX_DIR}/build.log":;' .config && \
1.47 + sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config && \
1.48 + yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1 && \
1.49 + make -C $(CT_TOP_DIR) && \
1.50 + make -C $(CT_TOP_DIR) tarball && \
1.51 + chmod -R u+w $(CT_TOP_DIR)/targets && \
1.52 + rm -rf $(CT_TOP_DIR)/targets; \
1.53 + done
1.54 + @make distclean
1.55 +
1.56 saveconfig:
1.57 - @$(CT_TOP_DIR)/scripts/saveSample.sh
1.58 + $(CT_TOP_DIR)/scripts/saveSample.sh
2.1 --- a/scripts/tarball.sh Sat Jun 16 22:23:53 2007 +0000
2.2 +++ b/scripts/tarball.sh Sun Jun 17 11:13:48 2007 +0000
2.3 @@ -9,8 +9,9 @@
2.4 # We need the functions first:
2.5 . "${CT_TOP_DIR}/scripts/functions"
2.6
2.7 -exec 6>&1
2.8 +# Don't care about any log file
2.9 exec >/dev/null
2.10 +rm -f "${tmp_log_file}"
2.11
2.12 # Parse the configuration file:
2.13 . ${CT_TOP_DIR}/.config
2.14 @@ -21,34 +22,30 @@
2.15 # re-parse them:
2.16 . "${CT_TOP_DIR}/.config"
2.17
2.18 -# Override log level
2.19 -unset CT_LOG_ERROR CT_LOG_WARN CT_LOG_EXTRA CT_LOG_DEBUG
2.20 -CT_LOG_INFO=y
2.21 -CT_LOG_LEVEL_MAX="INFO"
2.22 -
2.23 -# Build the files' base names
2.24 -CT_KERNEL_FILE="${CT_KERNEL}-${CT_KERNEL_VERSION}"
2.25 -CT_BINUTILS_FILE="binutils-${CT_BINUTILS_VERSION}"
2.26 -CT_LIBC_FILE="${CT_LIBC}-${CT_LIBC_VERSION}"
2.27 -for addon in ${CT_LIBC_ADDONS_LIST}; do
2.28 - CT_LIBC_ADDONS_FILES="${CT_LIBC_ADDONS_FILES} ${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
2.29 -done
2.30 -[ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && CT_LIBC_ADDONS_FILES="${CT_LIBC_ADDONS_FILES} ${CT_LIBC}-ports-${CT_LIBC_VERSION}"
2.31 -[ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_LIBC_ADDONS_FILES="${CT_LIBC_ADDONS_FILES} ${CT_LIBC}-locales-030818"
2.32 -[ "${CT_CC_USE_CORE}" = "y" ] && CT_CC_CORE_FILE="${CT_CC_CORE}-${CT_CC_CORE_VERSION}"
2.33 -CT_CC_FILE="${CT_CC}-${CT_CC_VERSION}"
2.34 -[ "${CT_ARCH_FLOAT_SW_LIBFLOAT}" = "y" ] && CT_LIBFLOAT_FILE="libfloat-990616"
2.35 -
2.36 -# Build a one-line list of the files to ease scanning below
2.37 +# Build a one-line list of files to include
2.38 +CT_DoStep DEBUG "Building list of tarballs to add"
2.39 CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
2.40 -CT_TARBALLS=" "
2.41 -for file_var in CT_KERNEL_FILE CT_BINUTILS_FILE CT_LIBC_FILE CT_LIBC_ADDONS_FILES CT_CC_CORE_FILE CT_CC_FILE CT_LIBFLOAT_FILE; do
2.42 - for file in ${!file_var}; do
2.43 - ext=`CT_GetFileExtension "${file}"`
2.44 - CT_TestAndAbort "Missing tarball for: \"${file}\"" -z "${ext}"
2.45 - CT_TARBALLS="${CT_TARBALLS}${file}${ext} "
2.46 +CT_TARBALLS=""
2.47 +for dir in '' tools debug; do
2.48 + CT_DoStep DEBUG "Scanning directory \"${dir}\""
2.49 + for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
2.50 + CT_DoStep DEBUG "Testing component \"${script}\""
2.51 + [ -n "${script}" ] || continue
2.52 + unset do_print_file_name
2.53 + . "${script}"
2.54 + for file in `do_print_filename`; do
2.55 + CT_DoLog DEBUG "Finding tarball for \"${file}\""
2.56 + [ -n "${file}" ] || continue
2.57 + ext=`CT_GetFileExtension "${file}"`
2.58 + CT_TestOrAbort "Missing tarball for: \"${file}\"" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
2.59 + CT_DoLog DEBUG "Found \"${file}${ext}\""
2.60 + CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
2.61 + done
2.62 + CT_EndStep
2.63 done
2.64 -done
2.65 + CT_EndStep
2.66 +done
2.67 +CT_EndStep
2.68
2.69 # We need to emulate a build directory:
2.70 CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
2.71 @@ -61,27 +58,39 @@
2.72
2.73 botdir=`pwd`
2.74
2.75 -# Build the list of files to exclude:
2.76 -echo "${topdir}/log.*" >"${tempdir}/${CT_TARGET}.list"
2.77 -echo "${topdir}/targets/*-*-*-*" >>"${tempdir}/${CT_TARGET}.list"
2.78 -for t in `ls -1 "${topdir}/targets/tarballs/"`; do
2.79 - case "${CT_TARBALLS}" in
2.80 - *" ${t} "*) ;;
2.81 - *) echo "${topdir}/targets/tarballs/${t}" >>"${tempdir}/${CT_TARGET}.list"
2.82 - esac
2.83 -done
2.84 +# Build the list of files to exclude
2.85 +CT_DoLog DEBUG "Building list of files to exclude"
2.86 +exclude_list="${tempdir}/${CT_TARGET}.list"
2.87 +{ echo ".svn"; \
2.88 + echo "${topdir}/log.*"; \
2.89 + echo "${topdir}/targets/src"; \
2.90 + echo "${topdir}/targets/tst"; \
2.91 + echo "${topdir}/targets/*-*-*-*"; \
2.92 + for t in `ls -1 "${topdir}/targets/tarballs/"`; do \
2.93 + case " ${CT_TARBALLS} " in \
2.94 + *" ${t} "*) ;; \
2.95 + *) echo "${topdir}/targets/tarballs/${t}";; \
2.96 + esac; \
2.97 + done; \
2.98 +} >"${exclude_list}"
2.99
2.100 -CT_DoLog INFO "Saving crosstool"
2.101 -tar cfj "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2" \
2.102 - --no-wildcards-match-slash \
2.103 - -X "${tempdir}/${CT_TARGET}.list" \
2.104 - "${topdir}" 2>/dev/null
2.105 +# Render the install directory writable
2.106 +chmod u+w "${CT_PREFIX_DIR}"
2.107 +
2.108 +CT_DoLog INFO "Saving crosstool-ng into the toolchain directory"
2.109 +tar cvjf "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2" \
2.110 + --no-wildcards-match-slash \
2.111 + -X "${exclude_list}" \
2.112 + "${topdir}" 2>&1 |CT_DoLog ALL
2.113
2.114 CT_Popd
2.115
2.116 -# Save the generated toolchain
2.117 -CT_DoLog INFO "Saving the generated toolchain"
2.118 -tar cfj "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}" 2>/dev/null
2.119 +CT_DoLog INFO "Saving the toolchain"
2.120 +tar cvjf "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}" 2>&1 |CT_DoLog ALL
2.121
2.122 +CT_DoLog DEBUG "Getting rid of working directories"
2.123 rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
2.124 rm -rf "${tempdir}"
2.125 +
2.126 +# Render the install directory non-writable
2.127 +chmod u-w "${CT_PREFIX_DIR}"