mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 05:16:47 +08:00
configure/sethost: Add BSD host (-B switch) + MAKECMD (make vs gmake).
This patch adds -B switch to select BSD host platforms. Linux uses GNU Make as default, command is `make`. BSD uses BSD Make as default, command is also `make`. BSD can also use GNU Make, but the command is `gmake`. This patch uses `make` on GNU platforms and `gmake` on BSD platforms. Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info> tools/sethost.sh: Add BSD host (-B switch) + MAKECMD (make vs gmake). Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info> tools/configure.c: Add BSD host (-B switch). Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
eb889b0884
commit
2abe1e9282
+30
-2
@@ -52,6 +52,7 @@
|
|||||||
#define HOST_LINUX 1
|
#define HOST_LINUX 1
|
||||||
#define HOST_MACOS 2
|
#define HOST_MACOS 2
|
||||||
#define HOST_WINDOWS 3
|
#define HOST_WINDOWS 3
|
||||||
|
#define HOST_BSD 4
|
||||||
|
|
||||||
#define WINDOWS_NATIVE 1
|
#define WINDOWS_NATIVE 1
|
||||||
#define WINDOWS_CYGWIN 2
|
#define WINDOWS_CYGWIN 2
|
||||||
@@ -166,7 +167,7 @@ static const char *g_optfiles[] =
|
|||||||
|
|
||||||
static void show_usage(const char *progname, int exitcode)
|
static void show_usage(const char *progname, int exitcode)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\nUSAGE: %s [-d] [-E] [-e] [-b|f] [-L] [-l|m|c|g|n] "
|
fprintf(stderr, "\nUSAGE: %s [-d] [-E] [-e] [-b|f] [-L] [-l|m|c|g|n|B] "
|
||||||
"[-a <app-dir>] <board-name>:<config-name> [make-opts]\n",
|
"[-a <app-dir>] <board-name>:<config-name> [make-opts]\n",
|
||||||
progname);
|
progname);
|
||||||
fprintf(stderr, "\nUSAGE: %s [-h]\n", progname);
|
fprintf(stderr, "\nUSAGE: %s [-h]\n", progname);
|
||||||
@@ -203,6 +204,7 @@ static void show_usage(const char *progname, int exitcode)
|
|||||||
fprintf(stderr, " Selects the host environment.\n");
|
fprintf(stderr, " Selects the host environment.\n");
|
||||||
fprintf(stderr, " -l Selects the Linux (l) host environment.\n");
|
fprintf(stderr, " -l Selects the Linux (l) host environment.\n");
|
||||||
fprintf(stderr, " -m Selects the macOS (m) host environment.\n");
|
fprintf(stderr, " -m Selects the macOS (m) host environment.\n");
|
||||||
|
fprintf(stderr, " -B Selects the *BSD (B) host environment.\n");
|
||||||
fprintf(stderr, " -c Selects the Windows Cygwin (c) environment.\n");
|
fprintf(stderr, " -c Selects the Windows Cygwin (c) environment.\n");
|
||||||
fprintf(stderr, " -g Selects the Windows MinGW/MSYS environment.\n");
|
fprintf(stderr, " -g Selects the Windows MinGW/MSYS environment.\n");
|
||||||
fprintf(stderr, " -n Selects the Windows native (n) environment.\n");
|
fprintf(stderr, " -n Selects the Windows native (n) environment.\n");
|
||||||
@@ -266,7 +268,7 @@ static void parse_args(int argc, char **argv)
|
|||||||
|
|
||||||
/* Parse command line options */
|
/* Parse command line options */
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "a:bcdEefghLlmnu")) > 0)
|
while ((ch = getopt(argc, argv, "a:bcdEefghLlmBnu")) > 0)
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
@@ -320,6 +322,10 @@ static void parse_args(int argc, char **argv)
|
|||||||
g_host = HOST_MACOS;
|
g_host = HOST_MACOS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'B' :
|
||||||
|
g_host = HOST_BSD;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'n' :
|
case 'n' :
|
||||||
g_host = HOST_WINDOWS;
|
g_host = HOST_WINDOWS;
|
||||||
g_windows = WINDOWS_NATIVE;
|
g_windows = WINDOWS_NATIVE;
|
||||||
@@ -1352,6 +1358,7 @@ static void set_host(const char *destconfig)
|
|||||||
enable_feature(destconfig, "CONFIG_HOST_LINUX");
|
enable_feature(destconfig, "CONFIG_HOST_LINUX");
|
||||||
disable_feature(destconfig, "CONFIG_HOST_WINDOWS");
|
disable_feature(destconfig, "CONFIG_HOST_WINDOWS");
|
||||||
disable_feature(destconfig, "CONFIG_HOST_MACOS");
|
disable_feature(destconfig, "CONFIG_HOST_MACOS");
|
||||||
|
disable_feature(destconfig, "CONFIG_HOST_BSD");
|
||||||
|
|
||||||
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
|
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
|
||||||
disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
|
disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
|
||||||
@@ -1369,6 +1376,7 @@ static void set_host(const char *destconfig)
|
|||||||
|
|
||||||
disable_feature(destconfig, "CONFIG_HOST_LINUX");
|
disable_feature(destconfig, "CONFIG_HOST_LINUX");
|
||||||
disable_feature(destconfig, "CONFIG_HOST_WINDOWS");
|
disable_feature(destconfig, "CONFIG_HOST_WINDOWS");
|
||||||
|
disable_feature(destconfig, "CONFIG_HOST_BSD");
|
||||||
enable_feature(destconfig, "CONFIG_HOST_MACOS");
|
enable_feature(destconfig, "CONFIG_HOST_MACOS");
|
||||||
|
|
||||||
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
|
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
|
||||||
@@ -1381,11 +1389,31 @@ static void set_host(const char *destconfig)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HOST_BSD:
|
||||||
|
{
|
||||||
|
printf(" Select the BSD host\n");
|
||||||
|
|
||||||
|
disable_feature(destconfig, "CONFIG_HOST_LINUX");
|
||||||
|
disable_feature(destconfig, "CONFIG_HOST_WINDOWS");
|
||||||
|
disable_feature(destconfig, "CONFIG_HOST_MACOS");
|
||||||
|
enable_feature(destconfig, "CONFIG_HOST_BSD");
|
||||||
|
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_MSYS");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_OTHER");
|
||||||
|
|
||||||
|
enable_feature(destconfig, "CONFIG_SIM_X8664_SYSTEMV");
|
||||||
|
disable_feature(destconfig, "CONFIG_SIM_X8664_MICROSOFT");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case HOST_WINDOWS:
|
case HOST_WINDOWS:
|
||||||
{
|
{
|
||||||
enable_feature(destconfig, "CONFIG_HOST_WINDOWS");
|
enable_feature(destconfig, "CONFIG_HOST_WINDOWS");
|
||||||
disable_feature(destconfig, "CONFIG_HOST_LINUX");
|
disable_feature(destconfig, "CONFIG_HOST_LINUX");
|
||||||
disable_feature(destconfig, "CONFIG_HOST_MACOS");
|
disable_feature(destconfig, "CONFIG_HOST_MACOS");
|
||||||
|
disable_feature(destconfig, "CONFIG_HOST_BSD");
|
||||||
|
|
||||||
disable_feature(destconfig, "CONFIG_WINDOWS_OTHER");
|
disable_feature(destconfig, "CONFIG_WINDOWS_OTHER");
|
||||||
|
|
||||||
|
|||||||
+10
-3
@@ -21,9 +21,10 @@ set -e
|
|||||||
|
|
||||||
WD=`test -d ${0%/*} && cd ${0%/*}; pwd`
|
WD=`test -d ${0%/*} && cd ${0%/*}; pwd`
|
||||||
TOPDIR="${WD}/.."
|
TOPDIR="${WD}/.."
|
||||||
|
MAKECMD="make"
|
||||||
USAGE="
|
USAGE="
|
||||||
|
|
||||||
USAGE: ${0} [-E] [-e] [-l|m|c|g|n] [L] [-a <app-dir>] <board-name>:<config-name> [make-opts]
|
USAGE: ${0} [-E] [-e] [-l|m|c|g|n|B] [L] [-a <app-dir>] <board-name>:<config-name> [make-opts]
|
||||||
|
|
||||||
Where:
|
Where:
|
||||||
-E enforces distclean if already configured.
|
-E enforces distclean if already configured.
|
||||||
@@ -33,6 +34,7 @@ Where:
|
|||||||
-c selects the Windows host and Cygwin (c) environment.
|
-c selects the Windows host and Cygwin (c) environment.
|
||||||
-g selects the Windows host and MinGW/MSYS environment.
|
-g selects the Windows host and MinGW/MSYS environment.
|
||||||
-n selects the Windows host and Windows native (n) environment.
|
-n selects the Windows host and Windows native (n) environment.
|
||||||
|
-B selects the *BSD (B) host environment.
|
||||||
Default: Use host setup in the defconfig file
|
Default: Use host setup in the defconfig file
|
||||||
Default Windows: Cygwin
|
Default Windows: Cygwin
|
||||||
-L Lists all available configurations.
|
-L Lists all available configurations.
|
||||||
@@ -86,6 +88,11 @@ while [ ! -z "$1" ]; do
|
|||||||
winnative=y
|
winnative=y
|
||||||
host+=" $1"
|
host+=" $1"
|
||||||
;;
|
;;
|
||||||
|
-B )
|
||||||
|
winnative=n
|
||||||
|
host+=" $1"
|
||||||
|
MAKECMD="gmake"
|
||||||
|
;;
|
||||||
-E )
|
-E )
|
||||||
enforce_distclean=y
|
enforce_distclean=y
|
||||||
;;
|
;;
|
||||||
@@ -173,7 +180,7 @@ fi
|
|||||||
|
|
||||||
if [ -r ${dest_config} ]; then
|
if [ -r ${dest_config} ]; then
|
||||||
if [ "X${enforce_distclean}" = "Xy" ]; then
|
if [ "X${enforce_distclean}" = "Xy" ]; then
|
||||||
make -C ${TOPDIR} distclean
|
${MAKECMD} -C ${TOPDIR} distclean
|
||||||
else
|
else
|
||||||
if cmp -s ${src_config} ${backup_config}; then
|
if cmp -s ${src_config} ${backup_config}; then
|
||||||
echo "No configuration change."
|
echo "No configuration change."
|
||||||
@@ -181,7 +188,7 @@ if [ -r ${dest_config} ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "X${distclean}" = "Xy" ]; then
|
if [ "X${distclean}" = "Xy" ]; then
|
||||||
make -C ${TOPDIR} distclean
|
${MAKECMD} -C ${TOPDIR} distclean
|
||||||
else
|
else
|
||||||
echo "Already configured!"
|
echo "Already configured!"
|
||||||
echo "Please 'make distclean' and try again."
|
echo "Please 'make distclean' and try again."
|
||||||
|
|||||||
+25
-7
@@ -22,14 +22,15 @@ set -e
|
|||||||
progname=$0
|
progname=$0
|
||||||
host=
|
host=
|
||||||
wenv=
|
wenv=
|
||||||
|
MAKECMD="make"
|
||||||
|
|
||||||
function showusage {
|
function showusage {
|
||||||
echo ""
|
echo ""
|
||||||
echo "USAGE: $progname [-l|m|c|g|n] [make-opts]"
|
echo "USAGE: $progname [-l|m|c|g|n|B] [make-opts]"
|
||||||
echo " $progname -h"
|
echo " $progname -h"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Where:"
|
echo "Where:"
|
||||||
echo " -l|m|c|g|n selects Linux (l), macOS (m), Cygwin (c),"
|
echo " -l|m|c|g|n|B selects Linux (l), macOS (m), Cygwin (c), BSD (B),"
|
||||||
echo " MSYS/MSYS2 (g) or Windows native (n). Default Linux"
|
echo " MSYS/MSYS2 (g) or Windows native (n). Default Linux"
|
||||||
echo " make-opts directly pass to make"
|
echo " make-opts directly pass to make"
|
||||||
echo " -h will show this help test and terminate"
|
echo " -h will show this help test and terminate"
|
||||||
@@ -58,6 +59,10 @@ while [ ! -z "$1" ]; do
|
|||||||
host=windows
|
host=windows
|
||||||
wenv=native
|
wenv=native
|
||||||
;;
|
;;
|
||||||
|
-B )
|
||||||
|
host=bsd
|
||||||
|
MAKECMD="gmake"
|
||||||
|
;;
|
||||||
-h )
|
-h )
|
||||||
showusage
|
showusage
|
||||||
;;
|
;;
|
||||||
@@ -74,12 +79,17 @@ done
|
|||||||
# Cygwin: CYGWIN_NT-10.0-WOW
|
# Cygwin: CYGWIN_NT-10.0-WOW
|
||||||
# Linux: Linux
|
# Linux: Linux
|
||||||
# MSYS: MINGW32_NT-6.2
|
# MSYS: MINGW32_NT-6.2
|
||||||
|
# BSD: FreeBSD, OpenBSD, NetBSD, *BSD
|
||||||
|
|
||||||
if [ -z "$host" ]; then
|
if [ -z "$host" ]; then
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin)
|
Darwin)
|
||||||
host=macos
|
host=macos
|
||||||
;;
|
;;
|
||||||
|
*BSD)
|
||||||
|
host=bsd
|
||||||
|
MAKECMD="gmake"
|
||||||
|
;;
|
||||||
CYGWIN*)
|
CYGWIN*)
|
||||||
host=windows
|
host=windows
|
||||||
wenv=cygwin
|
wenv=cygwin
|
||||||
@@ -122,23 +132,30 @@ fi
|
|||||||
|
|
||||||
# Modify the configuration
|
# Modify the configuration
|
||||||
|
|
||||||
if [ "X$host" == "Xlinux" -o "X$host" == "Xmacos" ]; then
|
if [ "X$host" == "Xlinux" -o "X$host" == "Xmacos" -o "X$host" == "Xbsd" ]; then
|
||||||
|
|
||||||
# Disable Windows (to suppress warnings from Window Environment selections)
|
# Disable Windows (to suppress warnings from Window Environment selections)
|
||||||
|
|
||||||
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_WINDOWS
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_WINDOWS
|
||||||
|
|
||||||
# Enable Linux or macOS
|
# Enable Linux or macOS or BSD
|
||||||
|
|
||||||
if [ "X$host" == "Xlinux" ]; then
|
if [ "X$host" == "Xlinux" ]; then
|
||||||
echo " Select CONFIG_HOST_LINUX=y"
|
echo " Select CONFIG_HOST_LINUX=y"
|
||||||
|
|
||||||
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS
|
||||||
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_BSD
|
||||||
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_LINUX
|
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_LINUX
|
||||||
|
|
||||||
|
elif [ "X$host" == "Xbsd" ]; then
|
||||||
|
echo " Select CONFIG_HOST_BSD=y"
|
||||||
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS
|
||||||
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX
|
||||||
|
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_BSD
|
||||||
|
|
||||||
else
|
else
|
||||||
echo " Select CONFIG_HOST_MACOS=y"
|
echo " Select CONFIG_HOST_MACOS=y"
|
||||||
|
|
||||||
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX
|
||||||
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_BSD
|
||||||
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_MACOS
|
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_MACOS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -150,6 +167,7 @@ else
|
|||||||
|
|
||||||
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX
|
||||||
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS
|
||||||
|
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_BSD
|
||||||
|
|
||||||
# Enable Windows and the Microsoft ABI
|
# Enable Windows and the Microsoft ABI
|
||||||
|
|
||||||
@@ -174,4 +192,4 @@ fi
|
|||||||
|
|
||||||
echo " Refreshing..."
|
echo " Refreshing..."
|
||||||
|
|
||||||
make olddefconfig $* || { echo "ERROR: failed to refresh"; exit 1; }
|
${MAKECMD} olddefconfig $* || { echo "ERROR: failed to refresh"; exit 1; }
|
||||||
|
|||||||
Reference in New Issue
Block a user