Module Name:    src
Committed By:   mrg
Date:           Sun Oct 16 04:37:42 UTC 2016

Modified Files:
        src/tools/gdb: Makefile mknative-gdb

Log Message:
pass GDB_MACHINE_ARCH to mknative-gdb and use that as the subdir.
obtain GDB_MACHINE_ARCH from the new gdb Makefile.gdb_arch.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tools/gdb/Makefile
cvs rdiff -u -r1.6 -r1.7 src/tools/gdb/mknative-gdb

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/gdb/Makefile
diff -u src/tools/gdb/Makefile:1.29 src/tools/gdb/Makefile:1.30
--- src/tools/gdb/Makefile:1.29	Fri Oct 14 14:41:59 2016
+++ src/tools/gdb/Makefile	Sun Oct 16 04:37:42 2016
@@ -1,9 +1,10 @@
-#	$NetBSD: Makefile,v 1.29 2016/10/14 14:41:59 christos Exp $
+#	$NetBSD: Makefile,v 1.30 2016/10/16 04:37:42 mrg Exp $
 
 .include <bsd.own.mk>
 
 MODULE=		gdb
-GNUHOSTDIST=    ${.CURDIR}/../../external/gpl3/${EXTERNAL_GDB_SUBDIR}/dist
+GDBDIR=		${.CURDIR}/../../external/gpl3/${EXTERNAL_GDB_SUBDIR}
+GNUHOSTDIST=    ${GDBDIR}/dist
 
 FIND_ARGS=	\! \( -type d -name sim -prune \)
 
@@ -15,6 +16,9 @@ MAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKE
 ALL_TARGET=	all-gdb
 INSTALL_TARGET=	install-gdb
 
+.include "${GDBDIR}/Makefile.gdb_arch"
+#GDB_MACHINE_ARCH=       ${MACHINE_ARCH:C/e?armv[4-7]h?f?/arm/}
+
 .include "${.CURDIR}/../Makefile.gmakehost"
 
 CCADDFLAGS+= --sysroot=${DESTDIR} -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include
@@ -60,7 +64,8 @@ CONFIGURE_ARGS_SIM+= --disable-sim
 native-gdb: .native/.configure_done
 	@echo 'Extracting GDB configury for a native toolchain.'
 	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
-		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
+		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \
+		${GDB_MACHINE_ARCH}
 
 .native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
 	mkdir ${.OBJDIR}/.native 2>/dev/null || true

Index: src/tools/gdb/mknative-gdb
diff -u src/tools/gdb/mknative-gdb:1.6 src/tools/gdb/mknative-gdb:1.7
--- src/tools/gdb/mknative-gdb:1.6	Thu Oct  3 18:58:37 2013
+++ src/tools/gdb/mknative-gdb	Sun Oct 16 04:37:42 2016
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mknative-gdb,v 1.6 2013/10/03 18:58:37 christos Exp $
+#	$NetBSD: mknative-gdb,v 1.7 2016/10/16 04:37:42 mrg Exp $
 #
 # Shell script for generating all the constants needed for a native
 # platform build of src/external/gpl3/gdb
@@ -10,6 +10,7 @@
 _TMPDIR=$2
 _TOP=$3
 _PLATFORM=$4
+_MACHINE_SUBDIR=$5
 _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ 	]*,,'`
 _GDB=external/gpl3/gdb
 
@@ -19,17 +20,17 @@ _GDB=external/gpl3/gdb
 
 get_gdb_libbfd () {
 	local _BFD=$_GDB/lib/libbfd
-	mkdir -p $_TOP/$_BFD/arch/$MACHINE_ARCH
+	mkdir -p $_TOP/$_BFD/arch/$_MACHINE_SUBDIR
 
 	{
 		getvars bfd/Makefile \
 			libbfd_la_DEPENDENCIES libbfd_la_OBJECTS DEFS \
 			INCLUDES TDEFAULTS
-	} | write_mk $_BFD/arch/$MACHINE_ARCH/defs.mk
+	} | write_mk $_BFD/arch/$_MACHINE_SUBDIR/defs.mk
 
 	for i in bfd-in3.h bfd_stdint.h config.h bfd.h bfdver.h targmatch.h 
 	do
