opendir change: refinement
[minix.git] / lib / csu / common / Makefile.inc
blobc635479c6772454a31d5bfa9b7db8fd562bc573b
1 #       $NetBSD: Makefile.inc,v 1.7 2012/03/25 06:55:19 joerg Exp $
3 .include <bsd.own.mk>
5 COMMON_DIR:=    ${.CURDIR}/common
6 .PATH:          ${COMMON_DIR}
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
17 realall: ${OBJS}
19 crtbegin.o: crtbegin.S
20         ${_MKTARGET_COMPILE}
21         ${COMPILE.S} ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
22         ${LD} -x -r -o ${.TARGET} ${.TARGET}.o
23         rm -f ${.TARGET}.o
24 .if ${MKSTRIPIDENT} != "no"
25         ${OBJCOPY} -R .ident ${.TARGET}
26 .endif
28 crtbeginS.o: crtbegin.S
29         ${_MKTARGET_COMPILE}
30         ${COMPILE.S} -DPIC -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
31         ${LD} -x -r -o ${.TARGET} ${.TARGET}.o
32         rm -f ${.TARGET}.o
33 .if ${MKSTRIPIDENT} != "no"
34         ${OBJCOPY} -R .ident ${.TARGET}
35 .endif
37 crtend.o: crtend.S
38         ${_MKTARGET_COMPILE}
39         ${COMPILE.S} ${ARCHDIR}/crtend.S -o ${.TARGET}.o
40         ${LD} -x -r -o ${.TARGET} ${.TARGET}.o
41         rm -f ${.TARGET}.o
42 .if ${MKSTRIPIDENT} != "no"
43         ${OBJCOPY} -R .ident ${.TARGET}
44 .endif
46 .if ${MKPIC} != "no"
47 PICFLAGS=       -fPIC
48 .else
49 PICFLAGS=
50 .endif
52 crt0.o: crt0.S crt0-common.c
53         ${_MKTARGET_COMPILE}
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}
60 .endif
62 gcrt0.o: crt0.S crt0-common.c
63         ${_MKTARGET_COMPILE}
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}
70 .endif
72 sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
73         ${_MKTARGET_CREATE}
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
82 crtn.o: crtn.S
84 FILES=${OBJS}
85 FILESDIR=${LIBDIR}
86 CLEANFILES+=${OBJS}
87 SYMLINKS+=      crtbegin.o ${LIBDIR}/crtbeginT.o
88 SYMLINKS+=      crtend.o ${LIBDIR}/crtendS.o
90 .include <bsd.prog.mk>