aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/mk/auto.dep.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/mk/auto.dep.mk')
-rw-r--r--contrib/bmake/mk/auto.dep.mk56
1 files changed, 37 insertions, 19 deletions
diff --git a/contrib/bmake/mk/auto.dep.mk b/contrib/bmake/mk/auto.dep.mk
index d905649ab206..400789a37366 100644
--- a/contrib/bmake/mk/auto.dep.mk
+++ b/contrib/bmake/mk/auto.dep.mk
@@ -1,8 +1,9 @@
+# SPDX-License-Identifier: BSD-2-Clause
#
# RCSid:
-# $Id: auto.dep.mk,v 1.6 2020/08/19 17:51:53 sjg Exp $
+# $Id: auto.dep.mk,v 1.12 2024/02/17 17:26:57 sjg Exp $
#
-# @(#) Copyright (c) 2010, Simon J. Gerraty
+# @(#) Copyright (c) 2010-2021, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
@@ -30,45 +31,62 @@
# dep.mk will handle that itself.
#
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
-
-# this what bmake > 20100401 will look for
-.MAKE.DEPENDFILE ?= .depend
+__${.PARSEFILE}__: .NOTMAIN
# set this to -MMD to ignore /usr/include
# actually it ignores <> so may not be a great idea
CFLAGS_MD ?= -MD
# -MF etc not available on all gcc versions.
+.if ${COMPILER_TYPE:Ugcc} == "gcc" && ${COMPILER_VERSION:U0} < 30000
+CFLAGS_MF=
+.endif
CFLAGS_MF ?= -MF ${.TARGET:T}.d -MT ${.TARGET:T}
CFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
CXXFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
-CLEANFILES += .depend ${.MAKE.DEPENDFILE} *.d
+CLEANFILES += .depend *.d
+
+.if ${MAKE_VERSION} >= 20160218
+
+# we have .dinclude and this is all that is required
+.if empty(_SKIP_BUILD)
+_all_objs = ${OBJS} ${POBJS} ${SOBJS}
+.for d in ${_all_objs:M*o:T:O:u:%=%.d}
+.dinclude <$d>
+.endfor
+.endif
+
+.else # we lack .dinclude
+
+.if ${.MAKE.MODE:Unormal:Mmeta} != ""
+# ignore .MAKE.DEPENDFILE
+DEPENDFILE = .depend
+.else
+# this what bmake > 20100401 will look for
+.MAKE.DEPENDFILE ?= .depend
+DEPENDFILE ?= ${.MAKE.DEPENDFILE}
+.endif
+
+CLEANFILES += ${DEPENDFILE}
-.if ${MAKE_VERSION} < 20160218
# skip generating dependfile for misc targets
.if ${.TARGETS:Uall:M*all} != ""
-.END: ${.MAKE.DEPENDFILE}
+.END: ${DEPENDFILE}
.endif
# doing 'make depend' isn't a big win with this model
.if !target(depend)
-depend: ${.MAKE.DEPENDFILE}
+depend: ${DEPENDFILE}
.endif
# this is trivial
-${.MAKE.DEPENDFILE}: ${OBJS} ${POBJS} ${SOBJS}
+${DEPENDFILE}: ${OBJS} ${POBJS} ${SOBJS}
-@for f in ${.ALLSRC:M*o:T:O:u:%=%.d}; do \
echo ".-include \"$$f\""; \
done > $@
-.else
-# we have .dinclude
-.if empty(_SKIP_BUILD)
-_all_objs = ${OBJS} ${POBJS} ${SOBJS}
-.for d in ${_all_objs:M*o:T:O:u:%=%.d}
-.dinclude <$d>
-.endfor
-.endif
.endif
+
+.-include <ccm.dep.mk>
+
.endif