mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
tools/configure.sh: Add -e option to invoke distclean if already configured
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I19eddc3d4e6650eace2482c3cce8fbb07aadc04b
This commit is contained in:
committed by
David Sidrane
parent
1653b29542
commit
c4ea4e976d
+35
-23
@@ -127,6 +127,7 @@ static char g_delim = '/'; /* Delimiter to use when forming pat
|
||||
static bool g_winpaths = false; /* False: POSIX style paths */
|
||||
#endif
|
||||
static bool g_debug = false; /* Enable debug output */
|
||||
static bool g_enforce = false; /* Enfore distclean */
|
||||
|
||||
static const char *g_appdir = NULL; /* Relative path to the application directory */
|
||||
static const char *g_archdir = NULL; /* Name of architecture subdirectory */
|
||||
@@ -173,11 +174,13 @@ static const char *g_optfiles[] =
|
||||
|
||||
static void show_usage(const char *progname, int exitcode)
|
||||
{
|
||||
fprintf(stderr, "\nUSAGE: %s [-d] [-b] [-f] [-l|m|c|u|g|n] [-a <app-dir>] <board-name>:<config-name>\n", progname);
|
||||
fprintf(stderr, "\nUSAGE: %s [-d] [-e] [-b|f] [-l|m|c|u|g|n] [-a <app-dir>] <board-name>:<config-name>\n", progname);
|
||||
fprintf(stderr, "\nUSAGE: %s [-h]\n", progname);
|
||||
fprintf(stderr, "\nWhere:\n");
|
||||
fprintf(stderr, " -d:\n");
|
||||
fprintf(stderr, " Enables debug output\n");
|
||||
fprintf(stderr, " -e:\n");
|
||||
fprintf(stderr, " Enforce distclean if already configured\n");
|
||||
fprintf(stderr, " -b:\n");
|
||||
#ifdef CONFIG_WINDOWS_NATIVE
|
||||
fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files\n");
|
||||
@@ -246,7 +249,7 @@ static void parse_args(int argc, char **argv)
|
||||
|
||||
g_debug = false;
|
||||
|
||||
while ((ch = getopt(argc, argv, "a:bcdfghlmnu")) > 0)
|
||||
while ((ch = getopt(argc, argv, "a:bcdefghlmnu")) > 0)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
@@ -268,6 +271,10 @@ static void parse_args(int argc, char **argv)
|
||||
g_debug = true;
|
||||
break;
|
||||
|
||||
case 'e' :
|
||||
g_enforce = true;
|
||||
break;
|
||||
|
||||
case 'f' :
|
||||
g_delim = '/';
|
||||
g_winpaths = true;
|
||||
@@ -499,6 +506,11 @@ static void find_topdir(void)
|
||||
/* Yes, we are probably in the tools/ sub-directory */
|
||||
|
||||
free(currdir);
|
||||
if (chdir(g_topdir) < 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Failed to ch to %s\n", g_topdir);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,20 +759,27 @@ static void check_configured(void)
|
||||
debug("check_configured: Checking %s\n", g_buffer);
|
||||
if (verify_file(g_buffer))
|
||||
{
|
||||
fprintf(stderr, "ERROR: Found %s... Already configured\n", g_buffer);
|
||||
fprintf(stderr, " Please 'make distclean' and try again\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Try the Make.defs file */
|
||||
|
||||
snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_topdir, g_delim);
|
||||
debug("check_configuration: Checking %s\n", g_buffer);
|
||||
if (verify_file(g_buffer))
|
||||
{
|
||||
fprintf(stderr, "ERROR: Found %s... Already configured\n", g_buffer);
|
||||
fprintf(stderr, " Please 'make distclean' and try again\n");
|
||||
exit(EXIT_FAILURE);
|
||||
if (g_enforce)
|
||||
{
|
||||
if (g_debug)
|
||||
{
|
||||
system("make distclean V=1");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef WIN32
|
||||
system("make distclean");
|
||||
#else
|
||||
system("make distclean 1>/dev/null");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "ERROR: Found %s... Already configured\n", g_buffer);
|
||||
fprintf(stderr, " Please 'make distclean' and try again\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1397,13 +1416,6 @@ static void refresh(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = chdir(g_topdir);
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Failed to ch to %s\n", g_topdir);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf(" Refreshing...\n");
|
||||
fflush(stdout);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user