2013-02-14 16:06:16 +04:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2013-03-19 09:29:48 +04:00
|
|
|
import errno
|
2013-03-19 09:59:53 +04:00
|
|
|
import os
|
2013-03-19 09:29:48 +04:00
|
|
|
|
2013-02-14 16:06:16 +04:00
|
|
|
dependencies = []
|
|
|
|
targets = []
|
|
|
|
|
|
|
|
def makeQuote(filename):
|
|
|
|
return filename.replace(' ', '\\ ') # enjoy!
|
|
|
|
|
|
|
|
def writeMakeDependOutput(filename):
|
|
|
|
print "Creating makedepend file", filename
|
2013-03-19 09:29:48 +04:00
|
|
|
dir = os.path.dirname(filename)
|
|
|
|
if dir and not os.path.exists(dir):
|
|
|
|
try:
|
|
|
|
os.makedirs(dir)
|
|
|
|
except OSError as error:
|
|
|
|
if error.errno != errno.EEXIST:
|
|
|
|
raise
|
|
|
|
|
2013-02-14 16:06:16 +04:00
|
|
|
with open(filename, 'w') as f:
|
|
|
|
if len(targets) > 0:
|
|
|
|
f.write("%s:" % makeQuote(targets[0]))
|
|
|
|
for filename in dependencies:
|
|
|
|
f.write(' \\\n\t\t%s' % makeQuote(filename))
|
2013-04-10 02:10:25 +04:00
|
|
|
f.write('\n')
|
2013-02-14 16:06:16 +04:00
|
|
|
for filename in targets[1:]:
|
|
|
|
f.write('%s: %s\n' % (makeQuote(filename), makeQuote(targets[0])))
|
2013-04-10 02:10:25 +04:00
|
|
|
for filename in dependencies:
|
|
|
|
f.write('%s:\n' % filename)
|
2013-02-14 16:06:16 +04:00
|
|
|
|