svn commit: r324712 - head/share/mk
Jonathan Anderson
jonathan at FreeBSD.org
Wed Oct 18 00:33:22 UTC 2017
Author: jonathan
Date: Wed Oct 18 00:33:20 2017
New Revision: 324712
URL: https://svnweb.freebsd.org/changeset/base/324712
Log:
Improve computation of {BC,LL}OBJS.
Now that OBJS has grown an OBJS_SRCS_FILTER variable, use this variable
in the computation of BCOBJS and LLOBJS too. Also move BCOBJS and LLOBJS
computation to be next to the OBJS computation: this should both make
the parallel structure clearer and serve to remind people changing OBJS
that parallel changes are required in BCOBJS and LLOBJS.
A side effect of this change is that BCOBJS and LLOBJS will be available
even when LLVM_LINK has not been defined, but that seems like a positive
change: there's no reason we can't ask "what bitcode files would you
generate" just because we can't link those files together into a
complete bitcode representation of a binary or library.
Reviewed by: sjg
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12701
Modified:
head/share/mk/bsd.lib.mk
head/share/mk/bsd.prog.mk
Modified: head/share/mk/bsd.lib.mk
==============================================================================
--- head/share/mk/bsd.lib.mk Wed Oct 18 00:30:15 2017 (r324711)
+++ head/share/mk/bsd.lib.mk Wed Oct 18 00:33:20 2017 (r324712)
@@ -169,7 +169,9 @@ LDFLAGS+= -Wl,--version-script=${VERSION_MAP}
.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/}
-CLEANFILES+= ${OBJS} ${STATICOBJS}
+BCOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g}
+LLOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g}
+CLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} ${STATICOBJS}
.endif
.if defined(LIB) && !empty(LIB)
@@ -200,10 +202,6 @@ lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS}
.endif
.if defined(LLVM_LINK)
-BCOBJS= ${OBJS:.o=.bco} ${STATICOBJS:.o=.bco}
-LLOBJS= ${OBJS:.o=.llo} ${STATICOBJS:.o=.llo}
-CLEANFILES+= ${BCOBJS} ${LLOBJS}
-
lib${LIB_PRIVATE}${LIB}.bc: ${BCOBJS}
${LLVM_LINK} -o ${.TARGET} ${BCOBJS}
Modified: head/share/mk/bsd.prog.mk
==============================================================================
--- head/share/mk/bsd.prog.mk Wed Oct 18 00:30:15 2017 (r324711)
+++ head/share/mk/bsd.prog.mk Wed Oct 18 00:33:20 2017 (r324712)
@@ -87,6 +87,10 @@ PROGNAME?= ${PROG}
OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/g}
+# LLVM bitcode / textual IR representations of the program
+BCOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g}
+LLOBJS+=${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g}
+
.if target(beforelinking)
beforelinking: ${OBJS}
${PROG_FULL}: beforelinking
@@ -117,7 +121,10 @@ SRCS= ${PROG}.c
# - the name of the object gets put into the executable symbol table instead of
# the name of a variable temporary object.
# - it's useful to keep objects around for crunching.
-OBJS+= ${PROG}.o
+OBJS+= ${PROG}.o
+BCOBJS+= ${PROG}.bc
+LLOBJS+= ${PROG}.ll
+CLEANFILES+= ${PROG}.o ${PROG}.bc ${PROG}.ll
.if target(beforelinking)
beforelinking: ${OBJS}
@@ -148,10 +155,6 @@ ${PROGNAME}.debug: ${PROG_FULL}
.endif
.if defined(LLVM_LINK)
-# LLVM bitcode / textual IR representations of the program
-BCOBJS= ${OBJS:.o=.bco}
-LLOBJS= ${OBJS:.o=.llo}
-
${PROG_FULL}.bc: ${BCOBJS}
${LLVM_LINK} -o ${.TARGET} ${BCOBJS}
More information about the svn-src-all
mailing list