diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist
index 336d055..7b428d5 100644
--- a/etc/mtree/BSD.usr.dist
+++ b/etc/mtree/BSD.usr.dist
@@ -18,6 +18,22 @@
             aout
             ..
         ..
+        debug
+            boot
+            ..
+            lib
+                geom
+                ..
+            ..
+            usr
+                lib
+                    engines
+                    ..
+                ..
+                lib32
+                ..
+            ..
+        ..
         dtrace
         ..
         engines
diff --git a/gnu/usr.bin/gdb/arch/amd64/config.h b/gnu/usr.bin/gdb/arch/amd64/config.h
index ac81c54..ae3e104 100644
--- a/gnu/usr.bin/gdb/arch/amd64/config.h
+++ b/gnu/usr.bin/gdb/arch/amd64/config.h
@@ -440,7 +440,7 @@
 #define PACKAGE "gdb"
 
 /* Global directory for separate debug files.  */
-#define DEBUGDIR "/usr/local/lib/debug"
+#define DEBUGDIR "/usr/lib/debug"
 
 /* Define to BFD's default architecture.  */
 #define DEFAULT_BFD_ARCH bfd_i386_arch
diff --git a/gnu/usr.bin/gdb/arch/arm/config.h b/gnu/usr.bin/gdb/arch/arm/config.h
index e1b128c..26b1891 100644
--- a/gnu/usr.bin/gdb/arch/arm/config.h
+++ b/gnu/usr.bin/gdb/arch/arm/config.h
@@ -452,7 +452,7 @@
 #define PACKAGE "gdb"
 
 /* Global directory for separate debug files.  */
-#define DEBUGDIR "/usr/local/lib/debug"
+#define DEBUGDIR "/usr/lib/debug"
 
 /* Define to BFD's default architecture.  */
 #define DEFAULT_BFD_ARCH bfd_arm_arch
diff --git a/gnu/usr.bin/gdb/arch/i386/config.h b/gnu/usr.bin/gdb/arch/i386/config.h
index f21da4c..30e75c3 100644
--- a/gnu/usr.bin/gdb/arch/i386/config.h
+++ b/gnu/usr.bin/gdb/arch/i386/config.h
@@ -440,7 +440,7 @@
 #define PACKAGE "gdb"
 
 /* Global directory for separate debug files.  */
-#define DEBUGDIR "/usr/local/lib/debug"
+#define DEBUGDIR "/usr/lib/debug"
 
 /* Define to BFD's default architecture.  */
 #define DEFAULT_BFD_ARCH bfd_i386_arch
diff --git a/gnu/usr.bin/gdb/arch/ia64/config.h b/gnu/usr.bin/gdb/arch/ia64/config.h
index 5faa96b..f8c84ab 100644
--- a/gnu/usr.bin/gdb/arch/ia64/config.h
+++ b/gnu/usr.bin/gdb/arch/ia64/config.h
@@ -440,7 +440,7 @@
 #define PACKAGE "gdb"
 
 /* Global directory for separate debug files.  */
-#define DEBUGDIR "/usr/local/lib/debug"
+#define DEBUGDIR "/usr/lib/debug"
 
 /* Define to BFD's default architecture.  */
 #define DEFAULT_BFD_ARCH bfd_ia64_arch
diff --git a/gnu/usr.bin/gdb/arch/mips/config.h b/gnu/usr.bin/gdb/arch/mips/config.h
index 41a6731..01a7869 100644
--- a/gnu/usr.bin/gdb/arch/mips/config.h
+++ b/gnu/usr.bin/gdb/arch/mips/config.h
@@ -440,7 +440,7 @@
 #define PACKAGE "gdb"
 
 /* Global directory for separate debug files.  */
-#define DEBUGDIR "/usr/local/lib/debug"
+#define DEBUGDIR "/usr/lib/debug"
 
 /* Define to BFD's default architecture.  */
 #define DEFAULT_BFD_ARCH bfd_mips_arch
diff --git a/gnu/usr.bin/gdb/arch/powerpc/config.h b/gnu/usr.bin/gdb/arch/powerpc/config.h
index f169fad..49472e7 100644
--- a/gnu/usr.bin/gdb/arch/powerpc/config.h
+++ b/gnu/usr.bin/gdb/arch/powerpc/config.h
@@ -440,7 +440,7 @@
 #define PACKAGE "gdb"
 
 /* Global directory for separate debug files.  */
-#define DEBUGDIR "/usr/local/lib/debug"
+#define DEBUGDIR "/usr/lib/debug"
 
 /* Define to BFD's default architecture.  */
 #define DEFAULT_BFD_ARCH bfd_rs6000_arch
