aboutsummaryrefslogtreecommitdiff
path: root/ports-mgmt
diff options
context:
space:
mode:
authorMark Linimon <linimon@FreeBSD.org>2009-03-24 06:26:56 +0000
committerMark Linimon <linimon@FreeBSD.org>2009-03-24 06:26:56 +0000
commitfd596d508963d459670c8683792f2cf4aa3e09d3 (patch)
tree23c336d4ebe92f90725c2deaf69aeaf799b8d6c4 /ports-mgmt
parentfb7ace692457771e01097e51980157609581098a (diff)
downloadports-fd596d508963d459670c8683792f2cf4aa3e09d3.tar.gz
ports-fd596d508963d459670c8683792f2cf4aa3e09d3.zip
Notes
Diffstat (limited to 'ports-mgmt')
-rw-r--r--ports-mgmt/portmk/Mk/bsd.port.mk45
1 files changed, 43 insertions, 2 deletions
diff --git a/ports-mgmt/portmk/Mk/bsd.port.mk b/ports-mgmt/portmk/Mk/bsd.port.mk
index e1be90805460..1ba180468e5e 100644
--- a/ports-mgmt/portmk/Mk/bsd.port.mk
+++ b/ports-mgmt/portmk/Mk/bsd.port.mk
@@ -919,6 +919,21 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org
# Default: see below
# MAKE_ARGS - Any extra arguments to sub-make in build and install stages.
# Default: none
+##
+# MAKE_JOBS_SAFE
+# - This port can safely be built on multiple cpus in parallel.
+# The make will be invoked with -jX parameter where X equals
+# number of cores present in the system.
+# MAKE_JOBS_UNSAFE
+# - Disallow multiple jobs even when user set a global override.
+# To be used with known bad ports.
+# DISABLE_MAKE_JOBS
+# - Set to disable the multiple jobs feature. User settable.
+# FORCE_MAKE_JOBS
+# - Force all ports to be built with multiple jobs, except ports
+# that are explicitly marked MAKE_JOBS_UNSAFE. User settable.
+# MAKE_JOBS_NUMBER
+# - Override the number of make jobs to be used. User settable.
#
# For install:
#
@@ -2383,6 +2398,22 @@ CFLAGS+= -fno-strict-aliasing
.endif
.endif
+# Multiple make jobs support
+.if defined(DISABLE_MAKE_JOBS) || defined(MAKE_JOBS_UNSAFE)
+_MAKE_JOBS= #
+.else
+.if defined(MAKE_JOBS_SAFE) || defined(FORCE_MAKE_JOBS)
+.if defined(MAKE_JOBS_NUMBER)
+_MAKE_JOBS= -j${MAKE_JOBS_NUMBER}
+.else
+_MAKE_JOBS= -j`${SYSCTL} -n kern.smp.cpus`
+.endif
+.if defined(FORCE_MAKE_JOBS)
+BUILD_FAIL_MESSAGE+= "You have chosen to use multiple make jobs (parallelization) for all ports. This port was not tested for this setting. Please remove FORCE_MAKE_JOBS and retry the build before reporting the failure to the maintainer."
+.endif
+.endif
+.endif
+
PTHREAD_CFLAGS?=
PTHREAD_LIBS?= -pthread
@@ -3887,9 +3918,19 @@ do-configure:
.if !target(do-build)
do-build:
.if defined(USE_GMAKE)
- @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
+ @(cd ${BUILD_WRKSRC}; if ! ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET}; then \
+ if [ x != x${BUILD_FAIL_MESSAGE} ] ; then \
+ ${ECHO_MSG} "===> Compilation failed unexpectedly."; \
+ (${ECHO_CMD} ${BUILD_FAIL_MESSAGE}) | ${FMT} 75 79 ; \
+ fi; \
+ fi)
.else
- @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
+ @(cd ${BUILD_WRKSRC}; if ! ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET}; then \
+ if [ x != x${BUILD_FAIL_MESSAGE} ] ; then \
+ ${ECHO_MSG} "===> Compilation failed unexpectedly."; \
+ (${ECHO_CMD} ${BUILD_FAIL_MESSAGE}) | ${FMT} 75 79 ; \
+ fi; \
+ fi)
.endif
.endif