##### Pull in related .mk logic
.include <bsd.obj.mk>
-#.include <bsd.sys.mk>
+.include <bsd.sys.mk>
.endif # !defined(_MINIX_FILES_MK_)
OBJECT_FMT= a.out
.endif
.if ${COMPILER_TYPE} == "gnu"
+.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no")
+LIBDIR?= /usr/netbsd/lib
+.endif
.if ${OBJECT_FMT} == "a.out"
LIBDIR?= /usr/lib
.elif ${OBJECT_FMT} == "ELF"
##### Default values
.if empty(CPPFLAGS:M-nostdinc)
+.if (${NBSD_LIBC} == "yes")
+CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/netbsd/include}
+.else
CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}
.endif
+.endif
.if empty(CXXFLAGS:M-nostdinc++)
CXXFLAGS+= ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++}
.endif
.if ${COMPILER_TYPE} == "ack"
LIB${_lib:tu}= ${DESTDIR}/usr/lib/i386/lib${_lib}.a
.elif ${COMPILER_TYPE} == "gnu"
+.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no")
+LIB${_lib:tu}= ${DESTDIR}/usr/netbsd/lib/lib${_lib}.a
+.else
LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib}.a
.endif
+.endif
.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
.endif
.endfor
HAS_SSP= yes
.endif
+.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no")
+CPPFLAGS+= -nostdinc -D__NBSD_LIBC -I /usr/netbsd/include
+LDFLAGS+= -L /usr/netbsd/lib
+.endif
+
.if defined(USE_FORT) && (${USE_FORT} != "no")
USE_SSP?= yes
.if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels nor kern modules
unix?= We run MINIX.
+# This variable should be used to differentiate Minix builds in Makefiles.
+__MINIX= yes
+
.SUFFIXES: .a .o .ln .s .S .c .cc .cpp .cxx .C .f .F .r .p .l .y #.sh
.LIBS: .a
LD=i386-pc-minix3-ld
OBJCOPY=i386-pc-minix3-objcopy
.endif
+
+# Set NBSD_LIBC to either "yes" or "no".
+.if !defined(NBSD) || (${NBSD} == "no") \
+ || (${COMPILER_TYPE} == "ack")
+NBSD_LIBC= no
+.else
+NBSD_LIBC= yes
+.endif