diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 19af243c5d7a..1d5753a39a32 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -81,6 +81,7 @@ class TreeMetadataEmitter(object): # Makefile.in : moz.build ASFILES='ASFILES', CSRCS='CSRCS', + DEFINES='DEFINES', MODULE='MODULE', SIMPLE_PROGRAMS='SIMPLE_PROGRAMS', XPIDL_FLAGS='XPIDL_FLAGS', diff --git a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py index db43b267f1de..b7b3e30fada5 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py +++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py @@ -72,6 +72,12 @@ VARIABLES = { This variable contains a list of C source files to compile. """), + 'DEFINES': (StrictOrderingOnAppendList, list, [], + """Compiler defines to declare. + + Command line -D flags passed to the compiler. + """), + 'DIRS': (list, list, [], """Child directories to descend into looking for build frontend files. diff --git a/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build b/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build index 28477a684eee..0d5be204b1de 100644 --- a/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build +++ b/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build @@ -8,6 +8,9 @@ XPIDL_FLAGS = ['-Idir1', '-Idir2', '-Idir3'] ASFILES = ['bar.s', 'foo.asm'] +DEFINES = ['-Dbar', '-Dfoo'] + + SIMPLE_PROGRAMS = ['bar.x', 'foo.x'] CSRCS += ['bar.c', 'foo.c'] diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py index 55c7bfcaee22..59906957222f 100644 --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py @@ -146,6 +146,10 @@ class TestRecursiveMakeBackend(BackendTester): 'CSRCS += bar.c', 'CSRCS += foo.c', ], + 'DEFINES': [ + 'DEFINES += -Dbar', + 'DEFINES += -Dfoo', + ], 'SIMPLE_PROGRAMS': [ 'SIMPLE_PROGRAMS += bar.x', 'SIMPLE_PROGRAMS += foo.x', diff --git a/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build b/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build index 2e98f4097998..f1055de23217 100644 --- a/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build +++ b/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build @@ -8,6 +8,8 @@ XPIDL_FLAGS += ['-Idir1', '-Idir2', '-Idir3'] ASFILES += ['fans.asm', 'tans.s'] +DEFINES=['-Dfans', '-Dtans'] + SIMPLE_PROGRAMS += ['fans.x', 'tans.x'] CSRCS += ['fans.c', 'tans.c'] diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index d1b53673e046..c5a04d077a23 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -126,8 +126,9 @@ class TestEmitterBasic(unittest.TestCase): wanted = dict( ASFILES=['fans.asm', 'tans.s'], - SIMPLE_PROGRAMS=['fans.x', 'tans.x'], CSRCS=['fans.c', 'tans.c'], + DEFINES=['-Dfans', '-Dtans'], + SIMPLE_PROGRAMS=['fans.x', 'tans.x'], XPIDLSRCS=['bar.idl', 'biz.idl', 'foo.idl'], XPIDL_MODULE='module_name', XPIDL_FLAGS=['-Idir1', '-Idir2', '-Idir3'],