Consolidate duplicated logic in csu Makefiles to lib/csu/Makefile.inc.

Reviewed by:	kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D25537
This commit is contained in:
jhb 2020-07-03 00:09:41 +00:00
parent acce56ba62
commit 8df806d34d
9 changed files with 46 additions and 248 deletions

View File

@ -8,16 +8,53 @@ NO_WMISSING_VARIABLE_DECLARATIONS=
.if !defined(BUILDING_TESTS) .if !defined(BUILDING_TESTS)
OBJS+= Scrt1.o crt1.o gcrt1.o
OBJS+= crtbegin.o crtbeginS.o crtbeginT.o OBJS+= crtbegin.o crtbeginS.o crtbeginT.o
OBJS+= crtend.o crtendS.o OBJS+= crtend.o crtendS.o
OBJS+= crti.o crtn.o
CRT1OBJS+= crtbrand.o ignore_init_note.o
ACFLAGS+= -DLOCORE ACFLAGS+= -DLOCORE
CFLAGS+= -fno-asynchronous-unwind-tables CFLAGS+= -fno-asynchronous-unwind-tables
CFLAGS+= -fno-omit-frame-pointer CFLAGS+= -fno-omit-frame-pointer
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS_CRTS= -DSHARED ${PICFLAG} 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 crtbegin.o: crtbegin.c
crtbeginS.o: crtbegin.c crtbeginS.o: crtbegin.c
crtbeginT.o: crtbegin.c crtbeginT.o: crtbegin.c

View File

@ -2,37 +2,8 @@
.PATH: ${.CURDIR:H}/common .PATH: ${.CURDIR:H}/common
SRCS= crti.S crtn.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= Scrt1.o crt1.o gcrt1.o
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS CFLAGS+= -DCRT_IRELOC_SUPPRESS
FILES= ${OBJS} CRT1OBJS+= crt1_s.o
FILESMODE= ${LIBMODE}
FILESOWN= ${LIBOWN}
FILESGRP= ${LIBGRP}
FILESDIR= ${LIBDIR}
# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
.undef LIBRARIES_ONLY
CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crtbrand.o ignore_init_note.o
gcrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
${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 crt1_s.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
.include <bsd.lib.mk> .include <bsd.lib.mk>

View File

@ -2,37 +2,7 @@
.PATH: ${.CURDIR:H}/common .PATH: ${.CURDIR:H}/common
SRCS= crti.S crtn.S CFLAGS+= -I${.CURDIR}
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= Scrt1.o crt1.o gcrt1.o
CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS+= -fno-omit-frame-pointer -DCRT_IRELOC_RELA CFLAGS+= -fno-omit-frame-pointer -DCRT_IRELOC_RELA
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} crt1_c.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crtbrand.o ignore_init_note.o
gcrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o
crt1.o: crt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o
Scrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o
.include <bsd.lib.mk> .include <bsd.lib.mk>

View File

@ -2,40 +2,8 @@
.PATH: ${.CURDIR:H}/common .PATH: ${.CURDIR:H}/common
SRCS= crti.S crtn.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= Scrt1.o crt1.o gcrt1.o
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS CFLAGS+= -DCRT_IRELOC_SUPPRESS
FILES= ${OBJS} CRT1OBJS+= crt1_s.o
FILESMODE= ${LIBMODE}
FILESOWN= ${LIBOWN}
FILESGRP= ${LIBGRP}
FILESDIR= ${LIBDIR}
# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
.undef LIBRARIES_ONLY
CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crtbrand.o ignore_init_note.o
crt1_c.o: crt1_c.c
${CC} ${CFLAGS} -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
gcrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
${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 crt1_s.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
.include <bsd.lib.mk> .include <bsd.lib.mk>

View File

@ -2,39 +2,9 @@
.PATH: ${.CURDIR:H}/common .PATH: ${.CURDIR:H}/common
SRCS= crti.S crtn.S CFLAGS+= -I${.CURDIR}
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= Scrt1.o crt1.o gcrt1.o
CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_REL CFLAGS+= -DCRT_IRELOC_REL
FILES= ${OBJS} CRT1OBJS+= crt1_s.o
FILESMODE= ${LIBMODE}
FILESOWN= ${LIBOWN}
FILESGRP= ${LIBGRP}
FILESDIR= ${LIBDIR}
# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
.undef LIBRARIES_ONLY
CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crtbrand.o ignore_init_note.o
gcrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
${OBJCOPY} --localize-symbol _start1 crt1.o
Scrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
${OBJCOPY} --localize-symbol _start1 Scrt1.o
.include <bsd.lib.mk> .include <bsd.lib.mk>

View File

@ -2,37 +2,6 @@
.PATH: ${.CURDIR:H}/common .PATH: ${.CURDIR:H}/common
SRCS= crti.S crtn.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= Scrt1.o crt1.o gcrt1.o
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS CFLAGS+= -DCRT_IRELOC_SUPPRESS
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} crt1_c.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crtbrand.o ignore_init_note.o
gcrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o
crt1.o: crt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o
Scrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o
.include <bsd.lib.mk> .include <bsd.lib.mk>

View File

@ -2,37 +2,7 @@
.PATH: ${.CURDIR:H}/common .PATH: ${.CURDIR:H}/common
SRCS= crti.S crtn.S crtsavres.S OBJS+= crtsavres.o
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= Scrt1.o crt1.o gcrt1.o
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS CFLAGS+= -DCRT_IRELOC_SUPPRESS
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} crt1_c.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crtbrand.o ignore_init_note.o
gcrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o
crt1.o: crt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o
Scrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o
.include <bsd.lib.mk> .include <bsd.lib.mk>

View File

@ -2,42 +2,14 @@
.PATH: ${.CURDIR:H}/common .PATH: ${.CURDIR:H}/common
SRCS= crti.S crtn.S OBJS+= crtsavres.o
OBJS= ${SRCS:N*.h:R:S/$/.o/g} CFLAGS+= -I${.CURDIR} \
OBJS+= Scrt1.o crt1.o crtsavres.o gcrt1.o
CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include \
-mlongcall -DCRT_IRELOC_RELA -mlongcall -DCRT_IRELOC_RELA
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} crt1_c.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crtbrand.o ignore_init_note.o
CLEANFILES+= crtsavres.S CLEANFILES+= crtsavres.S
# On powerpc64 crtsavres is an empty file # On powerpc64 crtsavres is an empty file
crtsavres.S: crtsavres.S:
touch ${.TARGET} touch ${.TARGET}
gcrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o
crt1.o: crt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o
Scrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o
.include <bsd.lib.mk> .include <bsd.lib.mk>

View File

@ -2,37 +2,8 @@
.PATH: ${.CURDIR:H}/common .PATH: ${.CURDIR:H}/common
SRCS= crti.S crtn.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= Scrt1.o crt1.o gcrt1.o
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS CFLAGS+= -DCRT_IRELOC_SUPPRESS
FILES= ${OBJS} CRT1OBJS+= crt1_s.o
FILESMODE= ${LIBMODE}
FILESOWN= ${LIBOWN}
FILESGRP= ${LIBGRP}
FILESDIR= ${LIBDIR}
# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
.undef LIBRARIES_ONLY
CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crtbrand.o ignore_init_note.o
gcrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
${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 crt1_s.o crtbrand.o ignore_init_note.o
${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
.include <bsd.lib.mk> .include <bsd.lib.mk>