xref: /freebsd/lib/csu/i386/Makefile (revision f4b37ed0f8b307b1f3f0f630ca725d68f1dff30d)
1# $FreeBSD$
2
3.PATH: ${.CURDIR}/../common
4
5SRCS=		crti.S crtn.S
6OBJS=		${SRCS:N*.h:R:S/$/.o/g}
7OBJS+=		gcrt1.o crt1.o Scrt1.o
8CFLAGS+=	-I${.CURDIR}/../common \
9		-I${.CURDIR}/../../libc/include
10
11all: ${OBJS}
12
13CLEANFILES=	${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
14CLEANFILES+=	crt1_c.s gcrt1_c.s Scrt1_c.s
15
16# See the comment in lib/csu/common/crtbrand.c for the reason crt1_c.c is not
17# directly compiled to .o files.
18
19gcrt1_c.s: crt1_c.c
20	${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
21	sed ${SED_FIX_NOTE} ${.TARGET}
22
23gcrt1_c.o: gcrt1_c.s
24	${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1_c.s
25
26gcrt1.o: gcrt1_c.o crt1_s.o
27	${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o
28
29crt1_c.s: crt1_c.c
30	${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
31	sed ${SED_FIX_NOTE} ${.TARGET}
32
33crt1_c.o: crt1_c.s
34	${CC} ${ACFLAGS} -c -o ${.TARGET} crt1_c.s
35
36crt1.o:	crt1_c.o crt1_s.o
37	${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o
38	${OBJCOPY} --localize-symbol _start1 crt1.o
39
40Scrt1_c.s: crt1_c.c
41	${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
42	sed ${SED_FIX_NOTE} ${.TARGET}
43
44Scrt1_c.o: Scrt1_c.s
45	${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1_c.s
46
47Scrt1.o: Scrt1_c.o crt1_s.o
48	${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o
49	${OBJCOPY} --localize-symbol _start1 Scrt1.o
50
51realinstall:
52	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
53	    ${OBJS} ${DESTDIR}${LIBDIR}
54
55.include <bsd.lib.mk>
56