build: use configure rule whether host tool is built
Use a configure variable to control whether the host tool is built. It
is built by default.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ic5052fbd20cb16fe7fec8fc09d25b90457a5a645
diff --git a/Makefile.am b/Makefile.am
index 9dbe34a..8789663 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -86,4 +86,8 @@
$(CODE_COVERAGE_CXXFLAGS) \
-flto
-SUBDIRS = . test tools
+SUBDIRS = . test
+
+if BUILD_HOST_TOOL
+SUBDIRS += tools
+endif
diff --git a/configure.ac b/configure.ac
index c5619e8..b555c76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,13 @@
AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])])
# Configurability
+
+# Enable building the host tool (default: yes)
+AC_ARG_ENABLE([build-host-tool],
+ AC_HELP_STRING([--disable-build-host-tool], [Disable building the host tool])
+)
+AM_CONDITIONAL([BUILD_HOST_TOOL], [test "x$enable_build_host_tool" != "xno"])
+
# Enable static layout for firmware image staging.
AC_ARG_ENABLE([static-layout],
AS_HELP_STRING([--enable-static-layout],
diff --git a/test/Makefile.am b/test/Makefile.am
index c8eee3f..f0f87a4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -32,10 +32,14 @@
firmware_delete_unittest \
firmware_sessionstat_unittest \
firmware_commit_unittest \
- file_handler_unittest \
+ file_handler_unittest
+
+if BUILD_HOST_TOOL
+check_PROGRAMS += \
tools_bt_unittest \
tools_lpc_unittest \
tools_updater_unittest
+endif
TESTS = $(check_PROGRAMS)
@@ -75,6 +79,7 @@
file_handler_unittest_SOURCES = file_handler_unittest.cpp
file_handler_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la -lstdc++fs
+if BUILD_HOST_TOOL
tools_bt_unittest_SOURCES = tools_bt_unittest.cpp
tools_bt_unittest_LDADD = $(top_builddir)/tools/libupdater.la
@@ -83,3 +88,4 @@
tools_updater_unittest_SOURCES = tools_updater_unittest.cpp
tools_updater_unittest_LDADD = $(top_builddir)/tools/libupdater.la
+endif