diff mbox series

[15/19] pdbg/gdbserver: Make gdbserver optional

Message ID 20180829015047.7355-16-rashmica.g@gmail.com
State Superseded
Headers show
Series Basic gdbserver for POWER8 | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch fail Test build-multiarch on branch master

Commit Message

Rashmica Gupta Aug. 29, 2018, 1:50 a.m. UTC
Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
---
 Makefile.am     | 21 +++++++++++----------
 configure.ac    |  6 ++++++
 src/pdbgproxy.c |  3 ++-
 3 files changed, 19 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/Makefile.am b/Makefile.am
index 4d193fc..4e78c2e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,21 +78,22 @@  pdbg_SOURCES = \
 	src/parsers.c \
 	src/optcmd.c \
 	src/options_@ARCH@.c \
-	src/htm.h \
-	src/main.h \
-	src/optcmd.h \
-	src/options.h \
-	src/parsers.h \
-	src/progress.h \
-	src/pdbgproxy.c \
-	src/gdb_parser.c
+	src/pdbgproxy.c
+
+pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror -DGIT_SHA1=\"${GIT_SHA1}\" \
+	      $(ARCH_FLAGS)
+
+if GDBSERVER
+pdbg_SOURCES += \
+	$(extra_sources)
+else
+pdbg_CFLAGS += -DDISABLE_GDBSERVER
+endif
 
 pdbg_LDADD = $(DT_objects) libpdbg.la libfdt.la libccan.a \
 	-L.libs -lrt
 
 pdbg_LDFLAGS = -Wl,--whole-archive,-lpdbg,--no-whole-archive
-pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror -DGIT_SHA1=\"${GIT_SHA1}\" \
-	      $(ARCH_FLAGS)
 
 lib_LTLIBRARIES = libpdbg.la libfdt.la
 
diff --git a/configure.ac b/configure.ac
index 7cfd2ea..24440ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,4 +36,10 @@  AC_SUBST([ARCH])
 AM_CONDITIONAL([TARGET_ARM], [test x"$ARCH" = "xarm"])
 AM_CONDITIONAL([TARGET_PPC], [test x"$ARCH" = "xppc"])
 
+AC_ARG_ENABLE(gdbserver,
+AC_HELP_STRING([--disable-gdbserver], [disables building the gdbserver]),
+want_gdbserver=false,
+want_gdbserver=true)
+AM_CONDITIONAL([GDBSERVER], [test x$want_gdbserver = xtrue])
+
 AC_OUTPUT
diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index 7a7da41..1088aad 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -28,6 +28,7 @@ 
 #define PR_ERROR(x, args...) \
 	pdbg_log(PDBG_ERROR, x, ##args)
 
+#ifndef DISABLE_GDBSERVER
 static struct pdbg_target *thread_target = NULL;
 static struct timeval timeout;
 static int poll_interval;
@@ -452,7 +453,7 @@  int gdbserver_start(struct pdbg_target *target, uint16_t port)
 
 	return 1;
 }
-
+#endif
 
 static int gdbserver(uint16_t port)
 {