git: b347c2284603 - main - cross-build: Add common compatibility headers after OS-specific ones

From: Alex Richardson <arichardson_at_FreeBSD.org>
Date: Fri, 28 Apr 2023 23:15:04 UTC
The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=b347c22846038a070ea576e904771178acf5a302

commit b347c22846038a070ea576e904771178acf5a302
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2023-04-21 22:06:51 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2023-04-28 23:10:25 +0000

    cross-build: Add common compatibility headers after OS-specific ones
    
    The current order is rather counter-intuitive and it appears to work fine
    if we swap the order.
    
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/725
    Reviewed by:    imp
---
 tools/build/mk/Makefile.boot | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot
index 138dff45930b..3bbb183021b2 100644
--- a/tools/build/mk/Makefile.boot
+++ b/tools/build/mk/Makefile.boot
@@ -35,7 +35,6 @@ LIBZ:=${WORLDTMP}/legacy/usr/lib/libz.a
 CFLAGS+=	-Werror=implicit-function-declaration -Werror=implicit-int \
 		-Werror=return-type -Wundef
 CFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1
-CFLAGS+=	-I${SRCTOP}/tools/build/cross-build/include/common
 # This is needed for code that compiles for pre-C11 C standards
 CWARNFLAGS.clang+=-Wno-typedef-redefinition
 # bsd.sys.mk explicitly turns on -Wsystem-headers, but that's extremely
@@ -69,6 +68,11 @@ CFLAGS+=	-idirafter ${SRCTOP}/contrib/libarchive/libarchive
 .endif
 .endif # ${.MAKE.OS} != "FreeBSD"
 
+.if ${.MAKE.OS} != "FreeBSD"
+# Add the common compatibility headers after the OS-specific ones.
+CFLAGS+=	-I${SRCTOP}/tools/build/cross-build/include/common
+.endif
+
 # we do not want to capture dependencies referring to the above
 UPDATE_DEPENDFILE= no