switch makefile's parallelism control to `JOB_OPTIONS'

Avoid potential collision with `PLT_SETUP_OPTIONS' as an environment
variable.
This commit is contained in:
Matthew Flatt 2013-07-05 11:48:33 -06:00
parent a8ed2b1546
commit 2f637741e2
5 changed files with 29 additions and 15 deletions

View File

@ -44,7 +44,7 @@ makefile and the `raco setup' part, use
make CPUS=<n>
which recurs with `make -j <n> PLT_SETUP_OPTIONS="-j <n>"'.
which recurs with `make -j <n> JOB_OPTIONS="-j <n>"'.
Building Racket Pieces
@ -74,6 +74,10 @@ On Unix or Mac OS X, you can use `make in-place' and still set
suffix on the variable name is a convention that indicates that
single- and double-quote marks are allowed in the value.)
On all platforms, `JOB_OPTIONS' as a makefile variable and
`PLT_SETUP_OPTIONS' as an environment variable are passed on to the
`raco setup' that is used to build core libraries.
Installing Packages
-------------------
@ -414,3 +418,7 @@ the description on a second line. The installer is also uploaded to
the server, which leaves the installer in a "build/installers"
directory and records a mapping from the installer's description to
its filename in "build/installers/table.rktd".
If you provide `JOB_OPTIONS=...' for either a client or server build,
the options are used both for `raco setup' and `raco pkg
install'. Normally, `JOB_OPTIONS' is used to control parallelism.

View File

@ -35,18 +35,18 @@ in-place:
if [ "$(CPUS)" = "" ] ; then $(MAKE) plain-in-place ; else $(MAKE) cpus-in-place ; fi
cpus-in-place:
$(MAKE) -j $(CPUS) plain-in-place PLT_SETUP_OPTIONS="-j $(CPUS)"
$(MAKE) -j $(CPUS) plain-in-place JOB_OPTIONS="-j $(CPUS)"
plain-in-place:
$(MAKE) core
if $(MACOSX_CHECK) ; then $(MAKE) native-from-git ; fi
$(MAKE) pkg-links
$(PLAIN_RACKET) -N raco -l- raco setup $(PLT_SETUP_OPTIONS)
$(PLAIN_RACKET) -N raco -l- raco setup $(JOB_OPTIONS) $(PLT_SETUP_OPTIONS)
win32-in-place:
$(MAKE) win32-core
$(MAKE) win32-pkg-links
$(WIN32_PLAIN_RACKET) -N raco -l- raco setup $(PLT_SETUP_OPTIONS)
$(WIN32_PLAIN_RACKET) -N raco -l- raco setup $(JOB_OPTIONS) $(PLT_SETUP_OPTIONS)
# ------------------------------------------------------------
# Core build
@ -57,19 +57,21 @@ win32-in-place:
CONFIGURE_ARGS_qq =
SELF_FLAGS_qq = SELF_RACKET_FLAGS="-G `cd ../../../build/config; pwd`"
core:
mkdir -p build/config
echo '#hash((links-search-files . ()))' > build/config/config.rktd
mkdir -p racket/src/build
$(MAKE) racket/src/build/Makefile
cd racket/src/build; $(MAKE) reconfigure
cd racket/src/build; $(MAKE) SELF_RACKET_FLAGS="-G `cd ../../../build/config; pwd`"
cd racket/src/build; $(MAKE) install SELF_RACKET_FLAGS="-G `cd ../../../build/config; pwd`"
cd racket/src/build; $(MAKE) $(SELF_FLAGS_qq)
cd racket/src/build; $(MAKE) install $(SELF_FLAGS_qq) PLT_SETUP_OPTIONS="$(JOB_OPTIONS) $(PLT_SETUP_OPTIONS)"
win32-core:
IF NOT EXIST build\config cmd /c mkdir -p build\config
cmd /c echo #hash((links-search-files . ())) > build\config\config.rktd
cmd /c racket\src\worksp\build-at racket\src\worksp ..\..\..\build\config $(PLT_SETUP_OPTIONS)
cmd /c racket\src\worksp\build-at racket\src\worksp ..\..\..\build\config $(JOB_OPTIONS) $(PLT_SETUP_OPTIONS)
racket/src/build/Makefile: racket/src/configure racket/src/Makefile.in
cd racket/src/build; ../configure $(CONFIGURE_ARGS_qq)
@ -136,6 +138,10 @@ CONFIG_MODE = default
# (except as overridden in the `CONFIG' module):
CLEAN_MODE =
# Determines the number of parallel jobs used for package and
# setup operations:
JOB_OPTIONS =
# A command to run after the server has started; normally set by
# the `installers' target:
SERVE_DURING_CMD_qq =
@ -159,7 +165,7 @@ RACKET = racket/bin/racket -A "$(ADDON)"
RACO = racket/bin/racket -A "$(ADDON)" -N raco -l- raco
WIN32_RACKET = racket\racket -A "$(ADDON)"
WIN32_RACO = racket\racket -A "$(ADDON)" -N raco -l- raco
X_AUTO_OPTIONS = --skip-installed --deps search-auto $(PLT_SETUP_OPTIONS)
X_AUTO_OPTIONS = --skip-installed --deps search-auto $(JOB_OPTIONS)
USER_AUTO_OPTIONS = --scope user $(X_AUTO_OPTIONS)
LOCAL_USER_AUTO = --catalog build/local/catalog $(USER_AUTO_OPTIONS)
SOURCE_USER_AUTO_q = --catalog "$(SRC_CATALOG)" $(USER_AUTO_OPTIONS)
@ -247,7 +253,7 @@ packages-from-local:
$(RACO) pkg install $(LOCAL_USER_AUTO) $(REQUIRED_PKGS) $(DISTRO_BUILD_PKGS)
$(MAKE) set-config
$(RACKET) -l distro-build/install-pkgs $(CONFIG_MODE_q) "$(PKGS)" $(LOCAL_USER_AUTO)
$(RACO) setup --avoid-main
$(RACO) setup --avoid-main $(JOB_OPTIONS)
# Install packages from a source catalog (as an alternative to
# `build-from-local'), where the source catalog is specified as
@ -257,7 +263,7 @@ build-from-catalog:
$(RACO) pkg install $(SOURCE_USER_AUTO_q) $(REQUIRED_PKGS) $(DISTRO_BUILD_PKGS)
$(MAKE) set-config
$(RACKET) -l distro-build/install-pkgs $(CONFIG_MODE_q) "$(CONFIG_MODE)" "$(PKGS)" $(SOURCE_USER_AUTO_q)
$(RACO) setup --avoid-main
$(RACO) setup --avoid-main $(JOB_OPTIONS)
# Although a client will build its own "collects", pack up the
# server's version to be used by each client, so that every client has
@ -307,7 +313,7 @@ client:
COPY_ARGS = SERVER=$(SERVER) PKGS="$(PKGS)" RELEASE_MODE=$(RELEASE_MODE) \
DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \
DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) \
DIST_DESC="$(DIST_DESC)" PLT_SETUP_OPTIONS="$(PLT_SETUP_OPTIONS)"
DIST_DESC="$(DIST_DESC)" JOB_OPTIONS="$(JOB_OPTIONS)"
win32-client:
IF EXIST build\user cmd /c rmdir /S /Q build\user

