summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2016-01-20 01:40:18 +0000
committerbdrewery <bdrewery@FreeBSD.org>2016-01-20 01:40:18 +0000
commit6c8338f92c98e3ad58b3aea6fb9c19294d54068b (patch)
tree0b45a769e1fa68cafac230b9bdffd8d8b4d633ec /share/mk
parent2618e605ee40ed809d86c0504a12725f016c5981 (diff)
downloadFreeBSD-src-6c8338f92c98e3ad58b3aea6fb9c19294d54068b.zip
FreeBSD-src-6c8338f92c98e3ad58b3aea6fb9c19294d54068b.tar.gz
mkdep: Fix -include not being added for .depend tracking.
This fixes incremental build of OpenSSH after the recent upgrade. For example, in secure/lib/libssh, -include ssh_namespace.h is used on all files. This is not tracked in the .depend file though due to MKDEP_CFLAGS not including it. The ssh example was broken in r291941 when not using FAST_DEPEND due to the .depend bug. FAST_DEPEND was not affected by this because it generates dependencies at compile time and thus sees the -include. This ugly make syntax could be simpler for bmake by using :tW but fmake-compatible syntax is used since this needs to be MFC'd all the way to stable/9. Also add a temporary hack to workaround existing checkouts building incrementally with a .depend file not having these headers. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.dep.mk19
1 files changed, 17 insertions, 2 deletions
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk
index ab28426..95730af 100644
--- a/share/mk/bsd.dep.mk
+++ b/share/mk/bsd.dep.mk
@@ -196,12 +196,27 @@ depend: beforedepend ${DEPENDFILE} afterdepend
# Tell bmake not to look for generated files via .PATH
.NOPATH: ${DEPENDFILE} ${DEPENDFILES_OBJS}
+.if ${MK_FAST_DEPEND} == "no"
+# Capture -include from CFLAGS.
+# This could be simpler with bmake :tW but needs to support fmake for MFC.
+_CFLAGS_INCLUDES= ${CFLAGS:Q:S/\\ /,/g:C/-include,/-include%/g:C/,/ /g:M-include*:C/%/ /g}
+_CXXFLAGS_INCLUDES= ${CXXFLAGS:Q:S/\\ /,/g:C/-include,/-include%/g:C/,/ /g:M-include*:C/%/ /g}
+# XXX: Temporary hack to workaround .depend files not tracking -include
+.if !empty(_CFLAGS_INCLUDES)
+${OBJS} ${POBJS} ${SOBJS}: ${_CFLAGS_INCLUDES:M*.h}
+.endif
+.if !empty(_CXXFLAGS_INCLUDES)
+${OBJS} ${POBJS} ${SOBJS}: ${_CXXFLAGS_INCLUDES:M*.h}
+.endif
+
# Different types of sources are compiled with slightly different flags.
# Split up the sources, and filter out headers and non-applicable flags.
MKDEP_CFLAGS= ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BIDU]*} ${CFLAGS:M-std=*} \
- ${CFLAGS:M-ansi}
+ ${CFLAGS:M-ansi} ${_CFLAGS_INCLUDES}
MKDEP_CXXFLAGS= ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BIDU]*} \
- ${CXXFLAGS:M-std=*} ${CXXFLAGS:M-ansi} ${CXXFLAGS:M-stdlib=*}
+ ${CXXFLAGS:M-std=*} ${CXXFLAGS:M-ansi} ${CXXFLAGS:M-stdlib=*} \
+ ${_CXXFLAGS_INCLUDES}
+.endif # ${MK_FAST_DEPEND} == "no"
DPSRCS+= ${SRCS}
${DEPENDFILE}: ${DPSRCS}
OpenPOWER on IntegriCloud