From 43cbec9b325b5f5273af723e8ae47280725531c3 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 30 Dec 2021 18:53:35 +0000 Subject: [PATCH] - With DEBUG=-g (which is also set when we build CTF) we build netbsd.gdb *and* netbsd-${KERNEL_CONFIG}.debug because it is not worth having two sets of rules (one that builds just netbsd.gdb and one that builds both netbsd.gdb and netbsd-${KERNEL_CONFIG}.debug. This maintains compatibility building netbsd.gdb when DEBUG=-g - When either MKDEBUGKERNEL=yes or MKDEBUG=tes we set DEBUG=-g if DEBUG was not set. - We only make a debuginstall rule to install netbsd-${KERNEL_CONFIG}.debug if MKDEBUG=yes --- sys/conf/Makefile.kern.inc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/conf/Makefile.kern.inc b/sys/conf/Makefile.kern.inc index 4051a533bfd2..bbd21dffaa3b 100644 --- a/sys/conf/Makefile.kern.inc +++ b/sys/conf/Makefile.kern.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.kern.inc,v 1.290 2021/12/30 17:25:40 christos Exp $ +# $NetBSD: Makefile.kern.inc,v 1.291 2021/12/30 18:53:35 christos Exp $ # # This file contains common `MI' targets and definitions and it is included # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}. @@ -20,6 +20,8 @@ # Default DEBUG to -g if kernel debug info is requested by MKDEBUGKERNEL=yes .if ${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes" DEBUG?=-g +.else +DEBUG?= .endif ## @@ -255,19 +257,7 @@ SYSTEM_LD_TAIL_DEBUG?=&& set -x &&\ LINKFLAGS_NORMAL?= -S STRIPFLAGS?= -g -DEBUG?= .if !empty(DEBUG:M-g*) - -# XXX: KERNEL_DIR? -debuginstall: install-kernel-debug -.for k in ${KERNELS} -install-kernel-debug: ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug - -${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug: ${k}-${KERNEL_CONFIG}.debug - ${_MKTARGET_INSTALL} - ${INSTALL_FILE} -o root -g bin -m 444 ${.ALLSRC} ${.TARGET} -.endfor - SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG} LINKFLAGS+= ${LINKFLAGS_DEBUG} EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@} @@ -277,7 +267,17 @@ TARGETSFX= .gdb LINKFLAGS+= ${LINKFLAGS_NORMAL} .endif -.if !target(debuginstall) +.if ${MKDEBUG:Uno} == "yes" +# XXX: KERNEL_DIR? +debuginstall: install-kernel-debug +.for k in ${KERNELS} +install-kernel-debug: ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug + +${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug: ${k}-${KERNEL_CONFIG}.debug + ${_MKTARGET_INSTALL} + ${INSTALL_FILE} -o root -g bin -m 444 ${.ALLSRC} ${.TARGET} +.endfor +.else debuginstall: .endif