summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2014-08-13 16:11:57 +0000
committerrpaulo <rpaulo@FreeBSD.org>2014-08-13 16:11:57 +0000
commitcaf76896150c71bd13a04df813a123d4a5213243 (patch)
tree028676c296db6cce5c3cac50b8b7289b492579cd /share/mk
parent809079ca2d0f37321b8134409f4286d4c505caac (diff)
downloadFreeBSD-src-caf76896150c71bd13a04df813a123d4a5213243.zip
FreeBSD-src-caf76896150c71bd13a04df813a123d4a5213243.tar.gz
MFC r268300 r268541 r268544 r268565 r269775 r269838 r269839 r269840
r269842 r269844 r269899: BSD make support for generating and compiling USDT DTrace probes.
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/Makefile1
-rw-r--r--share/mk/bsd.dep.mk34
-rw-r--r--share/mk/bsd.dtrace.mk60
-rw-r--r--share/mk/bsd.lib.mk3
-rw-r--r--share/mk/bsd.prog.mk3
5 files changed, 32 insertions, 69 deletions
diff --git a/share/mk/Makefile b/share/mk/Makefile
index 7d70df7..75b45e8 100644
--- a/share/mk/Makefile
+++ b/share/mk/Makefile
@@ -11,7 +11,6 @@ FILES= \
bsd.crunchgen.mk \
bsd.dep.mk \
bsd.doc.mk \
- bsd.dtrace.mk \
bsd.endian.mk \
bsd.files.mk \
bsd.incs.mk \
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)
diff --git a/share/mk/bsd.dtrace.mk b/share/mk/bsd.dtrace.mk
deleted file mode 100644
index 518de30f..0000000
--- a/share/mk/bsd.dtrace.mk
+++ /dev/null
@@ -1,60 +0,0 @@
-# $FreeBSD$
-#
-# Copyright (c) 2010 The FreeBSD Foundation
-# All rights reserved.
-#
-# This software was developed by Rui Paulo under sponsorship from the
-# FreeBSD Foundation.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-# The only variable that you should define on your Makefile is 'DTRACEOBJS'.
-# You must include this file before bsd.lib.mk or bsd.prog.mk.
-#
-
-.if defined(WITH_DTRACE)
-
-CFLAGS+=-DWITH_DTRACE
-DTRACEHEADERS=${DTRACEOBJS:S/o$/h/}
-DTRACESRCS=${DTRACEOBJS:S/o$/d/}
-CLEANFILES+=${DTRACEOBJS} ${DTRACEHEADERS}
-
-DPADD+=${LIBELF}
-LDADD+=-lelf
-
-.if defined(PROG)
-_DTRACELINKING=${OBJS}
-OBJS+=${DTRACEOBJS}
-.else
-_DTRACELINKING=${SOBJS}
-SOBJS+=${DTRACEOBJS}
-.endif
-
-${DTRACEOBJS}:
-
-beforedepend:
- ${DTRACE} -C -h -s ${DTRACESRCS}
-beforelinking:
- ${DTRACE} -G -s ${DTRACESRCS} ${_DTRACELINKING:S/${DTRACEOBJS}//}
-
-.endif
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index bb3db64..f7025a8 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -117,7 +117,8 @@ PO_FLAG=-pg
${CC} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
-all: objwarn
+all: beforebuild .WAIT
+beforebuild: objwarn
.if defined(PRIVATELIB)
_LIBDIR:=${LIBPRIVATEDIR}
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 22ddfb5..159e879 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -146,7 +146,8 @@ MAN1= ${MAN}
.endif
.endif # defined(PROG)
-all: objwarn ${PROG} ${SCRIPTS}
+all: beforebuild .WAIT ${PROG} ${SCRIPTS}
+beforebuild: objwarn
.if ${MK_MAN} != "no"
all: _manpages
.endif
OpenPOWER on IntegriCloud