Re: MAKEFLAGS caused temporary insanity

Euan Thoms euan at potensol.com
Wed Nov 25 01:33:53 UTC 2015


Sorry, I only just noticed your email. I'll give it a try and report back.

On Tuesday, November 24, 2015 11:15 SGT, Jan Beich <jbeich at vfemail.net> wrote: 
 
> "Euan Thoms" <euan at potensol.com> writes:
> 
> > do-build:
> >         cd ${WRKSRC} && unset MAKEFLAGS && ${OPENSIPS_MAKE_ENV}
> > ${GMAKE} ${_MAKE_JOBS} ${ALL_TARGET}
> 
> Have you tried defining NOPRECIOUSMAKEVARS in the port's Makefile?
> 
> MAKEFLAGS is used to propagate arguments to submake but the ports framework
> (ab)uses it to pass internal variables without making sure they do not
> poison vendors' Makefiles. For one, ffmpeg and anything that bundles it
> (e.g. handbrake, kodi) have to be careful ${ARCH} isn't overriden.
> 
>   $ make
>   ARCH=amd64
> 
>   $ cat BSDmakefile
>   ARCH=   amd64
> 
>   .MAKEFLAGS:     ARCH=${ARCH}
> 
>   all:
>           @gmake --no-print-directory
> 
>   $ cat GNUmakefile
>   ARCH=   x86_64
> 
>   all:
>           @echo ARCH=${ARCH}
> 
> which is the result of
> 
>   Mk/bsd.port.mk:
>   (3) Serious speedup of bsd.port.mk startup.  In particular, this helps
>       cut down "make index" time from an hour and a half to 8 minutes on
>       our system with a parallel make describe (see 2).  Try to pass
>       unchanged variables down from parent makes instead of rerunning
>       commands to define them, etc.
> 
>   https://svnweb.freebsd.org/changeset/ports/20327
> 
> Why not follow PkgSrc in using MACHINE_ARCH?
> 
> Index: Mk/bsd.port.mk
> ===================================================================
> --- Mk/bsd.port.mk	(revision 402341)
> +++ Mk/bsd.port.mk	(working copy)
> @@ -1131,10 +1131,7 @@ makepatch:
>  MAINTAINER?=	ports at FreeBSD.org
>  
>  # Get the architecture
> -.if !defined(ARCH)
> -ARCH!=	${UNAME} -p
> -.endif
> -_EXPORTED_VARS+=	ARCH
> +ARCH?=			${MACHINE_ARCH}
>  
>  # Get the operating system type
>  .if !defined(OPSYS)
> 
> Once 9.x reaches EOL and the ports tree becomes bmake-only other variables
> can be (properly) fixed via .export.
> 
> Index: Mk/bsd.port.mk
> ===================================================================
> --- Mk/bsd.port.mk	(revision 402341)
> +++ Mk/bsd.port.mk	(working copy)
> @@ -5051,11 +5051,7 @@ ${_t}:
>  
>  .if !defined(NOPRECIOUSMAKEVARS)
>  # These won't change, so we can pass them through the environment
> -.for var in ${_EXPORTED_VARS}
> -.if empty(.MAKEFLAGS:M${var}=*) && !empty(${var})
> -.MAKEFLAGS:	${var}=${${var}:Q}
> -.endif
> -.endfor
> +.export ${_EXPORTED_VARS}
>  .endif
>  
>  .if !target(pre-check-config)
 
 
 
-- 
Regards, Euan Thoms 




More information about the freebsd-ports mailing list