xref: /freebsd/lib/csu/riscv/Makefile (revision 3416500aef140042c64bc149cb1ec6620483bc44)
1# $FreeBSD$
2
3.PATH: ${.CURDIR:H}/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:H}/common \
9		-I${SRCTOP}/lib/libc/include
10
11FILES=		${OBJS}
12FILESMODE=	${LIBMODE}
13FILESOWN=	${LIBOWN}
14FILESGRP=	${LIBGRP}
15FILESDIR=	${LIBDIR}
16# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
17.undef LIBRARIES_ONLY
18
19CLEANFILES=	${OBJS}
20CLEANFILES+=	crt1.s gcrt1.s Scrt1.s
21
22# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not
23# directly compiled to .o files.
24
25crt1.s: crt1.c
26	${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
27	sed ${SED_FIX_NOTE} ${.TARGET}
28
29crt1.o: crt1.s
30	${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1.s
31
32gcrt1.s: crt1.c
33	${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c
34	sed ${SED_FIX_NOTE} ${.TARGET}
35
36gcrt1.o: gcrt1.s
37	${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s
38
39Scrt1.s: crt1.c
40	${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c
41	sed ${SED_FIX_NOTE} ${.TARGET}
42
43Scrt1.o: Scrt1.s
44	${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s
45
46.include <bsd.lib.mk>
47