Subject: Re: arg list too long?
To: Simon Gerraty <sjg@juniper.net>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-toolchain
Date: 06/01/2005 21:49:01
On Jun 1, 2005, at 4:24 PM, Simon Gerraty wrote:

> I hit this when trying to cross-build -current on a freebsd box.
> Eventually the arg list will become too long, so the following patch
> might be useful...  (I think I posted this patch last year some time)

I have no objections to this.  I have run into this in the past cross- 
building from OS X.

>
> --sjg
>
> Index: sys/conf/Makefile.kern.inc
> ===================================================================
> RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
> retrieving revision 1.65
> diff -u -p -r1.65 Makefile.kern.inc
> --- sys/conf/Makefile.kern.inc    1 Jun 2005 00:11:32 -0000    1.65
> +++ sys/conf/Makefile.kern.inc    1 Jun 2005 23:21:09 -0000
> @@ -295,11 +295,24 @@ dependall: depend all
>  SRCS?=        ${MD_SFILES} ${MD_CFILES} ${MI_CFILES} ${CFILES} $ 
> {SFILES}
>  MKDEP_AFLAGS?=    ${AFLAGS}
>  MKDEP_CFLAGS?=    ${CFLAGS}
> +# We have to assume that we'll eventually run out of command line.
> +# We already hit that on non-NetBSD hosts.
> +_SFILES=${MD_SFILES} ${SFILES}
> +_CFILES=${MD_CFILES} ${MI_CFILES} ${CFILES}
> +_XargsMKDEP=${MKDEP:M*=*} xargs -t ${MKDEP:N*=*}
> +
> +# This dance is necessary to avoid long command lines.
> +${SRCS:S,^,list-,}:
> +    @echo ${.TARGET:S,^list-,,}
> +
> +_sfiles: ${_SFILES:S,^,list-,}
> +_cfiles: ${_CFILES:S,^,list-,}
> +
>  .depend: ${SRCS} assym.h config_time.h
>      ${_MKTARGET_CREATE}
> -    ${MKDEP} -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${MD_SFILES} ${SFILES}
> -    ${MKDEP} -a -- ${MKDEP_CFLAGS} ${CPPFLAGS} ${MD_CFILES} $ 
> {MI_CFILES} \
> -        ${CFILES}
> +    @> $@
> +    @${.MAKE} -f ${MAKEFILE} _sfiles | ${_XargsMKDEP} -a -- $ 
> {MKDEP_AFLAGS} ${CPPFLAGS}
> +    @${.MAKE} -f ${MAKEFILE} _cfiles | ${_XargsMKDEP} -a -- $ 
> {MKDEP_CFLAGS} ${CPPFLAGS}
>      cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
>          ${GENASSYM} -- ${MKDEP} -f assym.dep -- \
>          ${CFLAGS} ${CPPFLAGS}
>

-- thorpej