summaryrefslogtreecommitdiffstats
path: root/lib/csu/i386-elf/Makefile
blob: 39d1a674ea86a67405a475e478e4105f67c27446 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# $FreeBSD$

.PATH: ${.CURDIR:H}/common

SRCS=		crti.S crtn.S
FILES=		${SRCS:N*.h:R:S/$/.o/g} gcrt1.o crt1.o Scrt1.o
FILESOWN=	${LIBOWN}
FILESGRP=	${LIBGRP}
FILESMODE=	${LIBMODE}
FILESDIR=	${LIBDIR}
CFLAGS+=	-I${.CURDIR:H}/common \
		-I${SRCTOP}/libc/include
CLEANFILES=	${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
CLEANFILES+=	crt1_c.s gcrt1_c.s Scrt1_c.s

# See the comment in lib/csu/common/crtbrand.c for the reason crt1_c.c is not
# directly compiled to .o files.

gcrt1_c.s: crt1_c.c
	${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
	sed ${SED_FIX_NOTE} ${.TARGET}

gcrt1_c.o: gcrt1_c.s
	${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1_c.s

gcrt1.o: gcrt1_c.o crt1_s.o
	${LD} ${LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o

crt1_c.s: crt1_c.c
	${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
	sed ${SED_FIX_NOTE} ${.TARGET}

crt1_c.o: crt1_c.s
	${CC} ${ACFLAGS} -c -o ${.TARGET} crt1_c.s

crt1.o:	crt1_c.o crt1_s.o
	${LD} ${LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o
	${OBJCOPY} --localize-symbol _start1 crt1.o

Scrt1_c.s: crt1_c.c
	${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
	sed ${SED_FIX_NOTE} ${.TARGET}

Scrt1_c.o: Scrt1_c.s
	${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1_c.s

Scrt1.o: Scrt1_c.o crt1_s.o
	${LD} ${LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o
	${OBJCOPY} --localize-symbol _start1 Scrt1.o

.include <bsd.prog.mk>
OpenPOWER on IntegriCloud