aboutsummaryrefslogtreecommitdiff
path: root/package/gdb/gdb.mk
diff options
context:
space:
mode:
Diffstat (limited to 'package/gdb/gdb.mk')
-rw-r--r--package/gdb/gdb.mk62
1 files changed, 49 insertions, 13 deletions
diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
index 6b63a6214b..17e10e8b16 100644
--- a/package/gdb/gdb.mk
+++ b/package/gdb/gdb.mk
@@ -8,10 +8,19 @@ GDB_VERSION = $(call qstrip,$(BR2_GDB_VERSION))
GDB_SITE = $(BR2_GNU_MIRROR)/gdb
GDB_SOURCE = gdb-$(GDB_VERSION).tar.xz
+# recent gdb versions (>= 10) have gdbserver moved at the top-level,
+# which requires a different build logic.
+ifeq ($(BR2_GDB_VERSION_10),y)
+GDB_GDBSERVER_TOPLEVEL = y
+endif
+
ifeq ($(BR2_arc),y)
GDB_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,$(GDB_VERSION))
GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
GDB_FROM_GIT = y
+# recent gdb versions (>= 10) have gdbserver moved at the top-level,
+# which requires a different build logic.
+GDB_GDBSERVER_TOPLEVEL = y
endif
ifeq ($(BR2_csky),y)
@@ -22,24 +31,24 @@ endif
GDB_LICENSE = GPL-2.0+, LGPL-2.0+, GPL-3.0+, LGPL-3.0+
GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
+GDB_CPE_ID_VENDOR = gnu
-# We only want gdbserver and not the entire debugger.
-ifeq ($(BR2_PACKAGE_GDB_DEBUGGER),)
+# On gdb < 10, if you want to build only gdbserver, you need to
+# configure only gdb/gdbserver.
+ifeq ($(BR2_PACKAGE_GDB_DEBUGGER)$(GDB_GDBSERVER_TOPLEVEL),)
GDB_SUBDIR = gdb/gdbserver
+
+# When we want to build the full gdb, or for very recent versions of
+# gdb with gdbserver at the top-level, out of tree build is mandatory,
+# so we create a 'build' subdirectory in the gdb sources, and build
+# from there.
else
-GDB_DEPENDENCIES = ncurses \
- $(if $(BR2_PACKAGE_LIBICONV),libiconv)
GDB_SUBDIR = build
-
-# Since gdb 9, in-tree builds for GDB are not allowed anymore,
-# so we create a 'build' subdirectory in the gdb sources, and
-# build from there.
define GDB_CONFIGURE_SYMLINK
mkdir -p $(@D)/$(GDB_SUBDIR)
ln -sf ../configure $(@D)/$(GDB_SUBDIR)/configure
endef
GDB_PRE_CONFIGURE_HOOKS += GDB_CONFIGURE_SYMLINK
-
endif
# For the host variant, we really want to build with XML support,
@@ -79,7 +88,8 @@ GDB_DISABLE_BINUTILS_CONF_OPTS = \
--disable-binutils \
--disable-install-libbfd \
--disable-ld \
- --disable-gas
+ --disable-gas \
+ --disable-gprof
GDB_CONF_ENV = \
ac_cv_type_uintptr_t=yes \
@@ -137,13 +147,29 @@ GDB_CONF_OPTS = \
--without-x \
--disable-sim \
$(GDB_DISABLE_BINUTILS_CONF_OPTS) \
- $(if $(BR2_PACKAGE_GDB_SERVER),--enable-gdbserver,--disable-gdbserver) \
- --with-curses \
--without-included-gettext \
--disable-werror \
--enable-static \
--without-mpfr
+ifeq ($(BR2_PACKAGE_GDB_DEBUGGER),y)
+GDB_CONF_OPTS += \
+ --enable-gdb \
+ --with-curses
+GDB_DEPENDENCIES = ncurses \
+ $(if $(BR2_PACKAGE_LIBICONV),libiconv)
+else
+GDB_CONF_OPTS += \
+ --disable-gdb \
+ --without-curses
+endif
+
+ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
+GDB_CONF_OPTS += --enable-gdbserver
+else
+GDB_CONF_OPTS += --disable-gdbserver
+endif
+
# When gdb is built as C++ application for ARC it segfaults at runtime
# So we pass --disable-build-with-cxx config option to force gdb not to
# be built as C++ app.
@@ -169,8 +195,18 @@ GDB_CONF_OPTS += --disable-tui
endif
ifeq ($(BR2_PACKAGE_GDB_PYTHON),y)
-GDB_CONF_OPTS += --with-python=$(TOPDIR)/package/gdb/gdb-python-config
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+# CONF_ENV: for top-level configure; MAKE_ENV: for sub-projects' configure.
+GDB_CONF_ENV += BR_PYTHON_VERSION=$(PYTHON3_VERSION_MAJOR)
+GDB_MAKE_ENV += BR_PYTHON_VERSION=$(PYTHON3_VERSION_MAJOR)
+GDB_DEPENDENCIES += python3
+else
+# CONF_ENV: for top-level configure; MAKE_ENV: for sub-projects' configure.
+GDB_CONF_ENV += BR_PYTHON_VERSION=$(PYTHON_VERSION_MAJOR)
+GDB_MAKE_ENV += BR_PYTHON_VERSION=$(PYTHON_VERSION_MAJOR)
GDB_DEPENDENCIES += python
+endif
+GDB_CONF_OPTS += --with-python=$(TOPDIR)/package/gdb/gdb-python-config
else
GDB_CONF_OPTS += --without-python
endif