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