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