Index: grit/tool/build.py |
=================================================================== |
--- grit/tool/build.py (revision 141) |
+++ grit/tool/build.py (working copy) |
@@ -98,8 +98,9 @@ |
first_ids_file = None |
whitelist_filenames = [] |
target_platform = None |
- dep_dir = None |
- (own_opts, args) = getopt.getopt(args, 'o:D:E:f:w:t:', ('dep-dir=',)) |
+ depfile = None |
+ depdir = None |
+ (own_opts, args) = getopt.getopt(args, 'o:D:E:f:w:t:', ('depdir=','depfile=')) |
for (key, val) in own_opts: |
if key == '-o': |
self.output_directory = val |
@@ -118,8 +119,10 @@ |
whitelist_filenames.append(val) |
elif key == '-t': |
target_platform = val |
- elif key == '--dep-dir': |
- dep_dir = val |
+ elif key == '--depdir': |
+ depdir = val |
+ elif key == '--depfile': |
+ depfile = val |
if len(args): |
print 'This tool takes no tool-specific arguments.' |
@@ -151,8 +154,8 @@ |
self.res.RunGatherers() |
self.Process() |
- if dep_dir: |
- self.GenerateDepfile(opts.input, dep_dir) |
+ if depfile and depdir: |
+ self.GenerateDepfile(opts.input, depfile, depdir) |
return 0 |
@@ -310,11 +313,10 @@ |
print self.res.UberClique().missing_translations_ |
sys.exit(-1) |
- def GenerateDepfile(self, input_filename, dep_dir): |
+ def GenerateDepfile(self, input_filename, depfile, depdir): |
'''Generate a depfile that contains the imlicit dependencies of the input |
grd. The depfile will be in the same format as a makefile, and will contain |
- references to files relative to |dep_dir|. It will be put in the same |
- directory as the generated outputs. |
+ references to files relative to |depdir|. It will be put in |depfile|. |
For example, supposing we have three files in a directory src/ |
@@ -325,23 +327,21 @@ |
and we run |
- grit -i blah.grd -o ../out/gen --dep-dir ../out |
+ grit -i blah.grd -o ../out/gen --depdir ../out --depfile ../out/gen/blah.rd.d |
from the directory src/ we will generate a depfile ../out/gen/blah.grd.d |
that has the contents |
gen/blah.grd.d: ../src/input1.xtb ../src/input2.xtb |
- Note that all paths in the depfile are relative to ../out, the dep-dir. |
+ Note that all paths in the depfile are relative to ../out, the depdir. |
''' |
- depsfile_basename = os.path.basename(input_filename + '.d') |
- depfile = os.path.abspath( |
- os.path.join(self.output_directory, depsfile_basename)) |
- dep_dir = os.path.abspath(dep_dir) |
+ depfile = os.path.abspath(depfile) |
+ depdir = os.path.abspath(depdir) |
# The path prefix to prepend to dependencies in the depfile. |
- prefix = os.path.relpath(os.getcwd(), dep_dir) |
+ prefix = os.path.relpath(os.getcwd(), depdir) |
# The path that the depfile refers to itself by. |
- self_ref_depfile = os.path.relpath(depfile, dep_dir) |
+ self_ref_depfile = os.path.relpath(depfile, depdir) |
infiles = self.res.GetInputFiles() |
deps_text = ' '.join([os.path.join(prefix, i) for i in infiles]) |
depfile_contents = self_ref_depfile + ': ' + deps_text |