1 # $NetBSD: Makefile.inc,v 1.25 2014/03/04 17:57:56 joerg Exp $
5 # XXX: FIXME: This is defined in bsd.lib.mk
8 COMMON_DIR:= ${.CURDIR}/common
11 CPPFLAGS+= -I${NETBSDSRCDIR}/libexec/ld.elf_so -I${COMMON_DIR} -I.
13 OBJS+= crt0.o gcrt0.o crti.o crtn.o
14 OBJS+= crtbegin.o crtend.o
18 CFLAGS.crtbegin.c+= -fPIE
20 .if ${MACHINE_ARCH} == "alpha"
24 .if ${CSU_MACHINE_ARCH} == "sparc64"
25 # create helper objects for the compiler to mark compiler memory models
26 .for m in medlow medmid medany
27 sparc_mc${m}.o: compident.S sysident_assym.h
28 ${CC} ${ASFLAGS} -I. -DCONTENT=\"${m}\\0\\0\" -DCONTENTLENGTH=8 -c \
29 -o $@ ${COMMON_DIR}/compident.S
31 OBJS += sparc_mcmedlow.o sparc_mcmedmid.o sparc_mcmedany.o
36 .if exists(${ARCHDIR}/crtbegin.S)
37 crtbegin.o: crtbegin.S
39 ${COMPILE.S} ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
41 crtbegin.o: crtbegin.c crtbegin.h
43 ${COMPILE.c} ${CFLAGS.crtbegin.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
45 ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET}
47 .if ${MKSTRIPIDENT} != "no"
48 ${OBJCOPY} -R .ident ${.TARGET}
51 .if exists(${ARCHDIR}/crtbegin.S)
52 crtbeginS.o: crtbegin.S
54 ${COMPILE.S} ${PICFLAGS} -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
56 crtbeginS.o: crtbegin.c crtbegin.h
58 ${COMPILE.c} ${PICFLAGS} -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
60 ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET}
62 .if ${MKSTRIPIDENT} != "no"
63 ${OBJCOPY} -R .ident ${.TARGET}
68 ${COMPILE.S} ${ARCHDIR}/crtend.S -o ${.TARGET}.o
69 ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET}
71 .if ${MKSTRIPIDENT} != "no"
72 ${OBJCOPY} -R .ident ${.TARGET}
76 MY_PICFLAGS= ${PICFLAGS}
81 crt0.o: crt0.S crt0-common.c
83 ${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
84 ${COMPILE.c} ${MY_PICFLAGS} ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
85 ${LD} -r -o ${.TARGET}.o ${.TARGET}.S.o ${.TARGET}.c.o
86 ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET}
87 rm -f ${.TARGET}.S.o ${.TARGET}.c.o ${.TARGET}.o
88 .if ${MKSTRIPIDENT} != "no"
89 ${OBJCOPY} -R .ident ${.TARGET}
92 gcrt0.o: crt0.S crt0-common.c
94 ${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
95 ${COMPILE.c} ${MY_PICFLAGS} -DMCRT0 ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
96 ${LD} -r -o ${.TARGET}.o ${.TARGET}.S.o ${.TARGET}.c.o
97 ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET}
98 rm -f ${.TARGET}.S.o ${.TARGET}.c.o ${.TARGET}.o
99 .if ${MKSTRIPIDENT} != "no"
100 ${OBJCOPY} -R .ident ${.TARGET}
103 .if ${MACHINE_ARCH} == "alpha"
104 # can't do this in Makefile.inc otherwise it will before realall:
107 ${COMPILE.c} ${.ALLSRC} -o ${.TARGET}.o
108 ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET}
112 GENASSYM_CONF= ${COMMON_DIR}/sysident_assym.cf
113 sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} ${NETBSDSRCDIR}/sys/sys/param.h
115 cat ${COMMON_DIR}/sysident_assym.cf | \
116 ${TOOL_GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
117 ${GENASSYM_CPPFLAGS} > sysident_assym.h.tmp && \
118 mv -f sysident_assym.h.tmp sysident_assym.h
120 CLEANFILES+= sysident_assym.h
122 crti.o: crti.S sysident_assym.h sysident.S
129 .if ${MKPIC} == "yes"
130 SYMLINKS+= crtbegin.o ${LIBDIR}/crtbeginT.o
131 SYMLINKS+= crtend.o ${LIBDIR}/crtendS.o
134 .include <bsd.prog.mk>