diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 41cd55673473..741c9cb2b618 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -35,6 +35,10 @@ NO_WERROR= .if defined(DEBUG_FLAGS) CFLAGS+= ${DEBUG_FLAGS} + +.if !defined(NO_CTF) && (${DEBUG_FLAGS:M-g} != "") +CTFFLAGS+= -g +.endif .endif .if !defined(DEBUG_FLAGS) @@ -64,9 +68,15 @@ PO_FLAG=-pg .c.po: ${CC} ${PO_FLAG} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .c.So: ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .cc.po .C.po .cpp.po .cxx.po: ${CXX} ${PO_FLAG} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} @@ -76,31 +86,58 @@ PO_FLAG=-pg .f.po: ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .f.So: ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .m.po: ${OBJC} ${OBJCFLAGS} -pg -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .m.So: ${OBJC} ${PICFLAG} -DPIC ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .s.po .s.So: ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .asm.po: ${CC} -x assembler-with-cpp -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .asm.So: ${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} \ -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .S.po: ${CC} -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .S.So: ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif all: objwarn @@ -171,6 +208,9 @@ ${SHLIB_NAME}: ${SOBJS} -o ${.TARGET} -Wl,-soname,${SONAME} \ `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD} .endif +.if defined(CTFMERGE) + ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} +.endif .endif .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk index f98cbfe0e41b..1a30c59bf1c4 100644 --- a/share/mk/bsd.libnames.mk +++ b/share/mk/bsd.libnames.mk @@ -33,12 +33,15 @@ LIBCOM_ERR?= ${DESTDIR}${LIBDIR}/libcom_err.a LIBCOMPAT?= ${DESTDIR}${LIBDIR}/libcompat.a LIBCRYPT?= ${DESTDIR}${LIBDIR}/libcrypt.a LIBCRYPTO?= ${DESTDIR}${LIBDIR}/libcrypto.a +LIBCTF?= ${DESTDIR}${LIBDIR}/libctf.a LIBCURSES?= ${DESTDIR}${LIBDIR}/libcurses.a LIBDEVINFO?= ${DESTDIR}${LIBDIR}/libdevinfo.a LIBDEVSTAT?= ${DESTDIR}${LIBDIR}/libdevstat.a LIBDIALOG?= ${DESTDIR}${LIBDIR}/libdialog.a LIBDISK?= ${DESTDIR}${LIBDIR}/libdisk.a LIBDNS?= ${DESTDIR}${LIBDIR}/libdns.a +LIBDTRACE?= ${DESTDIR}${LIBDIR}/libdtrace.a +LIBDWARF?= ${DESTDIR}${LIBDIR}/libdwarf.a LIBEDIT?= ${DESTDIR}${LIBDIR}/libedit.a LIBELF?= ${DESTDIR}${LIBDIR}/libelf.a LIBFETCH?= ${DESTDIR}${LIBDIR}/libfetch.a @@ -124,6 +127,7 @@ MINUSLPAM+= -lypclnt LIBPANEL?= ${DESTDIR}${LIBDIR}/libpanel.a LIBPCAP?= ${DESTDIR}${LIBDIR}/libpcap.a LIBPMC?= ${DESTDIR}${LIBDIR}/libpmc.a +LIBPROC?= ${DESTDIR}${LIBDIR}/libproc.a LIBPTHREAD?= ${DESTDIR}${LIBDIR}/libpthread.a LIBRADIUS?= ${DESTDIR}${LIBDIR}/libradius.a LIBREADLINE?= ${DESTDIR}${LIBDIR}/libreadline.a diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index b9fee3287d62..c8f2f723c834 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -17,6 +17,10 @@ NO_WERROR= .if defined(DEBUG_FLAGS) CFLAGS+=${DEBUG_FLAGS} + +.if !defined(NO_CTF) && (${DEBUG_FLAGS:M-g} != "") +CTFFLAGS+= -g +.endif .endif .if defined(CRUNCH_CFLAGS) @@ -56,6 +60,9 @@ ${PROG}: ${OBJS} .else ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .endif +.if defined(CTFMERGE) + ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} +.endif .else # !defined(SRCS) @@ -79,6 +86,9 @@ ${PROG}: ${OBJS} .else ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .endif +.if defined(CTFMERGE) + ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} +.endif .endif .endif diff --git a/share/mk/sys.mk b/share/mk/sys.mk index b4a5963ce284..c469a0354cec 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -45,6 +45,25 @@ CFLAGS += -fno-strict-aliasing .endif .endif +# Turn CTF conversion off by default for now. This default could be +# changed later if DTrace becomes popular. +.if !defined(WITH_CTF) +NO_CTF = 1 +.endif + +# C Type Format data is required for DTrace +CTFFLAGS ?= -L VERSION + +.if !defined(NO_CTF) +CTFCONVERT ?= ctfconvert +CTFMERGE ?= ctfmerge +.if defined(CFLAGS) && (${CFLAGS:M-g} != "") +CTFFLAGS += -g +.else +CFLAGS += -g +.endif +.endif + CXX ?= c++ CXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign} @@ -123,9 +142,15 @@ YFLAGS ?= -d # SINGLE SUFFIX RULES .c: ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .f: ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .sh: cp ${.IMPSRC} ${.TARGET} @@ -135,21 +160,33 @@ YFLAGS ?= -d .c.o: ${CC} ${CFLAGS} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .f.o: ${FC} ${FFLAGS} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .y.o: ${YACC} ${YFLAGS} ${.IMPSRC} ${CC} ${CFLAGS} -c y.tab.c rm -f y.tab.c mv y.tab.o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .l.o: ${LEX} ${LFLAGS} ${.IMPSRC} ${CC} ${CFLAGS} -c lex.yy.c rm -f lex.yy.c mv lex.yy.o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .y.c: ${YACC} ${YFLAGS} ${.IMPSRC} @@ -187,9 +224,15 @@ YFLAGS ?= -d .c: ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .c.o: ${CC} ${CFLAGS} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .cc .cpp .cxx .C: ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} @@ -199,9 +242,15 @@ YFLAGS ?= -d .m.o: ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .p.o: ${PC} ${PFLAGS} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .e .r .F .f: ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \ @@ -212,23 +261,38 @@ YFLAGS ?= -d .S.o: ${CC} ${CFLAGS} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .asm.o: ${CC} -x assembler-with-cpp ${CFLAGS} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .s.o: ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif # XXX not -j safe .y.o: ${YACC} ${YFLAGS} ${.IMPSRC} ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} rm -f y.tab.c +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .l.o: ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} rm -f ${.PREFIX}.tmp.c +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif # XXX not -j safe .y.c: @@ -240,22 +304,34 @@ YFLAGS ?= -d .s.out .c.out .o.out: ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .f.out .F.out .r.out .e.out: ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ ${LDLIBS} -o ${.TARGET} rm -f ${.PREFIX}.o +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif # XXX not -j safe .y.out: ${YACC} ${YFLAGS} ${.IMPSRC} ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} rm -f y.tab.c +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .l.out: ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} rm -f ${.PREFIX}.tmp.c +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif # FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef. __MAKE_CONF?=/etc/make.conf