Make recursivemake backend output a srcdir_rel variable in each Makefile
MozReview-Commit-ID: JHEuxamDi5f
--- 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')