36e2a4216f
When compiling crti.c and crtn.c, add -DCRTI and -DCRTN, respectively.
75 lines
1.6 KiB
Makefile
75 lines
1.6 KiB
Makefile
# $NetBSD: Makefile.inc,v 1.35 2012/08/04 14:59:05 matt Exp $
|
|
|
|
.if !defined(ELFSIZE)
|
|
ELFSIZE=32
|
|
.endif
|
|
|
|
.include "../../Makefile.inc"
|
|
|
|
CPPFLAGS+= -DLIBC_SCCS -DPIC -DDYNAMIC -DELFSIZE=${ELFSIZE}
|
|
CPPFLAGS+= -I${NETBSDSRCDIR}/libexec/ld.elf_so
|
|
CPPFLAGS+= -I${.CURDIR}/../common_elf
|
|
CPPFLAGS+= -I${NETBSDSRCDIR}/lib/libc/dlfcn
|
|
CPPFLAGS+= -DDWARF2_EH
|
|
CPPFLAGS+= -DJCR
|
|
CPPFLAGS+= -DDSO_HANDLE
|
|
|
|
.if defined(HAVE_GCC)
|
|
COPTS+= -fno-unit-at-a-time
|
|
.endif
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
.PATH: ${.CURDIR}/../common_elf
|
|
|
|
SRCS+= crt0.c crti.c crtn.c
|
|
OBJS+= crt0.o gcrt0.o crti.o crtn.o
|
|
.if ${MKPIC} != "no"
|
|
COPTS+= -fPIC
|
|
.endif
|
|
|
|
realall: ${OBJS}
|
|
|
|
crt0.o: crt0.c
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.c} -DCRT0 ${.IMPSRC} -o ${.TARGET}.o
|
|
${LD} -x -r -o ${.TARGET} ${.TARGET}.o
|
|
rm -f ${.TARGET}.o
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
.endif
|
|
|
|
# dependent on crt0.o to pick up header dependencies
|
|
gcrt0.o: ${.CURDIR}/crt0.c crt0.o
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.c} -DMCRT0 ${.CURDIR}/crt0.c -o ${.TARGET}.o
|
|
${LD} -x -r -o ${.TARGET} ${.TARGET}.o
|
|
rm -f ${.TARGET}.o
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
.endif
|
|
|
|
crti.o: crti.c
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.c} -DCRTI ${.IMPSRC} -o ${.TARGET}.o
|
|
${LD} -X -r -o ${.TARGET} ${.TARGET}.o
|
|
rm -f ${.TARGET}.o
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
.endif
|
|
|
|
crtn.o: crtn.c
|
|
${_MKTARGET_COMPILE}
|
|
${COMPILE.c} -DCRTN ${.IMPSRC} -o ${.TARGET}.o
|
|
${LD} -X -r -o ${.TARGET} ${.TARGET}.o
|
|
rm -f ${.TARGET}.o
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
.endif
|
|
|
|
FILES=${OBJS}
|
|
FILESDIR=${LIBDIR}
|
|
CLEANFILES=${OBJS}
|
|
|
|
.include <bsd.prog.mk>
|