]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/csu/i386/Makefile
MFV: r361597
[FreeBSD/FreeBSD.git] / lib / csu / i386 / Makefile
1 # $FreeBSD$
2
3 .PATH: ${.CURDIR:H}/common
4
5 SRCS=           crti.S crtn.S
6 OBJS=           ${SRCS:N*.h:R:S/$/.o/g}
7 OBJS+=          gcrt1.o crt1.o Scrt1.o
8 CFLAGS+=        -I${.CURDIR} -I${.CURDIR:H}/common \
9                 -I${SRCTOP}/lib/libc/include
10 CFLAGS+=        -DCRT_IRELOC_REL
11
12 FILES=          ${OBJS}
13 FILESMODE=      ${LIBMODE}
14 FILESOWN=       ${LIBOWN}
15 FILESGRP=       ${LIBGRP}
16 FILESDIR=       ${LIBDIR}
17 # These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
18 .undef LIBRARIES_ONLY
19
20 CLEANFILES=     ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
21 CLEANFILES+=    crt1_c.s gcrt1_c.s Scrt1_c.s
22
23 # See the comment in lib/csu/common/crtbrand.c for the reason crt1_c.c is not
24 # directly compiled to .o files.
25
26 gcrt1_c.s: crt1_c.c
27         ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
28         sed ${SED_FIX_NOTE} ${.TARGET}
29
30 gcrt1_c.o: gcrt1_c.s
31         ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} gcrt1_c.s
32
33 gcrt1.o: gcrt1_c.o crt1_s.o
34         ${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o
35
36 crt1_c.s: crt1_c.c
37         ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
38         sed ${SED_FIX_NOTE} ${.TARGET}
39
40 crt1_c.o: crt1_c.s
41         ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1_c.s
42
43 crt1.o: crt1_c.o crt1_s.o
44         ${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o
45         ${OBJCOPY} --localize-symbol _start1 crt1.o
46
47 Scrt1_c.s: crt1_c.c
48         ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
49         sed ${SED_FIX_NOTE} ${.TARGET}
50
51 Scrt1_c.o: Scrt1_c.s
52         ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} Scrt1_c.s
53
54 Scrt1.o: Scrt1_c.o crt1_s.o
55         ${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o
56         ${OBJCOPY} --localize-symbol _start1 Scrt1.o
57
58 .include <bsd.lib.mk>