OLD | NEW |
1 # Copyright 2011 Google Inc. | 1 # Copyright 2011 Google Inc. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # "Makefile" replacement to build skia for Windows. | 6 # "Makefile" replacement to build skia for Windows. |
7 # More info at https://sites.google.com/site/skiadocs/ | 7 # More info at https://sites.google.com/site/skiadocs/ |
8 # | 8 # |
9 # Some usage examples: | 9 # Some usage examples: |
10 # make clean | 10 # make clean |
11 # make tests | 11 # make tests |
12 # make bench BUILDTYPE=Release | 12 # make bench BUILDTYPE=Release |
13 # make gm GYP_DEFINES=skia_scalar=fixed BUILDTYPE=Release | 13 # make gm GYP_DEFINES=skia_scalar=fixed BUILDTYPE=Release |
14 # make all | 14 # make all |
15 | 15 |
16 import os | 16 import os |
17 import shutil | 17 import shutil |
18 import sys | 18 import sys |
19 | 19 |
20 BUILDTYPE = 'Debug' | 20 BUILDTYPE = 'Debug' |
21 | 21 |
22 # special targets | 22 # special targets |
23 TARGET_ALL = 'all' | 23 TARGET_ALL = 'all' |
24 TARGET_CLEAN = 'clean' | 24 TARGET_CLEAN = 'clean' |
25 TARGET_DEFAULT = 'most' | 25 TARGET_DEFAULT = 'most' |
26 TARGET_GYP = 'gyp' | 26 TARGET_GYP = 'gyp' |
27 LIST_OF_ALL_TARGETS = ['SampleApp', 'bench', 'gm', 'tests', 'tools'] | |
28 | 27 |
29 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) | 28 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) |
30 OUT_SUBDIR = 'out' | 29 OUT_SUBDIR = 'out' |
31 GYP_SUBDIR = 'gyp' | 30 GYP_SUBDIR = 'gyp' |
32 | 31 |
33 | 32 |
34 # Simple functions that report what they are doing, and exit(1) on failure. | 33 # Simple functions that report what they are doing, and exit(1) on failure. |
35 def cd(path): | 34 def cd(path): |
36 print '> cd %s' % path | 35 print '> cd %s' % path |
37 if not os.path.isdir(path): | 36 if not os.path.isdir(path): |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 """ | 133 """ |
135 # handle any variable-setting parameters or special targets | 134 # handle any variable-setting parameters or special targets |
136 global BUILDTYPE | 135 global BUILDTYPE |
137 | 136 |
138 # if no targets were specified at all, make default target | 137 # if no targets were specified at all, make default target |
139 if not args: | 138 if not args: |
140 args = [TARGET_DEFAULT] | 139 args = [TARGET_DEFAULT] |
141 | 140 |
142 targets = [] | 141 targets = [] |
143 for arg in args: | 142 for arg in args: |
| 143 # If user requests "make all", chain to our explicitly-declared "everyth
ing" |
| 144 # target. See https://code.google.com/p/skia/issues/detail?id=932 ("gyp |
| 145 # automatically creates "all" target on some build flavors but not other
s") |
144 if arg == TARGET_ALL: | 146 if arg == TARGET_ALL: |
145 targets.extend(LIST_OF_ALL_TARGETS) | 147 targets.append('everything') |
146 elif arg == TARGET_CLEAN: | 148 elif arg == TARGET_CLEAN: |
147 MakeClean() | 149 MakeClean() |
148 elif arg.startswith('BUILDTYPE='): | 150 elif arg.startswith('BUILDTYPE='): |
149 BUILDTYPE = arg[10:] | 151 BUILDTYPE = arg[10:] |
150 elif arg.startswith('GYP_DEFINES='): | 152 elif arg.startswith('GYP_DEFINES='): |
151 os.environ['GYP_DEFINES'] = arg[12:] | 153 os.environ['GYP_DEFINES'] = arg[12:] |
152 else: | 154 else: |
153 targets.append(arg) | 155 targets.append(arg) |
154 | 156 |
155 # if there are no remaining targets, we're done | 157 # if there are no remaining targets, we're done |
(...skipping 21 matching lines...) Expand all Loading... |
177 print 'unknown platform (os.name=%s, sys.platform=%s); see %s' % ( | 179 print 'unknown platform (os.name=%s, sys.platform=%s); see %s' % ( |
178 os.name, sys.platform, 'https://sites.google.com/site/skiadocs/') | 180 os.name, sys.platform, 'https://sites.google.com/site/skiadocs/') |
179 sys.exit(1) | 181 sys.exit(1) |
180 sys.exit(0) | 182 sys.exit(0) |
181 | 183 |
182 | 184 |
183 # main() | 185 # main() |
184 Make(sys.argv[1:]) | 186 Make(sys.argv[1:]) |
185 | 187 |
186 ···· | 188 ···· |
OLD | NEW |