1 # $NetBSD: Makefile.inc,v 1.7 2012/03/25 06:55:19 joerg Exp $
5 COMMON_DIR:= ${.CURDIR}/common
8 CPPFLAGS+= -I${NETBSDSRCDIR}/libexec/ld.elf_so -I${COMMON_DIR} -I.
10 OBJS+= crt0.o gcrt0.o crti.o crtn.o
11 OBJS+= crtbegin.o crtbeginS.o crtend.o
13 # BJG - for backwards compatability with minix gcc
14 # which links with crt1.o instead of crt0.o
15 SYMLINKS+= crt0.o ${LIBDIR}/crt1.o
19 crtbegin.o: crtbegin.S
21 ${COMPILE.S} ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
22 ${LD} -x -r -o ${.TARGET} ${.TARGET}.o
24 .if ${MKSTRIPIDENT} != "no"
25 ${OBJCOPY} -R .ident ${.TARGET}
28 crtbeginS.o: crtbegin.S
30 ${COMPILE.S} -DPIC -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
31 ${LD} -x -r -o ${.TARGET} ${.TARGET}.o
33 .if ${MKSTRIPIDENT} != "no"
34 ${OBJCOPY} -R .ident ${.TARGET}
39 ${COMPILE.S} ${ARCHDIR}/crtend.S -o ${.TARGET}.o
40 ${LD} -x -r -o ${.TARGET} ${.TARGET}.o
42 .if ${MKSTRIPIDENT} != "no"
43 ${OBJCOPY} -R .ident ${.TARGET}
52 crt0.o: crt0.S crt0-common.c
54 ${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
55 ${COMPILE.c} ${PICFLAGS} ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
56 ${LD} -x -r -o ${.TARGET} ${.TARGET}.S.o ${.TARGET}.c.o
57 rm -f ${.TARGET}.S.o ${.TARGET}.c.o
58 .if ${MKSTRIPIDENT} != "no"
59 ${OBJCOPY} -R .ident ${.TARGET}
62 gcrt0.o: crt0.S crt0-common.c
64 ${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
65 ${COMPILE.c} ${PICFLAGS} -DMCRT0 ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
66 ${LD} -x -r -o ${.TARGET} ${.TARGET}.S.o ${.TARGET}.c.o
67 rm -f ${.TARGET}.S.o ${.TARGET}.c.o
68 .if ${MKSTRIPIDENT} != "no"
69 ${OBJCOPY} -R .ident ${.TARGET}
72 sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
74 cat ${COMMON_DIR}/sysident_assym.cf | \
75 ${TOOL_GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
76 > sysident_assym.h.tmp && \
77 mv -f sysident_assym.h.tmp sysident_assym.h
79 CLEANFILES+= sysident_assym.h
81 crti.o: crti.S sysident_assym.h
87 SYMLINKS+= crtbegin.o ${LIBDIR}/crtbeginT.o
88 SYMLINKS+= crtend.o ${LIBDIR}/crtendS.o
90 .include <bsd.prog.mk>