git: b45ab4b000b4 - main - Move the adding of CFLAGS_LAST to bsd.sys.mk

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Thu, 28 Sep 2023 21:02:43 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=b45ab4b000b46d301a0d95b856590067e3d67eb5

commit b45ab4b000b46d301a0d95b856590067e3d67eb5
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2023-09-28 21:01:56 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2023-09-28 21:01:56 +0000

    Move the adding of CFLAGS_LAST to bsd.sys.mk
    
    The point of CFLAGS_LAST is to be the last thing in CFLAGS
    so add it last.
    
    For DIRDEPS_BUILD this can best be done via local.dirdeps-build.mk
    which is guaranteed to be the last makefile read, but that does nothing
    for non-DIRDEPS_BUILD
    
    bsd.sys.mk is close enough to the end.
    
    Reviewed by:    obrien
    Differential Revision:  https://reviews.freebsd.org/D42001
---
 share/mk/bsd.sys.mk       | 5 +++++
 share/mk/local.autodep.mk | 4 ----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 2b1a3e103b89..4cbe01404876 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -501,3 +501,8 @@ ${_tgt}: ${META_DEPS}
 .endif
 .endfor
 .endif
+
+# we are generally the last makefile read
+CFLAGS+= ${CFLAGS_LAST}
+CXXFLAGS+= ${CXXFLAGS_LAST}
+LDFLAGS+= ${LDFLAGS_LAST}
diff --git a/share/mk/local.autodep.mk b/share/mk/local.autodep.mk
index d3772aa2b819..bc5bfd3e75db 100644
--- a/share/mk/local.autodep.mk
+++ b/share/mk/local.autodep.mk
@@ -11,10 +11,6 @@ NOSSPPICO?= .nossppico
 PIEO?= .pieo
 OBJ_EXTENSIONS+= ${NOSSPPICO} ${PIEO}
 
-CFLAGS+= ${CFLAGS_LAST}
-CXXFLAGS+= ${CXXFLAGS_LAST}
-LDFLAGS+= ${LDFLAGS_LAST}
-
 CLEANFILES+= .depend
 
 # handy for debugging