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