-	    write_c $_BFD/arch/$MACHINE_ARCH/$i <$_TMPDIR/bfd/$i
+	    write_c $_BFD/arch/$_MACHINE_SUBDIR/$i <$_TMPDIR/bfd/$i
 	done
 }
 
@@ -37,29 +38,29 @@ get_gdb_libbfd () {
 
 get_gdb_libopcodes () {
 	local _OPCODES=$_GDB/lib/libopcodes
-	mkdir -p $_TOP/$_OPCODES/arch/$MACHINE_ARCH
+	mkdir -p $_TOP/$_OPCODES/arch/$_MACHINE_SUBDIR
 
 	{
 		getvars opcodes/Makefile \
 			archdefs BFD_MACHINES libopcodes_la_SOURCES
-	} | write_mk $_GDB/lib/libopcodes//arch/$MACHINE_ARCH/defs.mk
+	} | write_mk $_GDB/lib/libopcodes//arch/$_MACHINE_SUBDIR/defs.mk
 
 	{
 		cat $_TMPDIR/opcodes/config.h
-	} | write_c $_OPCODES/arch/$MACHINE_ARCH/config.h
+	} | write_c $_OPCODES/arch/$_MACHINE_SUBDIR/config.h
 }
 
 ##### gdb/lib/libiberty #####
 
 get_gdb_libiberty () {
 	local _IBERTY=$_GDB/lib/libiberty
-	mkdir -p $_TOP/$_IBERTY/arch/$MACHINE_ARCH
+	mkdir -p $_TOP/$_IBERTY/arch/$_MACHINE_SUBDIR
 
 	getvars libiberty/Makefile \
 		ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
-		| write_mk $_IBERTY/arch/$MACHINE_ARCH/defs.mk
+		| write_mk $_IBERTY/arch/$_MACHINE_SUBDIR/defs.mk
 
-	write_c $_IBERTY/arch/$MACHINE_ARCH/config.h \
+	write_c $_IBERTY/arch/$_MACHINE_SUBDIR/config.h \
 		<$_TMPDIR/libiberty/config.h
 }
 
@@ -67,14 +68,14 @@ get_gdb_libiberty () {
 
 get_gdb_libreadline () {
 	local _READLINE=$_GDB/lib/libreadline
-	mkdir -p $_TOP/$_READLINE/arch/$MACHINE_ARCH
+	mkdir -p $_TOP/$_READLINE/arch/$_MACHINE_SUBDIR
 
 	{
 		getvars readline/Makefile \
 			CCFLAGS OBJECTS
-	} | write_mk $_READLINE/arch/$MACHINE_ARCH/defs.mk
+	} | write_mk $_READLINE/arch/$_MACHINE_SUBDIR/defs.mk
 
-	write_c $_READLINE/arch/$MACHINE_ARCH/config.h \
+	write_c $_READLINE/arch/$_MACHINE_SUBDIR/config.h \
 		<$_TMPDIR/readline/config.h
 }
 
