Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk Build a .gdbinit in the objdir when building a prog...



details:   https://anonhg.NetBSD.org/src/rev/7e5bbab76548
branches:  trunk
changeset: 536120:7e5bbab76548
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 08 03:59:02 2002 +0000

description:
Build a .gdbinit in the objdir when building a program.  The .gdbinit
file sets the shared library prefix to ${DESTDIR}, and adds "sources"
directives for each file listed in the GDBINIT Makefile variable.

diffstat:

 share/mk/bsd.README  |  11 +++++++++--
 share/mk/bsd.prog.mk |  19 +++++++++++++++----
 2 files changed, 24 insertions(+), 6 deletions(-)

diffs (80 lines):

diff -r a5d00ea729c6 -r 7e5bbab76548 share/mk/bsd.README
--- a/share/mk/bsd.README       Sun Sep 08 02:48:28 2002 +0000
+++ b/share/mk/bsd.README       Sun Sep 08 03:59:02 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.README,v 1.101 2002/08/19 14:51:58 lukem Exp $
+#      $NetBSD: bsd.README,v 1.102 2002/09/08 03:59:02 thorpej Exp $
 #      @(#)bsd.README  8.2 (Berkeley) 4/2/94
 
 This is the README file for the new make "include" files for the BSD
@@ -376,7 +376,10 @@
 It has eight targets:
 
        all:
-               build the program and its manual page
+               build the program and its manual page.  This also
+               creates a GDB initialization file (.gdbinit) in
+               the objdir.  The .gdbinit file sets the shared library
+               prefix to ${DESTDIR} to facilitate cross-debugging.
        clean:
                remove the program, any object files and the files a.out,
                Errs, errs, mklog, and ${PROG}.core.
@@ -414,6 +417,10 @@
 
 CPPFLAGS       Additional flags to the C pre-processor
 
+GDBINIT                List of GDB initialization files to add to "source"
+               directives in the .gdbinit file that is created in the
+               objdir.
+
 LDADD          Additional loader objects.  Usually used for libraries.
                For example, to load with the compatibility and utility
                libraries, use:
diff -r a5d00ea729c6 -r 7e5bbab76548 share/mk/bsd.prog.mk
--- a/share/mk/bsd.prog.mk      Sun Sep 08 02:48:28 2002 +0000
+++ b/share/mk/bsd.prog.mk      Sun Sep 08 03:59:02 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.prog.mk,v 1.156 2002/08/09 00:21:22 thorpej Exp $
+#      $NetBSD: bsd.prog.mk,v 1.157 2002/09/08 03:59:02 thorpej Exp $
 #      @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
 
 .include <bsd.init.mk>
@@ -118,16 +118,27 @@
 _CCLINK=       ${CC}
 .endif
 
+.gdbinit:
+       rm -f .gdbinit
+.if defined(DESTDIR) && !empty(DESTDIR)
+       echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit
+.else
+       touch .gdbinit
+.endif
+.for __gdbinit in ${GDBINIT}
+       echo "source ${__gdbinit}" >> .gdbinit
+.endfor
+
 .if defined(DESTDIR)
 
-${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
+${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
 .if !commands(${PROG})
        ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${DESTDIR}/usr/lib ${_SUPCXX} -lgcc -lc -lgcc ${LIBCRTEND}
 .endif
 
 .else
 
-${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
+${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
 .if !commands(${PROG})
        ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
 .endif
@@ -143,7 +154,7 @@
 realall: ${PROG} ${SCRIPTS}
 
 cleanprog: cleanobjs cleanextra
-       rm -f a.out [Ee]rrs mklog core *.core ${PROG}
+       rm -f a.out [Ee]rrs mklog core *.core .gdbinit ${PROG}
 
 cleanobjs:
 .if defined(OBJS) && !empty(OBJS)



Home | Main Index | Thread Index | Old Index