diff --git a/SConstruct b/SConstruct index e0e24ce4c241..cb2624d63cd6 100755 --- a/SConstruct +++ b/SConstruct @@ -15,8 +15,9 @@ from subprocess import Popen, PIPE, call from os import access, F_OK # Warn user of current set of build options. -if os.path.exists('.scons-option-cache'): - optfile = file('.scons-option-cache') +AddOption('--option-cache', dest='option_cache', nargs=1, type = 'string', action = 'store', metavar = 'FILE', help='file with cached construction variables', default = '.scons-option-cache') +if os.path.exists(GetOption("option_cache")): + optfile = file(GetOption("option_cache")) print "Saved options:", optfile.read().replace("\n", ", ")[:-2] optfile.close() @@ -37,7 +38,7 @@ except KeyError: # Build-control options # -opts = Variables('.scons-option-cache') +opts = Variables(GetOption("option_cache")) def OptionalPath(key, val, env): if val: @@ -119,7 +120,7 @@ if env["lockfile"]: import atexit atexit.register(os.remove, lockfile) -opts.Save('.scons-option-cache', env) +opts.Save(GetOption("option_cache"), env) env.SConsignFile("$build_dir/sconsign.dblite") # Make sure the user's environment is always available @@ -195,8 +196,8 @@ You can make the following special build targets: Files made by targets marked with '(*)' are cleaned by 'scons -c all' Options are cached in a file named .scons-option-cache and persist to later -invocations. The file is editable. Delete it to start fresh. Current option -values can be listed with 'scons -h'. +invocations. The file is editable. Delete it to start fresh. You can also use a different file by +specifying --option-cache=FILE command line argument. Current option values can be listed with 'scons -h'. If you set CXXFLAGS and/or LDFLAGS in the environment, the values will be appended to the appropriate variables within scons.