Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Mar 2000 23:26:34 +0100 (CET)
From:      Christian Weisgerber <naddy@mips.rhein-neckar.de>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/17479: bsd.port.mk: PARALLEL_BUILD
Message-ID:  <200003182226.XAA21545@bigeye.rhein-neckar.de>

next in thread | raw e-mail | index | archive | help

>Number:         17479
>Category:       ports
>Synopsis:       bsd.port.mk: PARALLEL_BUILD
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 18 15:40:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Christian Weisgerber
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:

SMP users and everybody else who uses make -jX.

>Description:

Some ports can be built with a parallel make (make -jX), some can't.
Currently there is no way to know in advance whether a port can
built in parallel. In particular for users with SMP machines, it
would be highly desirable to be able to use "make -jX" for port
building, including dependencies, and be certain that this just
works.

I propose to add a variable PARALLEL_BUILD to bsd.port.mk. If
defined, no additional action is taken and "-jX" can be inherited.
If PARALLEL_BUILD is *not* defined, a non-parallel make will be
forced for the port.

The simple patch provided below implements this.  Since bsd.port.mk
itself is parallel-clean, we only need to handle the cases where
control passes to ${WRKSRC}/Makefile, i.e. the do-build and do-install
targets. This also works for USE_GMAKE.

Maintainers could then add PARALLEL_BUILD=yes to their ports if
appropriate.

Thoughts:
* There are several ways to modify ${MAKEFLAGS}. Using the .MAKEFLAGS
  target seemed most straightforward to me.
* With this patch the absence of PARALLEL_BUILD in a port can mean
  both that the port is not parallel-clean or that the maintainer
  didn't yet bother to check. An explicit PARALLEL_BUILD=YES,
  PARALLEL_BUILD=NO would be a better indicator but diverges from
  common practice for bsd.port.mk variables.

>How-To-Repeat:

>Fix:

--- /usr/ports/Mk/bsd.port.mk	Sun Mar 12 06:36:18 2000
+++ bsd.port.mk	Sat Mar 18 19:43:39 2000
@@ -97,13 +97,17 @@
 # BROKEN_ELF	- Port doesn't build on ELF machines.
 # BROKEN		- Port is broken.
 #
-# This variable is a boolean, so you don't need to set it to the reason.
+# These variables are booleans, so you don't need to set them to the reason.
 #
 # IS_INTERACTIVE - Set this if your port needs to interact with the user
 #				  during any step in a package build.  User can then decide
 #				  to skip this port by setting ${BATCH}, or compiling only
 #				  the interactive ports by setting ${INTERACTIVE}.
 #
+# PARALLEL_BUILD - The port can be built with several jobs running in
+#				  parallel (make -j n). If this is not set, parallel mode
+#				  will be disabled for the do-{build,install} targets.
+#
 # Set these if your port only makes sense to certain archetictures.
 # They are lists containing names for them (e.g., "alpha i386").
 #
@@ -1704,6 +1708,9 @@
 # Build
 
 .if !target(do-build)
+.if !defined(PARALLEL_BUILD)
+.MAKEFLAGS: -j 1 -B
+.endif
 do-build:
 .if defined(USE_GMAKE)
 	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
@@ -1715,6 +1722,9 @@
 # Install
 
 .if !target(do-install)
+.if !defined(PARALLEL_BUILD)
+.MAKEFLAGS: -j 1 -B
+.endif
 do-install:
 .if defined(USE_GMAKE)
 	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET})

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003182226.XAA21545>