xref: /freebsd/lib/csu/powerpc64/Makefile (revision 5ca34122ecdd5abc62bdae39663fec9ac8523d87)
1# $FreeBSD$
2
3.PATH: ${.CURDIR}/../common
4
5SRCS=		crt1.c crti.S crtn.S
6OBJS=		${SRCS:N*.h:R:S/$/.o/g}
7OBJS+=		Scrt1.o gcrt1.o
8CFLAGS+=	-I${.CURDIR}/../common \
9		-I${.CURDIR}/../../libc/include \
10		-mlongcall
11
12# XXX: See the log for r232932 as to why the above -mlongcall is needed.  Since
13# clang doesn't support -mlongcall, and testing shows a clang linked with a
14# clang-built csu segfaults, this must currently be compiled with gcc.  Once
15# clang supports -mlongcall, or we get a fixed ld, this can be revisited.
16CC:=		gcc
17COMPILER_TYPE:=	gcc
18
19FILES=		${OBJS}
20FILESMODE=	${LIBMODE}
21FILESOWN=	${LIBOWN}
22FILESGRP=	${LIBGRP}
23FILESDIR=	${LIBDIR}
24
25CLEANFILES=	${OBJS}
26CLEANFILES+=	crt1.s gcrt1.s Scrt1.s
27
28# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not
29# directly compiled to .o files.
30
31crt1.s: crt1.c
32	${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
33	sed ${SED_FIX_NOTE} ${.TARGET}
34
35crt1.o: crt1.s
36	${CC} ${ACFLAGS} -c -o ${.TARGET} crt1.s
37
38gcrt1.s: crt1.c
39	${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c
40	sed ${SED_FIX_NOTE} ${.TARGET}
41
42gcrt1.o: gcrt1.s
43	${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s
44
45Scrt1.s: crt1.c
46	${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c
47	sed ${SED_FIX_NOTE} ${.TARGET}
48
49Scrt1.o: Scrt1.s
50	${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s
51
52.include <bsd.lib.mk>
53