share/mk: Deduplicate some handling of debug info
bsd.prog.mk and bsd.lib.mk contain a bunch of duplicated logic used to
handle DEBUG_FLAGS and standalone debug file info (enabled by
MK_DEBUG_FILES). In anticipation of adding more duplicated logic, let's
try factoring it out into a separate bsd.debug.mk first.
bsd.debug.mk now handles the following:
- MK_ASSERT_DEBUG
- installation rules for debug files (the consumer has to set DEBUGFILE)
- updating CFLAGS and CXXFLAGS based on DEBUG_FLAGS
- optionally stripping installed files
No functional change intended.
Reviewed by: bdrewery
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D51805
(cherry picked from commit 3a239e46c4aa1dc62a74b40f6a0feb030f089a0c)