1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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
This commit is contained in:
Andrew Tridgell 2010-04-14 23:37:47 +10:00
parent 74c4c7fe4f
commit e81e057b6d
3 changed files with 28 additions and 6 deletions

View File

@ -1,11 +1,6 @@
# simple makefile wrapper to run waf
# default to using only 1 cpu, to be friendly to build
# farm machines. I wonder how we get at the -jN option
# from make to pass it to waf?
JOBS=1
WAF=JOBS=$(JOBS) BUILDTOOLS/bin/waf
WAF=WAF_MAKE=1 BUILDTOOLS/bin/waf
all:
$(WAF) build

View File

@ -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

View File

@ -226,6 +226,7 @@ def configure(conf):
def build(bld):
bld.CHECK_MAKEFLAGS()
bld.SETUP_BUILD_GROUPS()
bld.ENFORCE_GROUP_ORDERING()
bld.CHECK_PROJECT_RULES()