git: share/mk: Add bsd.dragonfly.mk to provide source tree path variables

Aaron LI aly at crater.dragonflybsd.org
Thu Nov 19 05:11:16 PST 2026


commit 517e6a0319757d7af48419c026617e6205625f03
Author: Aaron LI <aly at aaronly.me>
Date:   Thu Nov 19 09:20:26 2026 +0800

    share/mk: Add bsd.dragonfly.mk to provide source tree path variables
    
    The include file provides the DF.SRCTOP, DF.RELDIR, DF.RELTOP and
    DF.OBJTOP variables to help access the source and object trees, and thus
    help avoid the complex and fragile relative paths that depend on the
    location of the including makefiles.
    
    In particular, DF.SRCTOP and DF.OBJTOP defines the absolute paths to the
    source and object trees, so makefiles using these variables can be
    included by any other makefiles, without hacking a variable to fix the
    relative-path-based addressing. For example, gnu/usr.bin/cc120 hacks
    this need with the "TOP_PREFIX" variable.
    
    This idea is inspired by FreeBSD's SRCTOP, which is defined in
    <src.sys.env.mk> and is finally included by <sys.mk>, so it becomes an
    early global and can be directly used by any makefiles.  We decided to
    not touch <sys.mk> but place it in a separate include file (i.e.,
    <bsd.dragonfly.mk>), so any makefiles that really want these variables
    must explicitly include it.  By the way, NetBSD also defines the
    _SRC_TOP_ variable in <bsd.own.mk>, without exposing it through <sys.mk>.
    
    Discussed-with: swildner

Summary of changes:
 share/mk/Makefile         |  1 +
 share/mk/bsd.README       | 20 ++++++++++++++++++++
 share/mk/bsd.dragonfly.mk | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+)
 create mode 100644 share/mk/bsd.dragonfly.mk

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/517e6a0319757d7af48419c026617e6205625f03


-- 
DragonFly BSD source repository


More information about the Commits mailing list