1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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
This commit is contained in:
Jonathan Anderson 2017-10-18 00:33:20 +00:00
parent 6f6b66a827
commit 4f2fac3759
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324712
2 changed files with 11 additions and 10 deletions

View File

@ -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}

View File

@ -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}