View File

@ -237,7 +237,7 @@
(sh "cd " (q dir) " ; "
"make -j " j " client"
(client-args c server 'unix)
" PLT_SETUP_OPTIONS=\"-j " j "\""
" JOB_OPTIONS=\"-j " j "\""
" CONFIGURE_ARGS_qq=" (qq (get-opt c '#:configure null) 'unix))))
(define (windows-build c host port user server repo clean? pull?)
@ -263,7 +263,7 @@
" && \"c:\\Program Files" (if (= bits 64) " (x86)" "") "\\Microsoft Visual Studio 9.0\\vc\\vcvarsall.bat\""
" " vc
" && nmake win32-client"
" PLT_SETUP_OPTIONS=\"-j " j "\""
" JOB_OPTIONS=\"-j " j "\""
(client-args c server 'windows))))
(define (client-build c)

View File

@ -302,6 +302,6 @@
(exit 1)))
(define (parallel-compile worker-count setup-fprintf append-error collects-tree)
(setup-fprintf (current-output-port) #f "--- parallel build using ~a processes ---" worker-count)
(setup-fprintf (current-output-port) #f "--- parallel build using ~a jobs ---" worker-count)
(define collects-queue (make-object collects-queue% collects-tree setup-fprintf append-error '()))
(parallel-build collects-queue worker-count))

View File

@ -4,7 +4,7 @@ set BUILD_CONFIG=%2
set PLT_SETUP_OPTIONS=--no-foreign-libs
:suloop
if "%3"=="" goto sudone
set PLT_SETUP_OPTIONS=%PLT_SETUP_OPTIONS %3
set PLT_SETUP_OPTIONS=%PLT_SETUP_OPTIONS% %3
shift
goto suloop
:sudone