Subject: Re: arg list too long?
To: Jukka Salmi <j+nbsd@2005.salmi.ch>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 06/02/2005 21:27:21
>there's a problem with the recent changes to src/sys/conf/Makefile.kern.inc:

Sorry.

>it breaks if a machine dependent makefile defines a .BEGIN target. This was
>reported today on current-users:

Unfortunately there isn't a flag or anything to supress .BEGIN/.END handling
so these are inherently dangerous with sub-make's.
They should probably be protected by a .ifndef noBEGIN or something.

Can you confirm if the following fixes your problem:


Index: sys/arch/xen/conf/Makefile.xen
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/conf/Makefile.xen,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.xen
--- sys/arch/xen/conf/Makefile.xen	31 May 2005 04:03:11 -0000	1.6
+++ sys/arch/xen/conf/Makefile.xen	3 Jun 2005 04:25:47 -0000
@@ -59,6 +59,7 @@ spl.o: ${XEN}/${XEN_BUILD}/spl.S assym.h
 vector.o: ${XEN}/${XEN_BUILD}/vector.S assym.h
 	${NORMAL_S}
 
+.ifndef noBEGIN
 .if !make(obj) && !make(clean) && !make(cleandir)
 .BEGIN:
 .for A in ${XEN_MACHINE_ARCHS}
@@ -69,6 +70,7 @@ vector.o: ${XEN}/${XEN_BUILD}/vector.S a
 	mkdir xen-ma
 	ln -s ../${XEN_BUILD} xen-ma/machine
 .endif
+.endif
 
 ##
 ## (5) link settings
Index: sys/conf/Makefile.kern.inc
===================================================================
RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
retrieving revision 1.66
diff -u -p -r1.66 Makefile.kern.inc
--- sys/conf/Makefile.kern.inc	2 Jun 2005 05:11:55 -0000	1.66
+++ sys/conf/Makefile.kern.inc	3 Jun 2005 04:25:47 -0000
@@ -300,6 +300,7 @@ MKDEP_CFLAGS?=	${CFLAGS}
 _SFILES=${MD_SFILES} ${SFILES}
 _CFILES=${MD_CFILES} ${MI_CFILES} ${CFILES}
 _XargsMKDEP=${MKDEP:M*=*} xargs -t ${MKDEP:N*=*}
+_SubMake=${.MAKE} -f ${MAKEFILE} -DnoBEGIN
 
 # This dance is necessary to avoid long command lines.
 ${SRCS:S,^,list-,}:
@@ -311,8 +312,8 @@ _cfiles: ${_CFILES:S,^,list-,}
 .depend: ${SRCS} assym.h config_time.h
 	${_MKTARGET_CREATE}
 	@> $@
-	@${.MAKE} -f ${MAKEFILE} _sfiles | ${_XargsMKDEP} -a -- ${MKDEP_AFLAGS} ${CPPFLAGS} 
-	@${.MAKE} -f ${MAKEFILE} _cfiles | ${_XargsMKDEP} -a -- ${MKDEP_CFLAGS} ${CPPFLAGS}
+	@${_SubMake} _sfiles | ${_XargsMKDEP} -a -- ${MKDEP_AFLAGS} ${CPPFLAGS} 
+	@${_SubMake} _cfiles | ${_XargsMKDEP} -a -- ${MKDEP_CFLAGS} ${CPPFLAGS}
 	cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
 	    ${GENASSYM} -- ${MKDEP} -f assym.dep -- \
 	    ${CFLAGS} ${CPPFLAGS}

Thanks
--sjg