Changeset View
Changeset View
Standalone View
Standalone View
share/mk/bsd.prog.mk
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
.if defined(PROG) | .if defined(PROG) | ||||
PROGNAME?= ${PROG} | PROGNAME?= ${PROG} | ||||
.if defined(SRCS) | .if defined(SRCS) | ||||
OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/g} | 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) | .if target(beforelinking) | ||||
beforelinking: ${OBJS} | beforelinking: ${OBJS} | ||||
${PROG_FULL}: beforelinking | ${PROG_FULL}: beforelinking | ||||
.endif | .endif | ||||
${PROG_FULL}: ${OBJS} | ${PROG_FULL}: ${OBJS} | ||||
.if defined(PROG_CXX) | .if defined(PROG_CXX) | ||||
${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ | ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ | ||||
${OBJS} ${LDADD} | ${OBJS} ${LDADD} | ||||
Show All 14 Lines | |||||
SRCS= ${PROG}.c | SRCS= ${PROG}.c | ||||
.endif | .endif | ||||
# Always make an intermediate object file because: | # Always make an intermediate object file because: | ||||
# - it saves time rebuilding when only the library has changed | # - it saves time rebuilding when only the library has changed | ||||
# - the name of the object gets put into the executable symbol table instead of | # - the name of the object gets put into the executable symbol table instead of | ||||
# the name of a variable temporary object. | # the name of a variable temporary object. | ||||
# - it's useful to keep objects around for crunching. | # - 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) | .if target(beforelinking) | ||||
beforelinking: ${OBJS} | beforelinking: ${OBJS} | ||||
${PROG_FULL}: beforelinking | ${PROG_FULL}: beforelinking | ||||
.endif | .endif | ||||
${PROG_FULL}: ${OBJS} | ${PROG_FULL}: ${OBJS} | ||||
.if defined(PROG_CXX) | .if defined(PROG_CXX) | ||||
${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ | ${CXX:N${CCACHE_BIN}} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} \ | ||||
Show All 14 Lines | ${PROG}: ${PROG_FULL} ${PROGNAME}.debug | ||||
${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \ | ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \ | ||||
${PROG_FULL} ${.TARGET} | ${PROG_FULL} ${.TARGET} | ||||
${PROGNAME}.debug: ${PROG_FULL} | ${PROGNAME}.debug: ${PROG_FULL} | ||||
${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET} | ${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET} | ||||
.endif | .endif | ||||
.if defined(LLVM_LINK) | .if defined(LLVM_LINK) | ||||
# LLVM bitcode / textual IR representations of the program | |||||
BCOBJS= ${OBJS:.o=.bco} | |||||
LLOBJS= ${OBJS:.o=.llo} | |||||
${PROG_FULL}.bc: ${BCOBJS} | ${PROG_FULL}.bc: ${BCOBJS} | ||||
${LLVM_LINK} -o ${.TARGET} ${BCOBJS} | ${LLVM_LINK} -o ${.TARGET} ${BCOBJS} | ||||
${PROG_FULL}.ll: ${LLOBJS} | ${PROG_FULL}.ll: ${LLOBJS} | ||||
${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} | ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} | ||||
.endif # defined(LLVM_LINK) | .endif # defined(LLVM_LINK) | ||||
▲ Show 20 Lines • Show All 156 Lines • Show Last 20 Lines |