Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | # You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | import errno |
michael@0 | 6 | import os |
michael@0 | 7 | |
michael@0 | 8 | dependencies = [] |
michael@0 | 9 | targets = [] |
michael@0 | 10 | |
michael@0 | 11 | def makeQuote(filename): |
michael@0 | 12 | return filename.replace(' ', '\\ ') # enjoy! |
michael@0 | 13 | |
michael@0 | 14 | def writeMakeDependOutput(filename): |
michael@0 | 15 | print "Creating makedepend file", filename |
michael@0 | 16 | dir = os.path.dirname(filename) |
michael@0 | 17 | if dir and not os.path.exists(dir): |
michael@0 | 18 | try: |
michael@0 | 19 | os.makedirs(dir) |
michael@0 | 20 | except OSError as error: |
michael@0 | 21 | if error.errno != errno.EEXIST: |
michael@0 | 22 | raise |
michael@0 | 23 | |
michael@0 | 24 | with open(filename, 'w') as f: |
michael@0 | 25 | if len(targets) > 0: |
michael@0 | 26 | f.write("%s:" % makeQuote(targets[0])) |
michael@0 | 27 | for filename in dependencies: |
michael@0 | 28 | f.write(' \\\n\t\t%s' % makeQuote(filename)) |
michael@0 | 29 | f.write('\n') |
michael@0 | 30 | for filename in targets[1:]: |
michael@0 | 31 | f.write('%s: %s\n' % (makeQuote(filename), makeQuote(targets[0]))) |
michael@0 | 32 | for filename in dependencies: |
michael@0 | 33 | f.write('%s:\n' % filename) |
michael@0 | 34 |