diff --git a/configure.ac b/configure.ac index 3ad21aa60..98cac2c85 100644 --- a/configure.ac +++ b/configure.ac @@ -566,6 +566,38 @@ AC_SUBST(OPENTHREAD_ENABLE_RADIO_ONLY) AM_CONDITIONAL([OPENTHREAD_ENABLE_RADIO_ONLY], [test "${enable_radio_only}" = "yes"]) AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_RADIO_ONLY], [${OPENTHREAD_ENABLE_RADIO_ONLY}], [Define to 1 to build radio-only library.]) +# +# whether to build executables +# + +AC_MSG_CHECKING([whether to build executables]) +AC_ARG_ENABLE(executable, + [AS_HELP_STRING([--enable-executable], [Build executables @<:@default=yes@:>@.])], + [ + case "${enableval}" in + + no|yes) + enable_executable=${enableval} + ;; + + *) + AC_MSG_ERROR([Invalid value ${enable_executable} for --enable-executable]) + ;; + esac + ], + [enable_executable=yes]) + +if test "$enable_executable" = "yes"; then + OPENTHREAD_ENABLE_EXECUTABLE=1 +else + OPENTHREAD_ENABLE_EXECUTABLE=0 +fi + +AC_MSG_RESULT(${enable_executable}) +AC_SUBST(OPENTHREAD_ENABLE_EXECUTABLE) +AM_CONDITIONAL([OPENTHREAD_ENABLE_EXECUTABLE], [test "${enable_executable}" = "yes"]) +AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_EXECUTABLE], [${OPENTHREAD_ENABLE_EXECUTABLE}], [Define to 1 to build executables.]) + # # CLI Library # diff --git a/examples/apps/Makefile.am b/examples/apps/Makefile.am index 60345f668..c5dab8fe4 100644 --- a/examples/apps/Makefile.am +++ b/examples/apps/Makefile.am @@ -40,6 +40,7 @@ DIST_SUBDIRS = \ SUBDIRS = \ $(NULL) +if OPENTHREAD_ENABLE_EXECUTABLE if OPENTHREAD_ENABLE_CLI SUBDIRS += cli endif @@ -47,6 +48,7 @@ endif if OPENTHREAD_ENABLE_NCP SUBDIRS += ncp endif +endif # Always pretty (e.g. for 'make pretty') these subdirectories. diff --git a/examples/common-switches.mk b/examples/common-switches.mk index be57e3ddf..8cdaaf396 100644 --- a/examples/common-switches.mk +++ b/examples/common-switches.mk @@ -131,6 +131,10 @@ ifeq ($(DISABLE_BUILTIN_MBEDTLS), 1) configure_OPTIONS += --disable-builtin-mbedtls endif +ifeq ($(DISABLE_EXECUTABLE), 1) +configure_OPTIONS += --enable-executable=no +endif + ifeq ($(DEBUG_UART),1) CFLAGS += -DOPENTHREAD_CONFIG_ENABLE_DEBUG_UART=1 CXXFLAGS += -DOPENTHREAD_CONFIG_ENABLE_DEBUG_UART=1 diff --git a/src/posix/Makefile.am b/src/posix/Makefile.am index 37bfe95fa..e67257a3b 100644 --- a/src/posix/Makefile.am +++ b/src/posix/Makefile.am @@ -76,6 +76,7 @@ endif # OPENTHREAD_ENABLE_DIAG bin_PROGRAMS = \ $(NULL) +if OPENTHREAD_ENABLE_EXECUTABLE if OPENTHREAD_ENABLE_NCP bin_PROGRAMS += \ ot-ncp \ @@ -150,5 +151,6 @@ CPPFLAGS_COMMON += \ CLEANFILES = $(wildcard *.gcda *.gcno) endif # OPENTHREAD_BUILD_COVERAGE +endif # OPENTHREAD_ENABLE_EXECUTABLE include $(abs_top_nlbuild_autotools_dir)/automake/post.am