test-includes: Build a library instead of a binary

We need to build the .o's, but don't need to link. Build a static
library instead of a binary to accmoplish this. This removes the need to
have all the libc and crt stuff built, which is required for a
binary. In addition, trying to build a non-standard binary runs into
trouble with undefined symbols on arm related to EABI, even when using a
simplified startup with -nostdlib -e start.

Turn back on testing includes, now that it works.

Sponsored by:		Netflix
Reviewed by:		brooks, markj (prior version)
Differential Revision:	https://reviews.freebsd.org/D33452
This commit is contained in:
Warner Losh 2021-12-15 15:34:47 -07:00
parent 7aec934fff
commit 7a171e3083
3 changed files with 7 additions and 11 deletions

View file

@ -1128,6 +1128,7 @@ _includes:
.if !empty(SUBDIR_OVERRIDE) && make(buildworld)
${_+_}cd ${.CURDIR}; ${WMAKE} MK_INCLUDES=yes SHARED=symlinks includes
.endif
${_+_}cd ${.CURDIR}; ${WMAKE} test-includes
_libraries:
@echo
@echo "--------------------------------------------------------------"

View file

@ -13,11 +13,11 @@
# programs to detect FreeBSD has different headers, omitting internal
# headers cuts down on the noise w/o causing problems for the goal.
#
PROG= test-includes
SRCS= test-includes.c
INTERNALPROG= This is a compile-only test
LIB= test-includes
INTERNALLIB= This is a compile-only test
MAN=
HDRS!= (cd ${SRCTOP}/sys; ls sys/[^_]*.h net*/[^_]*.h)
NO_PIC= yes
# Some files have to be clean for extra defines too...
CFLAGS.event.c= -D_WANT_KEVENT32 -D_WANT_FREEBSD11_KEVENT
@ -33,6 +33,8 @@ ${h:R}.c:
.endif
.endfor
test-includes: lib${LIB}.a .PHONY
#
# Target to make the current known bad list. In general, this list should only
# ever shrink and never grow.
@ -49,4 +51,4 @@ badfiles.inc:
done; \
echo) > ${.CURDIR}/badfiles.inc
.include <bsd.prog.mk>
.include <bsd.lib.mk>

View file

@ -1,7 +0,0 @@
/* Public domain */
int
main(void)
{
return 0;
}