summaryrefslogtreecommitdiffstats
path: root/share/mk/bsd.dep.mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk/bsd.dep.mk')
-rw-r--r--share/mk/bsd.dep.mk34
1 files changed, 28 insertions, 6 deletions
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk
index dea59e6..c76258e 100644
--- a/share/mk/bsd.dep.mk
+++ b/share/mk/bsd.dep.mk
@@ -73,7 +73,7 @@ tags: ${SRCS}
CLEANFILES?=
.if !exists(${.OBJDIR}/${DEPENDFILE})
-.for _S in ${SRCS:N*.[hly]}
+.for _S in ${SRCS:N*.[dhly]}
${_S:R}.o: ${_S}
.endfor
.endif
@@ -121,14 +121,36 @@ ${_YC:R}.o: ${_YC}
.endfor
# DTrace probe definitions
+# libelf is currently needed for drti.o
+.if ${SRCS:M*.d}
+LDFLAGS+= -lelf
+LDADD+= ${LIBELF}
+CFLAGS+= -D_DTRACE_VERSION=1 -I${.OBJDIR}
+.endif
.for _DSRC in ${SRCS:M*.d:N*/*}
-.for _DH in ${_DSRC:R}.h
-${_DH}: ${_DSRC}
- ${DTRACE} -xnolibs -h -s ${.ALLSRC}
-SRCS:= ${SRCS:S/${_DSRC}/${_DH}/}
-CLEANFILES+= ${_DH}
+.for _D in ${_DSRC:R}
+DHDRS+= ${_D}.h
+${_D}.h: ${_DSRC}
+ ${DTRACE} -xnolibs -h -s ${.ALLSRC}
+SRCS:= ${SRCS:S/${_DSRC}/${_D}.h/}
+OBJS+= ${_D}.o
+CLEANFILES+= ${_D}.h ${_D}.o
+${_D}.o: ${_D}.h ${OBJS:S/${_D}.o//}
+ ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \
+ ${OBJS:S/${_D}.o//}
+.if defined(LIB)
+CLEANFILES+= ${_D}.So ${_D}.po
+${_D}.So: ${_D}.h ${SOBJS:S/${_D}.So//}
+ ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \
+ ${SOBJS:S/${_D}.So//}
+${_D}.po: ${_D}.h ${POBJS:S/${_D}.po//}
+ ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \
+ ${POBJS:S/${_D}.po//}
+.endif
.endfor
.endfor
+beforedepend: ${DHDRS}
+beforebuild: ${DHDRS}
.endif
.if !target(depend)
OpenPOWER on IntegriCloud