tools/configure.sh and configure.c. Update to preserve backward compatibility in usage.

This commit is contained in:
Gregory Nutt
2019-08-05 09:03:12 -06:00
parent 31e87abd1c
commit 341cbb272b
2 changed files with 21 additions and 13 deletions
+11 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* tools/configure.c * tools/configure.c
* *
* Copyright (C) 2012, 2017-2018 Gregory Nutt. All rights reserved. * Copyright (C) 2012, 2017-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -550,7 +550,7 @@ static void enumerate_configs(void)
static void check_configdir(void) static void check_configdir(void)
{ {
/* Get the path to the top level configuration directory */ /* Get the path to the top level configuration directory: boards/ */
snprintf(g_buffer, BUFFER_SIZE, "%s%cboards", g_topdir, g_delim); snprintf(g_buffer, BUFFER_SIZE, "%s%cboards", g_topdir, g_delim);
debug("check_configdir: Checking configtop=%s\n", g_buffer); debug("check_configdir: Checking configtop=%s\n", g_buffer);
@@ -558,10 +558,12 @@ static void check_configdir(void)
verify_directory(g_buffer); verify_directory(g_buffer);
g_configtop = strdup(g_buffer); g_configtop = strdup(g_buffer);
/* Get and verify the path to the selected configuration */ /* Get and verify the path to the selected configuration:
* boards/<boarddir>/configs/<configdir>
*/
snprintf(g_buffer, BUFFER_SIZE, "%s%cboards%c%s%c%s", snprintf(g_buffer, BUFFER_SIZE, "%s%cboards%c%s%cconfigs%c%s",
g_topdir, g_delim, g_delim, g_boarddir, g_delim, g_configdir); g_topdir, g_delim, g_delim, g_boarddir, g_delim, g_delim, g_configdir);
debug("check_configdir: Checking configpath=%s\n", g_buffer); debug("check_configdir: Checking configpath=%s\n", g_buffer);
if (!verify_optiondir(g_buffer)) if (!verify_optiondir(g_buffer))
@@ -573,6 +575,10 @@ static void check_configdir(void)
g_configpath = strdup(g_buffer); g_configpath = strdup(g_buffer);
/* Get and verfy the path to the scripts directory:
* boards/<boarddir>/scripts
*/
snprintf(g_buffer, BUFFER_SIZE, "%s%cboards%c%s%cscripts", snprintf(g_buffer, BUFFER_SIZE, "%s%cboards%c%s%cscripts",
g_topdir, g_delim, g_delim, g_boarddir, g_delim); g_topdir, g_delim, g_delim, g_boarddir, g_delim);
debug("check_configdir: Checking scriptspath=%s\n", g_buffer); debug("check_configdir: Checking scriptspath=%s\n", g_buffer);
+10 -8
View File
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# tools/configure.sh # tools/configure.sh
# #
# Copyright (C) 2007, 2008, 2011, 2015, 2017-2018 Gregory Nutt. All rights # Copyright (C) 2007, 2008, 2011, 2015, 2017-2019 Gregory Nutt. All rights
# reserved. # reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
@@ -37,7 +37,7 @@ WD=`test -d ${0%/*} && cd ${0%/*}; pwd`
TOPDIR="${WD}/.." TOPDIR="${WD}/.."
USAGE=" USAGE="
USAGE: ${0} [-d] [-l|m|c|u|g|n] [-a <app-dir>] <board-name>/configs/<config-name> USAGE: ${0} [-d] [-l|m|c|u|g|n] [-a <app-dir>] <board-name>/<config-name>
Where: Where:
-l selects the Linux (l) host environment. -l selects the Linux (l) host environment.
@@ -108,7 +108,7 @@ while [ ! -z "$1" ]; do
*) *)
if [ ! -z "${boardconfig}" ]; then if [ ! -z "${boardconfig}" ]; then
echo "" echo ""
echo "<board/configs/config> defined twice" echo "<board/config> defined twice"
echo "$USAGE" echo "$USAGE"
exit 1 exit 1
fi fi
@@ -122,12 +122,15 @@ done
if [ -z "${boardconfig}" ]; then if [ -z "${boardconfig}" ]; then
echo "" echo ""
echo "Missing <board/configs/config> argument" echo "Missing <board/config> argument"
echo "$USAGE" echo "$USAGE"
exit 2 exit 2
fi fi
configpath=${TOPDIR}/boards/${boardconfig} boarddir=`echo ${boardconfig} | cut -d'/' -f1`
configdir=`echo ${boardconfig} | cut -d'/' -f2`
configpath=${TOPDIR}/boards/${boarddir}/configs/${configdir}
if [ ! -d "${configpath}" ]; then if [ ! -d "${configpath}" ]; then
# Try direct path for convenience. # Try direct path for convenience.
@@ -147,12 +150,11 @@ if [ ! -d "${configpath}" ]; then
fi fi
fi fi
src_makedefs="${configpath}/Make.defs" src_makedefs="${TOPDIR}/boards/${boarddir}/configs/${configdir}/Make.defs"
dest_makedefs="${TOPDIR}/Make.defs" dest_makedefs="${TOPDIR}/Make.defs"
if [ ! -r "${src_makedefs}" ]; then if [ ! -r "${src_makedefs}" ]; then
boardpath=`dirname $configpath` src_makedefs="${TOPDIR}/boards/${boarddir}/scripts/Make.defs"
src_makedefs="${boardpath}/../scripts/Make.defs"
if [ ! -r "${src_makedefs}" ]; then if [ ! -r "${src_makedefs}" ]; then
echo "File Make.defs could not be found" echo "File Make.defs could not be found"