OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Notes: | 3 # Notes: |
4 # | 4 # |
5 # This is all roughly based on the Makefile system used by the Linux | 5 # This is all roughly based on the Makefile system used by the Linux |
6 # kernel, but is a non-recursive make -- we put the entire dependency | 6 # kernel, but is a non-recursive make -- we put the entire dependency |
7 # graph in front of make and let it figure it out. | 7 # graph in front of make and let it figure it out. |
8 # | 8 # |
9 # The code below generates a separate .mk file for each target, but | 9 # The code below generates a separate .mk file for each target, but |
10 # all are sourced by the top-level Makefile. This means that all | 10 # all are sourced by the top-level Makefile. This means that all |
(...skipping 14 matching lines...) Expand all Loading... |
25 import gyp.common | 25 import gyp.common |
26 import os.path | 26 import os.path |
27 | 27 |
28 # Debugging-related imports -- remove me once we're solid. | 28 # Debugging-related imports -- remove me once we're solid. |
29 import code | 29 import code |
30 import pprint | 30 import pprint |
31 | 31 |
32 generator_default_variables = { | 32 generator_default_variables = { |
33 'EXECUTABLE_PREFIX': '', | 33 'EXECUTABLE_PREFIX': '', |
34 'EXECUTABLE_SUFFIX': '', | 34 'EXECUTABLE_SUFFIX': '', |
35 'OS': 'linux', | 35 # 'OS': 'linux', |
36 'INTERMEDIATE_DIR': '$(obj)/geni', | 36 'INTERMEDIATE_DIR': '$(obj)/geni', |
37 'SHARED_INTERMEDIATE_DIR': '$(obj)/gen', | 37 'SHARED_INTERMEDIATE_DIR': '$(obj)/gen', |
38 'PRODUCT_DIR': '$(builddir)', | 38 'PRODUCT_DIR': '$(builddir)', |
39 'RULE_INPUT_ROOT': '%(INPUT_ROOT)s', # This gets expanded by Python. | 39 'RULE_INPUT_ROOT': '%(INPUT_ROOT)s', # This gets expanded by Python. |
40 'RULE_INPUT_PATH': '$<', | 40 'RULE_INPUT_PATH': '$<', |
41 | 41 |
42 # These appear unused -- ??? | 42 # These appear unused -- ??? |
43 'RULE_INPUT_EXT': 'XXXEXT$(suffix $^)', | 43 'RULE_INPUT_EXT': 'XXXEXT$(suffix $^)', |
44 'RULE_INPUT_NAME': 'XXXNAME$(notdir $(basename $^)0', | 44 'RULE_INPUT_NAME': 'XXXNAME$(notdir $(basename $^)0', |
45 'CONFIGURATION_NAME': '$(BUILDTYPE)', | 45 'CONFIGURATION_NAME': '$(BUILDTYPE)', |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 if extra_outputs: | 607 if extra_outputs: |
608 self.WriteMakeRule([self.output], extra_outputs, | 608 self.WriteMakeRule([self.output], extra_outputs, |
609 comment = 'Build our special outputs first.', | 609 comment = 'Build our special outputs first.', |
610 order_only = True) | 610 order_only = True) |
611 | 611 |
612 if self.type not in ('settings', 'none'): | 612 if self.type not in ('settings', 'none'): |
613 for configname in sorted(configs.keys()): | 613 for configname in sorted(configs.keys()): |
614 config = configs[configname] | 614 config = configs[configname] |
615 self.WriteList(config.get('ldflags'), 'LDFLAGS_%s' % configname) | 615 self.WriteList(config.get('ldflags'), 'LDFLAGS_%s' % configname) |
616 self.WriteList(spec.get('libraries'), 'LIBS') | 616 self.WriteList(spec.get('libraries'), 'LIBS') |
617 self.WriteLn('%s: LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) ' | 617 self.WriteLn('%s: LDFLAGS := $(LDFLAGS_$(BUILDTYPE))' % self.output) |
618 '$(LIBS)' % self.output) | 618 self.WriteLn('%s: LIBS := $(LIBS)' % self.output) |
619 | 619 |
620 if self.type == 'executable': | 620 if self.type == 'executable': |
621 self.WriteDoCmd([self.output], link_deps, 'link') | 621 self.WriteDoCmd([self.output], link_deps, 'link') |
622 elif self.type == 'static_library': | 622 elif self.type == 'static_library': |
623 self.WriteDoCmd([self.output], link_deps, 'alink') | 623 self.WriteDoCmd([self.output], link_deps, 'alink') |
624 elif self.type in ('loadable_module', 'shared_library'): | 624 elif self.type in ('loadable_module', 'shared_library'): |
625 self.WriteDoCmd([self.output], link_deps, 'solink') | 625 self.WriteDoCmd([self.output], link_deps, 'solink') |
626 elif self.type == 'none': | 626 elif self.type == 'none': |
627 # Write a stamp line. | 627 # Write a stamp line. |
628 self.WriteDoCmd([self.output], deps, 'touch') | 628 self.WriteDoCmd([self.output], deps, 'touch') |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 writer.Write(qualified_target, output_file, options.depth, spec, configs) | 776 writer.Write(qualified_target, output_file, options.depth, spec, configs) |
777 | 777 |
778 # Our root_makefile lives at the source root. Compute the relative path | 778 # Our root_makefile lives at the source root. Compute the relative path |
779 # from there to the output_file for including. | 779 # from there to the output_file for including. |
780 submakefile_path = gyp.common.RelativePath(output_file, options.depth) | 780 submakefile_path = gyp.common.RelativePath(output_file, options.depth) |
781 root_makefile.write('include ' + submakefile_path + "\n") | 781 root_makefile.write('include ' + submakefile_path + "\n") |
782 | 782 |
783 root_makefile.write(SHARED_FOOTER) | 783 root_makefile.write(SHARED_FOOTER) |
784 | 784 |
785 root_makefile.close() | 785 root_makefile.close() |
OLD | NEW |