xref: /freebsd/lib/csu/powerpc64/Makefile (revision 7afb8adff33d47f10a11368ff54bb2eec5b30165)
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
19all: ${OBJS}
20
21CLEANFILES=	${OBJS}
22CLEANFILES+=	crt1.s gcrt1.s Scrt1.s
23
24# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not
25# directly compiled to .o files.
26
27crt1.s: crt1.c
28	${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
29	sed ${SED_FIX_NOTE} ${.TARGET}
30
31crt1.o: crt1.s
32	${CC} ${ACFLAGS} -c -o ${.TARGET} crt1.s
33
34gcrt1.s: crt1.c
35	${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c
36	sed ${SED_FIX_NOTE} ${.TARGET}
37
38gcrt1.o: gcrt1.s
39	${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s
40
41Scrt1.s: crt1.c
42	${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c
43	sed ${SED_FIX_NOTE} ${.TARGET}
44
45Scrt1.o: Scrt1.s
46	${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s
47
48realinstall:
49	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
50	    ${OBJS} ${DESTDIR}${LIBDIR}
51
52.include <bsd.lib.mk>
53