tools/configure.sh: Restore support for custom, out-of-tree configurations that was broken in a previous commit.

This commit is contained in:
Gregory Nutt 2019-08-06 08:36:40 -06:00
parent f1462d2a2f
commit c6b5049e3e
3 changed files with 28 additions and 26 deletions

View file

@ -1578,7 +1578,7 @@ tools/
accomplish the same configuration:
</p>
<ul><pre>
tools/configure.sh [OPTIONS] <i>&lt;board-name&gt;</i>:<i>&lt;config-dir&gt;</i>
tools/configure.sh [OPTIONS] <i>&lt;board-name&gt;</i>[:<i>&lt;config-dir&gt;</i>]
</pre></ul>
<p>
@ -1587,6 +1587,13 @@ tools/
<ul><pre>
tools\configure.bat <i>&lt;board-name&gt;</i>:<i>&lt;config-dir&gt;</i>
</pre></ul>
<p>
And, to make sure that other platforms are supported, there is also a C program at <code>tools/configure.c</code> that can be compiled to establish the board configuration on all platforms.
</p>
<p><blockquote><small>
NOTE (2019-08-6): As of this writing, changes to the boards/ directly have made <code>configure.bat</code> unusable.
For the native Windows environment, <code>configure.c</code> is recommended until that batch file can be repaired.
</small></blockquote></p>
<p>
See <code>tools/README.txt</code> for more information about these scripts.
Or use the -h option with <code>configure.sh></code>
@ -1594,7 +1601,7 @@ tools/
<ul><pre>
$ tools/configure.sh -h
USAGE: tools/configure.sh [-d] [-l|m|c|u|g|n] [-a &lt;app-dir&gt;] &lt;board-name&gt;:&lt;config-name&gt;
USAGE: tools/configure.sh [-d] [-l|m|c|u|g|n] [-a &lt;app-dir&gt;] &lt;board-name&gt;[:&lt;config-name&gt;]
Where:
-l selects the Linux (l) host environment.
@ -1616,7 +1623,7 @@ Where:
then you should also specify the location of the application directory on the command line like:
</p>
<ul><pre>
tools/configure.sh -a &lt;app-dir&gt; <i>&lt;board-name&gt;</i>:<i>&lt;config-dir&gt;</i>
tools/configure.sh -a &lt;app-dir&gt; <i>&lt;board-name&gt;</i>[:<i>&lt;config-dir&gt;</i>]
</pre></ul>
<p>

View file

@ -37,7 +37,7 @@ WD=`test -d ${0%/*} && cd ${0%/*}; pwd`
TOPDIR="${WD}/.."
USAGE="
USAGE: ${0} [-d] [-l|m|c|u|g|n] [-a <app-dir>] <board-name>:<config-name>
USAGE: ${0} [-d] [-l|m|c|u|g|n] [-a <app-dir>] <board-name>[:<config-name>]
Where:
-l selects the Linux (l) host environment.
@ -129,15 +129,8 @@ fi
configdir=`echo ${boardconfig} | cut -s -d':' -f2`
if [ -z "${configdir}" ]; then
configdir=`echo ${boardconfig} | cut -s -d'/' -f2`
if [ -z "${configdir}" ]; then
echo ""
echo "Unrecognizable <board/config> argument: ${boardconfig}"
echo "$USAGE"
exit 3
else
boarddir=`echo ${boardconfig} | cut -d'/' -f1`
fi
boarddir=`echo ${boardconfig} | cut -d'/' -f1`
configdir=`echo ${boardconfig} | cut -d'/' -f2`
else
boarddir=`echo ${boardconfig} | cut -d':' -f1`
fi
@ -148,17 +141,17 @@ if [ ! -d "${configpath}" ]; then
configpath=${TOPDIR}/${boardconfig}
if [ ! -d "${configpath}" ]; then
echo "Directory ${configpath} does not exist. Options are:"
echo "Directory for ${boardconfig} does not exist. Options are:"
echo ""
echo "Select one of the following options for <board-name>:"
configlist=`find ${TOPDIR}/boards -name defconfig`
for defconfig in ${configlist}; do
config=`dirname ${defconfig} | sed -e "s,${TOPDIR}/boards/,,g" | sed -e "s,configs/,,g" | sed -e "s,/,:,g"`
config=`dirname ${defconfig} | sed -e "s,${TOPDIR}/boards/,,g" | sed -e "s,/configs/,:,g"`
echo " ${config}"
done
echo ""
echo "$USAGE"
exit 4
exit 3
fi
fi
@ -169,8 +162,11 @@ if [ ! -r "${src_makedefs}" ]; then
src_makedefs="${TOPDIR}/boards/${boarddir}/scripts/Make.defs"
if [ ! -r "${src_makedefs}" ]; then
echo "File Make.defs could not be found"
exit 5
src_makedefs="${TOPDIR}/${boardconfig}/Make.defs"
if [ ! -r "${src_makedefs}" ]; then
echo "File Make.defs could not be found"
exit 4
fi
fi
fi
@ -179,13 +175,13 @@ dest_config="${TOPDIR}/.config"
if [ ! -r "${src_config}" ]; then
echo "File \"${src_config}\" does not exist"
exit 6
exit 5
fi
if [ -r ${dest_config} ]; then
echo "Already configured!"
echo "Do 'make distclean' and try again."
exit 7
exit 6
fi
# Extract values needed from the defconfig file. We need:
@ -256,16 +252,16 @@ winappdir=`echo "${appdir}" | sed -e 's/\\//\\\\\\\/g'`
if [ ! -z "${appdir}" -a ! -d "${TOPDIR}/${posappdir}" ]; then
echo "Directory \"${TOPDIR}/${posappdir}\" does not exist"
exit 8
exit 7
fi
# Okay... Everything looks good. Setup the configuration
echo " Copy files"
install -m 644 "${src_makedefs}" "${dest_makedefs}" || \
{ echo "Failed to copy \"${src_makedefs}\"" ; exit 9 ; }
{ echo "Failed to copy \"${src_makedefs}\"" ; exit 8 ; }
install -m 644 "${src_config}" "${dest_config}" || \
{ echo "Failed to copy \"${src_config}\"" ; exit 10 ; }
{ echo "Failed to copy \"${src_config}\"" ; exit 9 ; }
# Install any optional files
@ -349,7 +345,7 @@ fi
# reconstitued before they can be used.
echo " Refreshing..."
cd ${TOPDIR} || { echo "Failed to cd to ${TOPDIR}"; exit 11; }
cd ${TOPDIR} || { echo "Failed to cd to ${TOPDIR}"; exit 10; }
MAKE_BIN=make
if [ ! -z `which gmake 2>/dev/null` ]; then

View file

@ -1,7 +1,7 @@
#!/bin/bash
# refresh.sh
#
# Copyright (C) 2014, 2016-2017 Gregory Nutt. All rights reserved.
# Copyright (C) 2014, 2016-2017, 2019 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -112,7 +112,6 @@ else
BOARDSUBDIR=`echo ${CONFIG} | cut -d':' -f1`
fi
# Where are we
MYNAME=`basename $0`