xref: /freebsd/lib/csu/Makefile.inc (revision cab6a39d7b343596a5823e65c0f7b426551ec22d)
1# $FreeBSD$
2
3NO_WMISSING_VARIABLE_DECLARATIONS=
4# Can't instrument these files since that breaks non-sanitized programs.
5MK_ASAN:=	no
6MK_UBSAN:=	no
7
8.include <src.opts.mk>
9MK_SSP=	no
10
11.if !defined(BUILDING_TESTS)
12
13OBJS+=	Scrt1.o crt1.o gcrt1.o
14OBJS+=	crtbegin.o crtbeginS.o crtbeginT.o
15OBJS+=	crtend.o crtendS.o
16OBJS+=	crti.o crtn.o
17
18CRT1OBJS+=	crtbrand.o feature_note.o ignore_init_note.o
19
20ACFLAGS+=	-DLOCORE
21
22CFLAGS+=	-fno-asynchronous-unwind-tables
23CFLAGS+=	-fno-omit-frame-pointer
24CFLAGS+=	-I${.CURDIR:H}/common \
25		-I${SRCTOP}/lib/libc/include
26
27CFLAGS_CRTS=	-DSHARED ${PICFLAG}
28
29FILES=		${OBJS}
30FILESMODE=	${LIBMODE}
31FILESOWN=	${LIBOWN}
32FILESGRP=	${LIBGRP}
33FILESDIR=	${LIBDIR}
34# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
35.undef LIBRARIES_ONLY
36
37CLEANFILES+=	${OBJS} ${CRT1OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o
38CLEANFILES+=	crti_s.o
39
40crt1.o:	crt1_c.o ${CRT1OBJS}
41	${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
42.if ${MACHINE_ARCH} == "i386"
43	${OBJCOPY} --localize-symbol _start1 ${.TARGET}
44.endif
45
46gcrt1_c.o: crt1_c.c
47	${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
48
49gcrt1.o: gcrt1_c.o ${CRT1OBJS}
50	${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
51
52Scrt1_c.o: crt1_c.c
53	${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
54
55Scrt1.o: Scrt1_c.o ${CRT1OBJS}
56	${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
57.if ${MACHINE_ARCH} == "i386"
58	${OBJCOPY} --localize-symbol _start1 ${.TARGET}
59.endif
60
61crtbegin.o: crtbegin.c
62crtbeginS.o: crtbegin.c
63crtbeginT.o: crtbegin.c
64crtend.o: crtend.c
65crtendS.o: crtend.c
66
67crtbegin.o crtend.o crtbeginT.o:
68	${CC} ${CFLAGS} -I${.CURDIR} -c -o ${.TARGET} ${.ALLSRC:N*.h:[1]}
69
70crtbeginS.o crtendS.o:
71	${CC} ${CFLAGS} -I${.CURDIR} ${CFLAGS_CRTS} -c -o ${.TARGET} \
72	    ${.ALLSRC:N*.h:[1]}
73
74crti_s.o: crti.S
75	${CC} ${CFLAGS} ${ACFLAGS} -c ${.ALLSRC:M*.S} -o ${.TARGET}
76
77crti.o: crti_s.o crtbrand.o
78	${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
79
80.endif
81
82.include "../Makefile.inc"
83