xref: /freebsd/lib/csu/Makefile.inc (revision 43e29d03f416d7dda52112a29600a7c82ee1a91e)
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+=	-DSTRIP_FBSDID
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
37CRT1SRC?=	crt1_c.c
38CRT1OBJ?=
39
40CLEANFILES+=	${OBJS} ${CRT1OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o
41CLEANFILES+=	crti_s.o ${CRT1SRC:C/.[S|c]$/.o/}
42
43crt1.o:	${CRT1SRC:C/.[S|c]$/.o/} ${CRT1OBJS} ${CRT1OBJ}
44	${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
45.if ${MACHINE_ARCH} == "i386"
46	${OBJCOPY} --localize-symbol _start1 ${.TARGET}
47.endif
48
49gcrt1_c.o: ${CRT1SRC}
50	${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/${CRT1SRC}
51
52gcrt1.o: gcrt1_c.o ${CRT1OBJS} ${CRT1OBJ}
53	${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
54
55Scrt1_c.o: ${CRT1SRC}
56	${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/${CRT1SRC}
57
58Scrt1.o: Scrt1_c.o ${CRT1OBJS} ${CRT1OBJ}
59	${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
60.if ${MACHINE_ARCH} == "i386"
61	${OBJCOPY} --localize-symbol _start1 ${.TARGET}
62.endif
63
64crtbegin.o: crtbegin.c
65crtbeginS.o: crtbegin.c
66crtbeginT.o: crtbegin.c
67crtend.o: crtend.c
68crtendS.o: crtend.c
69
70crtbegin.o crtend.o crtbeginT.o:
71	${CC} ${CFLAGS} -I${.CURDIR} -c -o ${.TARGET} ${.ALLSRC:N*.h:[1]}
72
73crtbeginS.o crtendS.o:
74	${CC} ${CFLAGS} -I${.CURDIR} ${CFLAGS_CRTS} -c -o ${.TARGET} \
75	    ${.ALLSRC:N*.h:[1]}
76
77crti_s.o: crti.S
78	${CC} ${CFLAGS} ${ACFLAGS} -c ${.ALLSRC:M*.S} -o ${.TARGET}
79
80crti.o: crti_s.o crtbrand.o
81	${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
82
83.endif
84
85.include "../Makefile.inc"
86