Make recursivemake backend output a srcdir_rel variable in each Makefile draft
authorTed Mielczarek <ted@mielczarek.org>
Wed, 06 Sep 2017 15:15:52 -0400
changeset 664873 d5e3d1d4c9184f323c3a72d621ccef13ff0b5315
parent 664872 e3baad5e1bddd36ab635816a8ee1458442b0ee0b
child 664874 d0cb387a7364d55c8758fe1f9e9c9d34713815dc
push id79836
push userbmo:ted@mielczarek.org
push dateThu, 14 Sep 2017 14:29:42 +0000
milestone57.0a1
Make recursivemake backend output a srcdir_rel variable in each Makefile MozReview-Commit-ID: JHEuxamDi5f
python/mozbuild/mozbuild/backend/base.py
python/mozbuild/mozbuild/backend/recursivemake.py
--- a/python/mozbuild/mozbuild/backend/base.py
+++ b/python/mozbuild/mozbuild/backend/base.py
@@ -255,16 +255,17 @@ class BuildBackend(LoggingMixin):
             for k, v in obj.config.substs.iteritems()
         })
         pp.context.update(
             top_srcdir=obj.topsrcdir,
             top_srcdir_win=mozpath.win_path(obj.topsrcdir),
             topsrcdir_rel=mozpath.relpath(obj.topsrcdir, mozpath.dirname(obj.output_path)),
             topobjdir=obj.topobjdir,
             srcdir=srcdir,
+            srcdir_rel=mozpath.relpath(srcdir, mozpath.dirname(obj.output_path)),
             relativesrcdir=mozpath.relpath(srcdir, obj.topsrcdir) or '.',
             DEPTH=mozpath.relpath(obj.topobjdir, mozpath.dirname(obj.output_path)) or '.',
         )
         pp.do_filter('attemptSubstitution')
         pp.setMarker(None)
         with self._write_file(obj.output_path) as fh:
             pp.out = fh
             yield pp
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -1512,16 +1512,17 @@ class RecursiveMakeBackend(CommonBackend
             if not pp.context.get('autoconfmk', ''):
                 pp.context['autoconfmk'] = 'autoconf.mk'
             pp.handleLine(b'# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.\n');
             pp.handleLine(b'DEPTH := @DEPTH@\n')
             pp.handleLine(b'topobjdir := @topobjdir@\n')
             pp.handleLine(b'topsrcdir := @top_srcdir@\n')
             pp.handleLine(b'topsrcdir_rel := @topsrcdir_rel@\n')
             pp.handleLine(b'srcdir := @srcdir@\n')
+            pp.handleLine(b'srcdir_rel := @srcdir_rel@\n')
             pp.handleLine(b'VPATH := @srcdir_rel@\n')
             pp.handleLine(b'relativesrcdir := @relativesrcdir@\n')
             pp.handleLine(b'include $(DEPTH)/config/@autoconfmk@\n')
             if not stub:
                 pp.do_include(obj.input_path)
             # Empty line to avoid failures when last line in Makefile.in ends
             # with a backslash.
             pp.handleLine(b'\n')