99 lines
2.5 KiB
Makefile
99 lines
2.5 KiB
Makefile
# $NetBSD: Makefile.inc,v 1.9 2013/06/22 02:37:09 matt Exp $
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
COMMON_DIR:= ${.CURDIR}/common
|
|
.PATH: ${COMMON_DIR}
|
|
|
|
CPPFLAGS+= -I${NETBSDSRCDIR}/libexec/ld.elf_so -I${COMMON_DIR} -I.
|
|
|
|
OBJS+= crt0.o gcrt0.o crti.o crtn.o
|
|
OBJS+= crtbegin.o crtbeginS.o crtend.o
|
|
|
|
realall: ${OBJS}
|
|
|
|
.if !exists(${ARCHDIR}/crtbegin.S)
|
|
crtbegin.o: crtbegin.c
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
|
|
.else
|
|
crtbegin.o: crtbegin.S
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.S} ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
|
|
.endif
|
|
${LD} -x -r -o ${.TARGET} ${.TARGET}.o
|
|
rm -f ${.TARGET}.o
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
.endif
|
|
|
|
.if !exists(${ARCHDIR}/crtbegin.S)
|
|
crtbeginS.o: crtbegin.c
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.c} -DPIC -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
|
|
.else
|
|
crtbeginS.o: crtbegin.S
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.S} -DPIC -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
|
|
.endif
|
|
${LD} -x -r -o ${.TARGET} ${.TARGET}.o
|
|
rm -f ${.TARGET}.o
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
.endif
|
|
|
|
crtend.o: crtend.S
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.S} ${ARCHDIR}/crtend.S -o ${.TARGET}.o
|
|
${LD} -x -r -o ${.TARGET} ${.TARGET}.o
|
|
rm -f ${.TARGET}.o
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
.endif
|
|
|
|
.if ${MKPIC} != "no"
|
|
PICFLAGS= -fPIC
|
|
.else
|
|
PICFLAGS=
|
|
.endif
|
|
|
|
crt0.o: crt0.S crt0-common.c
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
|
|
${COMPILE.c} ${PICFLAGS} ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
|
|
${LD} -x -r -o ${.TARGET} ${.TARGET}.S.o ${.TARGET}.c.o
|
|
rm -f ${.TARGET}.S.o ${.TARGET}.c.o
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
.endif
|
|
|
|
gcrt0.o: crt0.S crt0-common.c
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
|
|
${COMPILE.c} ${PICFLAGS} -DMCRT0 ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
|
|
${LD} -x -r -o ${.TARGET} ${.TARGET}.S.o ${.TARGET}.c.o
|
|
rm -f ${.TARGET}.S.o ${.TARGET}.c.o
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
.endif
|
|
|
|
sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
|
|
${_MKTARGET_CREATE}
|
|
cat ${COMMON_DIR}/sysident_assym.cf | \
|
|
${TOOL_GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
|
|
> sysident_assym.h.tmp && \
|
|
mv -f sysident_assym.h.tmp sysident_assym.h
|
|
|
|
CLEANFILES+= sysident_assym.h
|
|
|
|
crti.o: crti.S sysident_assym.h
|
|
crtn.o: crtn.S
|
|
|
|
FILES=${OBJS}
|
|
FILESDIR=${LIBDIR}
|
|
CLEANFILES+=${OBJS}
|
|
SYMLINKS+= crtbegin.o ${LIBDIR}/crtbeginT.o
|
|
SYMLINKS+= crtend.o ${LIBDIR}/crtendS.o
|
|
|
|
.include <bsd.prog.mk>
|