summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/samba_utils.py
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-14 23:37:47 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-14 23:37:47 +1000
commite81e057b6d70d70616132593dc2acbfe77cb459c (patch)
treeee9fd136626400e7c46e15f172fa43a7083faac2 /buildtools/wafsamba/samba_utils.py
parent74c4c7fe4f8ed9479a126d1217dfcc084ff31791 (diff)
downloadsamba-e81e057b6d70d70616132593dc2acbfe77cb459c.tar.gz
build: try to honor MAKEFLAGS from make
This means "make -j" and "make -k" now do roughly what is expected make -j will use the number of CPUs on the system, regardless of the number after the -j (as MAKEFLAGS doesn't contain that value). make -k will will continue on errors
Diffstat (limited to 'buildtools/wafsamba/samba_utils.py')
-rw-r--r--buildtools/wafsamba/samba_utils.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 7ee16635132..bf051afa3b6 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -438,3 +438,29 @@ def RECURSE(ctx, directory):
raise
Options.Handler.RECURSE = RECURSE
Build.BuildContext.RECURSE = RECURSE
+
+
+def CHECK_MAKEFLAGS(bld):
+ '''check for MAKEFLAGS environment variable in case we are being
+ called from a Makefile try to honor a few make command line flags'''
+ if not 'WAF_MAKE' in os.environ:
+ return
+ makeflags = os.environ.get('MAKEFLAGS')
+ jobs_set = False
+ for opt in makeflags.split():
+ # options can come either as -x or as x
+ if opt[0] != '-':
+ for v in opt:
+ if v == 'j':
+ jobs_set = True
+ elif v == 'k':
+ Options.options.keep = True
+ elif opt == '-j':
+ jobs_set = True
+ elif opt == '-k':
+ Options.options.keep = True
+ if not jobs_set:
+ # default to one job
+ Options.options.jobs = 1
+
+Build.BuildContext.CHECK_MAKEFLAGS = CHECK_MAKEFLAGS