diff options
author | Pav Lucistnik <pav@FreeBSD.org> | 2009-03-22 10:28:53 +0000 |
---|---|---|
committer | Pav Lucistnik <pav@FreeBSD.org> | 2009-03-22 10:28:53 +0000 |
commit | 6b4ca324537d188089e5c493f1ce94ebfb76e0d4 (patch) | |
tree | 1eba4f77928f774f0af88971a63e5a7eaf9f0344 /Mk | |
parent | 4038f6218dfc0e133ca679f092e8c5edb0f24028 (diff) | |
download | ports-6b4ca324537d188089e5c493f1ce94ebfb76e0d4.tar.gz ports-6b4ca324537d188089e5c493f1ce94ebfb76e0d4.zip |
Notes
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/bsd.port.mk | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index b619e840cc1a..6aec88d3cb69 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -920,6 +920,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: # @@ -2159,6 +2174,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 @@ -3659,9 +3690,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 |