Subject: Build problem with "-j 2" in "src/usr.bin/ktruss"
To: None <current-users@NetBSD.org>
From: Matthias Scheler <tron@zhadum.de>
List: current-users
Date: 07/09/2004 22:07:34
	Hello,

building NetBSD-current with "-j 2" fails most of the time on my system
in "src/usr.bin/ktruss". The reason is that it shares the dynamically
generated source file "ioctl.c" with "src/usr.bin/kdump" but doesn't
(reliably) wait until the file has really been created.

I can think of two ways to fix this:

1.) Insert a ".WAIT" between "kdump" and "ktruss" in "src/usr.bin/Makefile".

2.) Prefixing the name of the created file with "${PROG}-":

Index: kdump/Makefile
===================================================================
RCS file: /cvsroot/src/usr.bin/kdump/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- kdump/Makefile	16 Nov 2003 10:10:37 -0000	1.24
+++ kdump/Makefile	9 Jul 2004 22:03:36 -0000
@@ -5,9 +5,9 @@
 
 PROG=	kdump
 CPPFLAGS+=-I${NETBSDSRCDIR}/usr.bin/ktrace -I${NETBSDSRCDIR}/sys
-SRCS=	kdump.c ioctl.c subr.c setemul.c siginfo.c
+SRCS=	kdump.c subr.c setemul.c siginfo.c
 .PATH:	${NETBSDSRCDIR}/usr.bin/ktrace
-CLEANFILES+=ioctl.c siginfo.c
+CLEANFILES+=siginfo.c
 WFORMAT=1
 
 .if (${MKDYNAMICROOT} == "no")
Index: kdump/Makefile.ioctl-c
===================================================================
RCS file: /cvsroot/src/usr.bin/kdump/Makefile.ioctl-c,v
retrieving revision 1.15
diff -u -r1.15 Makefile.ioctl-c
--- kdump/Makefile.ioctl-c	7 Jul 2004 14:28:17 -0000	1.15
+++ kdump/Makefile.ioctl-c	9 Jul 2004 22:03:36 -0000
@@ -8,10 +8,13 @@
 DEPFILES != egrep -l '(_IO\(|_IOR\(|_IOW\(|_IORW\()' ${DEPFILEGLOB}
 .endif
 
-ioctl.c: mkioctls Makefile ${DEPFILES}
+${PROG}-ioctl.c: mkioctls Makefile ${DEPFILES}
 	${_MKTARGET_CREATE}
 	CC="${CC}" DESTDIR=${DESTDIR} \
 	    ${HOST_SH} ${NETBSDSRCDIR}/usr.bin/kdump/mkioctls \
-	    ${DEPFILES} > ioctl.c
+	    ${DEPFILES} >${.TARGET}
+
+SRCS+=		${PROG}-ioctl.c
+CLEANFILES+=	${PROG}-ioctl.c
 
 ${DEPFILES}: .PRECIOUS
Index: ktruss/Makefile
===================================================================
RCS file: /cvsroot/src/usr.bin/ktruss/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- ktruss/Makefile	21 Oct 2003 10:01:22 -0000	1.17
+++ ktruss/Makefile	9 Jul 2004 22:03:36 -0000
@@ -5,10 +5,10 @@
 .include <bsd.own.mk>		# for MKDYNAMICROOT & NETBSDSRCDIR
 
 PROG=		ktruss
-SRCS=		ktrace.c dump.c subr.c ioctl.c misc.c setemul.c
+SRCS=		ktrace.c dump.c subr.c misc.c setemul.c
 CPPFLAGS+=	-I. -I${NETBSDSRCDIR}/usr.bin/ktrace -I${NETBSDSRCDIR}/sys \
 		-I${NETBSDSRCDIR}/usr.bin/kdump -DKTRUSS
-CLEANFILES+=	misc.c misc.h ioctl.c
+CLEANFILES+=	misc.c misc.h
 WFORMAT=1
 
 .if (${MKDYNAMICROOT} == "no")
@@ -24,9 +24,6 @@
 	    ${DESTDIR}/usr/include/sys/errno.h \
 	    ${DESTDIR}/usr/include/sys/signal.h misc
 
-# XXX It looks like .NOTPARALLEL doesn't work.
-.NOTPARALLEL:
-
 .include "${NETBSDSRCDIR}/usr.bin/kdump/Makefile.ioctl-c"
 .include <bsd.prog.mk>
 
Is there a better way to fix this? Will the second patch increase the
size of the "/rescue" binary?

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/