forked from OSchip/llvm-project
Fixed ninja build issues relating to use of $(DESTDIR)
We use ${DESTDIR} syntax now instead of $(DESTDIR) because that syntax works both is the shell (at least it does for bash) and for make (at least it does for GNU Make) Patch By: Dan Liew llvm-svn: 200414
This commit is contained in:
parent
ac0fb621ce
commit
91d51db800
libclc
|
@ -8,6 +8,7 @@ use Python.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
import re
|
||||||
|
|
||||||
class Writer(object):
|
class Writer(object):
|
||||||
def __init__(self, output, width=78):
|
def __init__(self, output, width=78):
|
||||||
|
@ -31,7 +32,7 @@ class Writer(object):
|
||||||
def rule(self, name, command, description=None, depfile=None,
|
def rule(self, name, command, description=None, depfile=None,
|
||||||
generator=False):
|
generator=False):
|
||||||
self._line('rule %s' % name)
|
self._line('rule %s' % name)
|
||||||
self.variable('command', command, indent=1)
|
self.variable('command', escape(command), indent=1)
|
||||||
if description:
|
if description:
|
||||||
self.variable('description', description, indent=1)
|
self.variable('description', description, indent=1)
|
||||||
if depfile:
|
if depfile:
|
||||||
|
@ -103,8 +104,15 @@ class Writer(object):
|
||||||
|
|
||||||
|
|
||||||
def escape(string):
|
def escape(string):
|
||||||
"""Escape a string such that it can be embedded into a Ninja file without
|
"""Escape a string such that Makefile and shell variables are
|
||||||
further interpretation."""
|
correctly escaped for use in a Ninja file.
|
||||||
|
"""
|
||||||
assert '\n' not in string, 'Ninja syntax does not allow newlines'
|
assert '\n' not in string, 'Ninja syntax does not allow newlines'
|
||||||
# We only have one special metacharacter: '$'.
|
# We only have one special metacharacter: '$'.
|
||||||
return string.replace('$', '$$')
|
|
||||||
|
# We should leave $in and $out untouched.
|
||||||
|
# Just look for makefile/shell style substitutions
|
||||||
|
return re.sub(r'(\$[{(][a-z_]+[})])',
|
||||||
|
r'$\1',
|
||||||
|
string,
|
||||||
|
flags=re.IGNORECASE)
|
||||||
|
|
|
@ -220,15 +220,15 @@ for target in targets:
|
||||||
b.default(builtins_bc)
|
b.default(builtins_bc)
|
||||||
|
|
||||||
|
|
||||||
install_cmd = ' && '.join(['mkdir -p $(DESTDIR)/%(dst)s && cp -r %(src)s $(DESTDIR)/%(dst)s' %
|
install_cmd = ' && '.join(['mkdir -p ${DESTDIR}/%(dst)s && cp -r %(src)s ${DESTDIR}/%(dst)s' %
|
||||||
{'src': file,
|
{'src': file,
|
||||||
'dst': libexecdir}
|
'dst': libexecdir}
|
||||||
for (file, dest) in install_files_bc])
|
for (file, dest) in install_files_bc])
|
||||||
install_cmd = ' && '.join(['%(old)s && mkdir -p $(DESTDIR)/%(dst)s && cp -r %(srcdir)s/generic/include/clc $(DESTDIR)/%(dst)s' %
|
install_cmd = ' && '.join(['%(old)s && mkdir -p ${DESTDIR}/%(dst)s && cp -r %(srcdir)s/generic/include/clc ${DESTDIR}/%(dst)s' %
|
||||||
{'old': install_cmd,
|
{'old': install_cmd,
|
||||||
'dst': includedir,
|
'dst': includedir,
|
||||||
'srcdir': srcdir}])
|
'srcdir': srcdir}])
|
||||||
install_cmd = ' && '.join(['%(old)s && mkdir -p $(DESTDIR)/%(dst)s && cp -r libclc.pc $(DESTDIR)/%(dst)s' %
|
install_cmd = ' && '.join(['%(old)s && mkdir -p ${DESTDIR}/%(dst)s && cp -r libclc.pc ${DESTDIR}/%(dst)s' %
|
||||||
{'old': install_cmd,
|
{'old': install_cmd,
|
||||||
'dst': pkgconfigdir}])
|
'dst': pkgconfigdir}])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue