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