summaryrefslogtreecommitdiffstats
path: root/lib/csu/i386-elf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csu/i386-elf/Makefile')
-rw-r--r--lib/csu/i386-elf/Makefile24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/csu/i386-elf/Makefile b/lib/csu/i386-elf/Makefile
index 8598ce8..c2af118 100644
--- a/lib/csu/i386-elf/Makefile
+++ b/lib/csu/i386-elf/Makefile
@@ -2,8 +2,8 @@
.PATH: ${.CURDIR}/../common
-SRCS= crt1.c crti.S crtn.S
-FILES= ${SRCS:N*.h:R:S/$/.o/g} gcrt1.o
+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}
@@ -11,9 +11,23 @@ FILESDIR= ${LIBDIR}
WARNS?= 6
CFLAGS+= -I${.CURDIR}/../common \
-I${.CURDIR}/../../libc/include
-CLEANFILES= ${FILES}
+CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
-gcrt1.o: crt1.c
- ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c
+gcrt1_c.o: crt1_c.c
+ ${CC} ${CFLAGS} -DGCRT -c -o gcrt1_c.o ${.CURDIR}/crt1_c.c
+
+gcrt1.o: gcrt1_c.o crt1_s.o
+ ${LD} ${LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o
+
+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.o: crt1_c.c
+ ${CC} ${CFLAGS} -DGCRT -fPIC -DPIC -c -o Scrt1_c.o ${.CURDIR}/crt1_c.c
+
+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