1# $FreeBSD$
2
3.PATH: ${.CURDIR}/../common
4
5SRCS=		crti.S crtn.S
6OBJS=		${SRCS:N*.h:R:S/$/.o/g}
7OBJS+=		crt1.o gcrt1.o Scrt1.o
8
9all: ${OBJS}
10
11CLEANFILES=	${OBJS}
12CLEANFILES+=	crt1_.o gcrt1_.o Scrt1_.o
13CLEANFILES+=	crtbrand.o gcrtbrand.o Scrtbrand.o
14CLEANFILES+=	crtbrand.s gcrtbrand.s Scrtbrand.s
15
16crt1_.o: crt1.S
17	${CC} ${CFLAGS} -c -o ${.TARGET} ${.ALLSRC}
18
19# See the comment in lib/csu/common/crtbrand.c for the reason crtbrand.c is not
20# directly compiled to .o files.
21
22crtbrand.s: crtbrand.c
23	${CC} ${CFLAGS} -S -o ${.TARGET} ${.ALLSRC}
24	sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
25
26crtbrand.o: crtbrand.s
27	${CC} ${ACFLAGS} -c -o ${.TARGET} crtbrand.s
28
29crt1.o: crt1_.o crtbrand.o
30	${LD} ${LDFLAGS} -r -o ${.TARGET} crt1_.o crtbrand.o
31
32gcrt1_.o: crt1.S
33	${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.ALLSRC}
34
35gcrtbrand.s: crtbrand.c
36	${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.ALLSRC}
37	sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
38
39gcrtbrand.o: gcrtbrand.s
40	${CC} ${ACFLAGS} -c -o ${.TARGET} gcrtbrand.s
41
42gcrt1.o: gcrt1_.o gcrtbrand.o
43	${LD} ${LDFLAGS} -r -o ${.TARGET} ${.ALLSRC}
44
45Scrt1_.o: crt1.S
46	${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.ALLSRC}
47
48Scrtbrand.s: crtbrand.c
49	${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.ALLSRC}
50	sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
51
52Scrtbrand.o: Scrtbrand.s
53	${CC} ${ACFLAGS} -c -o ${.TARGET} Scrtbrand.s
54
55Scrt1.o: Scrt1_.o Scrtbrand.o
56	${LD} ${LDFLAGS} -r -o ${.TARGET} ${.ALLSRC}
57
58realinstall:
59	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
60	    ${OBJS} ${DESTDIR}${LIBDIR}
61
62.include <bsd.lib.mk>
63