aboutsummaryrefslogtreecommitdiff
path: root/lib/csu/Makefile.inc
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-07-03 00:09:41 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-07-03 00:09:41 +0000
commitb0ee263dbd3552d5b1776be0efc1c2d105f873b1 (patch)
tree7b37f60204d1adcd1996e72cf89c946591abf94a /lib/csu/Makefile.inc
parent22335c3c63edfea2dfc9aed46da605b1c6ea63ed (diff)
downloadsrc-b0ee263dbd3552d5b1776be0efc1c2d105f873b1.tar.gz
src-b0ee263dbd3552d5b1776be0efc1c2d105f873b1.zip
Consolidate duplicated logic in csu Makefiles to lib/csu/Makefile.inc.
Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25537
Notes
Notes: svn path=/head/; revision=362902
Diffstat (limited to 'lib/csu/Makefile.inc')
-rw-r--r--lib/csu/Makefile.inc37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/csu/Makefile.inc b/lib/csu/Makefile.inc
index 0870e2950706..7d7136e8c1a6 100644
--- a/lib/csu/Makefile.inc
+++ b/lib/csu/Makefile.inc
@@ -8,16 +8,53 @@ NO_WMISSING_VARIABLE_DECLARATIONS=
.if !defined(BUILDING_TESTS)
+OBJS+= Scrt1.o crt1.o gcrt1.o
OBJS+= crtbegin.o crtbeginS.o crtbeginT.o
OBJS+= crtend.o crtendS.o
+OBJS+= crti.o crtn.o
+
+CRT1OBJS+= crtbrand.o ignore_init_note.o
ACFLAGS+= -DLOCORE
CFLAGS+= -fno-asynchronous-unwind-tables
CFLAGS+= -fno-omit-frame-pointer
+CFLAGS+= -I${.CURDIR:H}/common \
+ -I${SRCTOP}/lib/libc/include
CFLAGS_CRTS= -DSHARED ${PICFLAG}
+FILES= ${OBJS}
+FILESMODE= ${LIBMODE}
+FILESOWN= ${LIBOWN}
+FILESGRP= ${LIBGRP}
+FILESDIR= ${LIBDIR}
+# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
+.undef LIBRARIES_ONLY
+
+CLEANFILES+= ${OBJS} ${CRT1OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o
+
+crt1.o: crt1_c.o ${CRT1OBJS}
+ ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
+.if ${MACHINE_ARCH} == "i386"
+ ${OBJCOPY} --localize-symbol _start1 crt1.o
+.endif
+
+gcrt1_c.o: crt1_c.c
+ ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
+
+gcrt1.o: gcrt1_c.o ${CRT1OBJS}
+ ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
+
+Scrt1_c.o: crt1_c.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
+
+Scrt1.o: Scrt1_c.o ${CRT1OBJS}
+ ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
+.if ${MACHINE_ARCH} == "i386"
+ ${OBJCOPY} --localize-symbol _start1 crt1.o
+.endif
+
crtbegin.o: crtbegin.c
crtbeginS.o: crtbegin.c
crtbeginT.o: crtbegin.c