blob: 1b31832b8ea921a48b7748ca68946a23d636741c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# $Id: ccm.dep.mk,v 1.4 2025/08/09 22:42:24 sjg Exp $
#
# @(#) Copyright (c) 2024, Simon J. Gerraty
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
#
# C++ Modules need extra help - at least in a clean tree
.if !target(__${_this}__)
__${_this}__: .NOTMAIN
# These should all be set by now
CCM_SUFFIXES ?= ${.SUFFIXES:M*.c*m}
PCM ?= .pcm
OBJ_SUFFIXES ?= ${.SUFFIXES:M*o}
.ccm_srcs := ${CCM_SUFFIXES:@s@${SRCS:M*$s}@}
.if !empty(.ccm_srcs)
.ccm_srcs += ${CXX_SUFFIXES:@s@${SRCS:M*$s}@}
# this is likely overkill, but
# with .dinclude it should not matter
.ccm_depend: ${.ccm_srcs}
@rm -f ${.TARGET}
.for s r e in ${.ccm_srcs:@x@$x ${x:T:R} ${x:E}@}
@mlist=`sed -n '/^import/s,.*[[:space:]]\([^[:space:];]*\);.*,\1,p' ${.ALLSRC:M*$s}`; \
for o in ${OBJ_SUFFIXES:O:u}; do \
for m in $$mlist; do \
echo $r$$o: $$m${PCM}; \
done; \
done >> ${.TARGET}
.endfor
.if make(depend)
x != echo; rm -f .ccm_depend
.endif
.if !make(.ccm_depend)
.if !exists(.ccm_depend)
# ugly, but it does the trick
x != echo; ${.MAKE} -B -C ${.CURDIR} -f ${MAKEFILE} .ccm_depend
.endif
CLEANFILES += .ccm_depend
# the ${.OBJDIR}/ is necessary!
.dinclude <${.OBJDIR}/.ccm_depend>
.endif
.endif
.endif
|