Subject: pulling kernel headers on building hostprogs
To: None <tech-toolchain@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: tech-toolchain
Date: 10/12/2006 01:20:28
Hi,

There is a report that making NetBSD-3.0 images in -current
src/distrib/cdrom/macppc_installboot dir fails on NetBSD-3.0 host.

The problem is that the Makefile has "-I${NETBSDSRCDIR}/sys"
for CPPFLAGS to pull <fs/cd9660/iso.h> and <fs/locale.h> but
it causes a problem that usual system headers like <sys/stat.h>
are also pulled from ${NETBSDSRCDIR}/sys dir, not /usr/include/sys
for the host.

I think we could avoid this by copying required headers into
${.OBJDIR} or somewhere else like src/tools/Makefile.disklabel does,
and the attached patch may fix the problem, but I'd like to ask
toolchain people if there is more appropriate way to handle
these issue.

(ideally cd9660 support should be merged into installboot(8)??)
---
Izumi Tsutsui


Index: Makefile
===================================================================
RCS file: /cvsroot/src/distrib/cdrom/macppc_installboot/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- Makefile	17 Sep 2006 03:56:03 -0000	1.6
+++ Makefile	11 Oct 2006 14:47:52 -0000
@@ -4,7 +4,21 @@
 SRCS=		installboot.c cd9660.c cd9660_util.c
 NOMAN=	# defined
 
-HOST_CPPFLAGS+=	-I${.CURDIR} -I${NETBSDSRCDIR}/sys
+HOST_CPPFLAGS+=	-I. -I${.CURDIR}
 #HOST_CPPFLAGS+=	-DDEBUG
 
+.if !make(obj) && !make(clean) && !make(cleandir)
+.BEGIN:
+	-rm -rf fs
+	${HOST_INSTALL_DIR} fs
+	${HOST_INSTALL_DIR} fs/cd9660
+	${HOST_INSTALL_FILE} ${NETBSDSRCDIR}/sys/fs/unicode.h fs
+	${HOST_INSTALL_FILE} ${NETBSDSRCDIR}/sys/fs/cd9660/iso.h fs/cd9660
+.endif
+
+cleandir distclean: cleaninc
+
+cleaninc:
+	-rm -rf fs
+
 .include <bsd.hostprog.mk>