@@ -82,17 +83,17 @@ get_gdb_libreadline () {
 
 get_gdb_libdecnumber () {
 	local _DECNUMBER=$_GDB/lib/libdecnumber
-	mkdir -p $_TOP/$_DECNUMBER/arch/$MACHINE_ARCH
+	mkdir -p $_TOP/$_DECNUMBER/arch/$_MACHINE_SUBDIR
 
 	getvars libdecnumber/Makefile \
 		libdecnumber_a_OBJS |
 	sed -e s/libdecnumber_a_// |
-	write_mk $_DECNUMBER/arch/$MACHINE_ARCH/defs.mk
+	write_mk $_DECNUMBER/arch/$_MACHINE_SUBDIR/defs.mk
 
-	write_c $_DECNUMBER/arch/$MACHINE_ARCH/config.h \
+	write_c $_DECNUMBER/arch/$_MACHINE_SUBDIR/config.h \
 		<$_TMPDIR/readline/config.h
 
-	write_c $_DECNUMBER/arch/$MACHINE_ARCH/gstdint.h \
+	write_c $_DECNUMBER/arch/$_MACHINE_SUBDIR/gstdint.h \
 		< $_TMPDIR/libdecnumber/gstdint.h
 }
 
@@ -100,53 +101,53 @@ get_gdb_libdecnumber () {
 
 get_gdb_libgdb () {
 	local _GDBP=$_GDB/lib/libgdb
-	mkdir -p $_TOP/$_GDBP/arch/$MACHINE_ARCH/build-gnulib
+	mkdir -p $_TOP/$_GDBP/arch/$_MACHINE_SUBDIR/build-gnulib
 
 	{
 		getvars gdb/Makefile \
 			INTERNAL_CFLAGS LIBGDB_OBS SIM_OBS
-	} | write_mk $_GDBP/arch/$MACHINE_ARCH/defs.mk
+	} | write_mk $_GDBP/arch/$_MACHINE_SUBDIR/defs.mk
 
 #	getvars gdb/gdbserver/Makefile \
 #		INTERNAL_CFLAGS OBS \
-#		| write_mk $_GDB/bin/gdb/arch/$MACHINE_ARCH/gdbserver.mk
+#		| write_mk $_GDB/bin/gdb/arch/$_MACHINE_SUBDIR/gdbserver.mk
 
 	for i in config.h observer.h observer.inc version.c init.c \
 	    xml-builtin.c build-gnulib/config.h jit-reader.h
 	do
-	    write_c $_GDBP/arch/$MACHINE_ARCH/$i \
+	    write_c $_GDBP/arch/$_MACHINE_SUBDIR/$i \
 		< $_TMPDIR/gdb/$i
 	done
 
 	for f in nm tm xm; do
 		if [ -f $_TMPDIR/gdb/$f.h ]; then 
 			ls -l $_TMPDIR/gdb/$f.h | sed 's,^.*->.*/gdb/,,;s,^,#include <,;s,$,>,' \
-				| write_c $_GDBP/arch/$MACHINE_ARCH/$f.h
+				| write_c $_GDBP/arch/$_MACHINE_SUBDIR/$f.h
 		fi
 	done
 
 	local _LIBSIM=$_GDB/lib/libsim
-	case $MACHINE_ARCH in
+	case $_MACHINE_SUBDIR in
 	powerpc*)
-		mkdir -p $_TOP/$_LIBSIM/arch/$MACHINE_ARCH
-		write_c $_LIBSIM/arch/$MACHINE_ARCH/config.h \
+		mkdir -p $_TOP/$_LIBSIM/arch/$_MACHINE_SUBDIR
+		write_c $_LIBSIM/arch/$_MACHINE_SUBDIR/config.h \
 			<$_TMPDIR/sim/ppc/config.h
-		write_c $_LIBSIM/arch/$MACHINE_ARCH/build-config.h \
+		write_c $_LIBSIM/arch/$_MACHINE_SUBDIR/build-config.h \
 			<$_TMPDIR/sim/ppc/build-config.h
-		write_c $_LIBSIM/arch/$MACHINE_ARCH/cconfig.h \
-			<$_TMPDIR/sim/common/cconfig.h
+		#write_c $_LIBSIM/arch/$_MACHINE_SUBDIR/cconfig.h \
+		#	<$_TMPDIR/sim/common/cconfig.h
 		;;
 	xxmips*)	# Disabled for now
-		mkdir -p $_TOP/$_LIBSIM/arch/$MACHINE_ARCH
-		write_c $_LIBSIM/arch/$MACHINE_ARCH/config.h \
+		mkdir -p $_TOP/$_LIBSIM/arch/$_MACHINE_SUBDIR
+		write_c $_LIBSIM/arch/$_MACHINE_SUBDIR/config.h \
 			<$_TMPDIR/sim/mips/config.h
-		write_c $_LIBSIM/arch/$MACHINE_ARCH/cconfig.h \
-			<$_TMPDIR/sim/common/cconfig.h
+		#write_c $_LIBSIM/arch/$_MACHINE_SUBDIR/cconfig.h \
+		#	<$_TMPDIR/sim/common/cconfig.h
 		{
 			getvars sim/mips/Makefile \
 				LIB_OBJS CONFIG_CFLAGS \
 			    	BUILT_SRC_FROM_IGEN IGEN_OBJS
-		} | write_mk $_LIBSIM/arch/$MACHINE_ARCH/defs.mk
+		} | write_mk $_LIBSIM/arch/$_MACHINE_SUBDIR/defs.mk
 		;;
 	*)
 		;;

Reply via email to