diff --git a/usr.bin/xlint/llib/Makefile b/usr.bin/xlint/llib/Makefile index bcf93c4118a..df79a752936 100644 --- a/usr.bin/xlint/llib/Makefile +++ b/usr.bin/xlint/llib/Makefile @@ -16,6 +16,15 @@ llib-lstdc.ln: llib-lstdc .include -.if ${MK_DIRDEPS_BUILD} == "yes" +.if !empty(STAGE_INCLUDEDIR) LINTFLAGS+= -I${STAGE_INCLUDEDIR} +.else +.if ${CFLAGS:M--sysroot=*} != "" +_sysroot?= ${CFLAGS:M--sysroot=*:[1]:C,^--sysroot=,,} +.elif ${CC:M--sysroot=*} != "" +_sysroot?= ${CC:M--sysroot=*:[1]:C,^--sysroot=,,} +.endif +.if !empty(_sysroot) +LINTFLAGS+= -I${_sysroot}/usr/include +.endif .endif