diff --git a/gnu/usr.bin/gdb/arch/powerpc64/config.h b/gnu/usr.bin/gdb/arch/powerpc64/config.h
index d8b9b6d..c904d1d 100644
--- a/gnu/usr.bin/gdb/arch/powerpc64/config.h
+++ b/gnu/usr.bin/gdb/arch/powerpc64/config.h
@@ -440,7 +440,7 @@
 #define PACKAGE "gdb"
 
 /* Global directory for separate debug files.  */
-#define DEBUGDIR "/usr/local/lib/debug"
+#define DEBUGDIR "/usr/lib/debug"
 
 /* Define to BFD's default architecture.  */
 #define DEFAULT_BFD_ARCH bfd_rs6000_arch
diff --git a/gnu/usr.bin/gdb/arch/sparc64/config.h b/gnu/usr.bin/gdb/arch/sparc64/config.h
index 5527a79..ff87c28 100644
--- a/gnu/usr.bin/gdb/arch/sparc64/config.h
+++ b/gnu/usr.bin/gdb/arch/sparc64/config.h
@@ -440,7 +440,7 @@
 #define PACKAGE "gdb"
 
 /* Global directory for separate debug files.  */
-#define DEBUGDIR "/usr/local/lib/debug"
+#define DEBUGDIR "/usr/lib/debug"
 
 /* Define to BFD's default architecture.  */
 #define DEFAULT_BFD_ARCH bfd_sparc_arch
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index aa3567b..a3fa175 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -43,6 +43,10 @@ CTFFLAGS+= -g
 STRIP?=	-s
 .endif
 
+.if defined(MK_DEBUG_FILES) && empty(${DEBUG_FLAGS:M-g})
+CFLAGS+= -g
+.endif
+
 .include <bsd.libnames.mk>
 
 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
@@ -173,8 +177,8 @@ SOLINKOPTS+=	-Wl,--fatal-warnings -Wl,--warn-shared-textrel
 .if target(beforelinking)
 ${SHLIB_NAME}: beforelinking
 .endif
-.if defined(DEBUG_FLAGS)
-${SHLIB_NAME}.debug: ${SOBJS}
+.if defined(MK_DEBUG_FILES)
+${SHLIB_NAME}.full: ${SOBJS}
 .else
 ${SHLIB_NAME}: ${SOBJS}
 .endif
@@ -196,13 +200,13 @@ ${SHLIB_NAME}: ${SOBJS}
 	${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
 .endif
 
-.if defined(DEBUG_FLAGS)
-${SHLIB_NAME}: ${SHLIB_NAME}.debug ${SHLIB_NAME}.symbols
-	${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.symbols \
-	    ${SHLIB_NAME}.debug ${.TARGET}
+.if defined(MK_DEBUG_FILES)
+${SHLIB_NAME}: ${SHLIB_NAME}.full ${SHLIB_NAME}.debug
+	${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \
+	    ${SHLIB_NAME}.full ${.TARGET}
 
-${SHLIB_NAME}.symbols: ${SHLIB_NAME}.debug
-	${OBJCOPY} --only-keep-debug ${SHLIB_NAME}.debug ${.TARGET}
+${SHLIB_NAME}.debug: ${SHLIB_NAME}.full
+	${OBJCOPY} --only-keep-debug ${SHLIB_NAME}.full ${.TARGET}
 .endif
 .endif
 
@@ -280,10 +284,10 @@ _libinstall:
 	${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 	    ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
 	    ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
-.if defined(DEBUG_FLAGS)
+.if defined(MK_DEBUG_FILES)
 	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 	    ${_INSTALLFLAGS} \
-	    ${SHLIB_NAME}.symbols ${DESTDIR}${SHLIBDIR}
+	    ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGDIR}${SHLIBDIR}
 .endif
 .if defined(SHLIB_LINK)
 # ${_SHLIBDIRPREFIX} and ${_LDSCRIPTROOT} are both needed when cross-building
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 78af8fb..cf83264 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -43,6 +43,9 @@
 # LIBMODE	Library mode. [${NOBINMODE}]
 #
 #
+# DEBUGDIR	Base path for standalone debug files. [/usr/lib/debug]
+#
+#
 # KMODDIR	Base path for loadable kernel modules
 #		(see kld(4)). [/boot/kernel]
 #
@@ -147,6 +150,8 @@ LIBOWN?=	${BINOWN}
 LIBGRP?=	${BINGRP}
 LIBMODE?=	${NOBINMODE}
 
+DEBUGDIR?=	/usr/lib/debug
+
 
 # Share files
 SHAREDIR?=	/usr/share
@@ -427,6 +432,7 @@ __DEFAULT_NO_OPTIONS = \
     BSD_GREP \
     CLANG_EXTRAS \
     CTF \
+    DEBUG_FILES \
     HESIOD \
     ICONV \
     IDEA \
