aboutsummaryrefslogtreecommitdiff
path: root/share/mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.sys.mk9
1 files changed, 8 insertions, 1 deletions
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index a964cf6e596c..80cc3080e552 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -273,7 +273,14 @@ LDFLAGS+= ${LDFLAGS.${LINKER_TYPE}}
# Only allow .TARGET when not using PROGS as it has the same syntax
# per PROG which is ambiguous with this syntax. This is only needed
# for PROG_VARS vars.
-.if !defined(_RECURSING_PROGS)
+#
+# Some directories (currently just clang) also need to disable this since
+# CFLAGS.${COMPILER_TYPE}, CFLAGS.${.IMPSRC:T} and CFLAGS.${.TARGET:T} all live
+# in the same namespace, meaning that, for example, GCC builds of clang pick up
+# CFLAGS.clang via CFLAGS.${.TARGET:T} and thus try to pass Clang-specific
+# flags. Ideally the different sources of CFLAGS would be namespaced to avoid
+# collisions.
+.if !defined(_RECURSING_PROGS) && !defined(NO_TARGET_FLAGS)
.if ${MK_WARNS} != "no"
CFLAGS+= ${CWARNFLAGS.${.TARGET:T}}
.endif