~ubuntu-branches/ubuntu/trusty/python3.4/trusty-proposed

« back to all changes in this revision

Viewing changes to Tools/freeze/makemakefile.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-11-25 09:44:27 UTC
  • Revision ID: package-import@ubuntu.com-20131125094427-lzxj8ap5w01lmo7f
Tags: upstream-3.4~b1
ImportĀ upstreamĀ versionĀ 3.4~b1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Write the actual Makefile.
 
2
 
 
3
import os
 
4
 
 
5
def makemakefile(outfp, makevars, files, target):
 
6
    outfp.write("# Makefile generated by freeze.py script\n\n")
 
7
 
 
8
    keys = sorted(makevars.keys())
 
9
    for key in keys:
 
10
        outfp.write("%s=%s\n" % (key, makevars[key]))
 
11
    outfp.write("\nall: %s\n\n" % target)
 
12
 
 
13
    deps = []
 
14
    for i in range(len(files)):
 
15
        file = files[i]
 
16
        if file[-2:] == '.c':
 
17
            base = os.path.basename(file)
 
18
            dest = base[:-2] + '.o'
 
19
            outfp.write("%s: %s\n" % (dest, file))
 
20
            outfp.write("\t$(CC) $(CFLAGS) $(CPPFLAGS) -c %s\n" % file)
 
21
            files[i] = dest
 
22
            deps.append(dest)
 
23
 
 
24
    outfp.write("\n%s: %s\n" % (target, ' '.join(deps)))
 
25
    outfp.write("\t$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) %s -o %s $(LDLAST)\n" %
 
26
                (' '.join(files), target))
 
27
 
 
28
    outfp.write("\nclean:\n\t-rm -f *.o %s\n" % target)