OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 Google Inc. All rights reserved. | 3 # Copyright (c) 2011 Google Inc. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Notes: | 7 # Notes: |
8 # | 8 # |
9 # This is all roughly based on the Makefile system used by the Linux | 9 # This is all roughly based on the Makefile system used by the Linux |
10 # kernel, but is a non-recursive make -- we put the entire dependency | 10 # kernel, but is a non-recursive make -- we put the entire dependency |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 # .d files contain """ + SPACE_REPLACEMENT + \ | 361 # .d files contain """ + SPACE_REPLACEMENT + \ |
362 """ instead of spaces, take that into account. | 362 """ instead of spaces, take that into account. |
363 command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\\ | 363 command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\\ |
364 $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) | 364 $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) |
365 | 365 |
366 # Helper that is non-empty when a prerequisite changes. | 366 # Helper that is non-empty when a prerequisite changes. |
367 # Normally make does this implicitly, but we force rules to always run | 367 # Normally make does this implicitly, but we force rules to always run |
368 # so we can check their command lines. | 368 # so we can check their command lines. |
369 # $? -- new prerequisites | 369 # $? -- new prerequisites |
370 # $| -- order-only dependencies | 370 # $| -- order-only dependencies |
371 prereq_changed = $(filter-out $|,$?) | 371 prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) |
372 | 372 |
373 # do_cmd: run a command via the above cmd_foo names, if necessary. | 373 # do_cmd: run a command via the above cmd_foo names, if necessary. |
374 # Should always run for a given target to handle command-line changes. | 374 # Should always run for a given target to handle command-line changes. |
375 # Second argument, if non-zero, makes it do asm/C/C++ dependency munging. | 375 # Second argument, if non-zero, makes it do asm/C/C++ dependency munging. |
376 # Note: We intentionally do NOT call dirx for depfile, since it contains """ + \ | 376 # Note: We intentionally do NOT call dirx for depfile, since it contains """ + \ |
377 SPACE_REPLACEMENT + """ for | 377 SPACE_REPLACEMENT + """ for |
378 # spaces already and dirx strips the """ + SPACE_REPLACEMENT + \ | 378 # spaces already and dirx strips the """ + SPACE_REPLACEMENT + \ |
379 """ characters. | 379 """ characters. |
380 define do_cmd | 380 define do_cmd |
381 $(if $(or $(command_changed),$(prereq_changed)), | 381 $(if $(or $(command_changed),$(prereq_changed)), |
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 # Add a check to make sure we tried to process all the .d files. | 2445 # Add a check to make sure we tried to process all the .d files. |
2446 all_deps += """ | 2446 all_deps += """ |
2447 ifneq ($(word %(last)d,$(d_files)),) | 2447 ifneq ($(word %(last)d,$(d_files)),) |
2448 $(error Found unprocessed dependency files (gyp didn't generate enough rules
!)) | 2448 $(error Found unprocessed dependency files (gyp didn't generate enough rules
!)) |
2449 endif | 2449 endif |
2450 """ % { 'last': ((num_outputs / 1000) + 1) * 1000 + 1 } | 2450 """ % { 'last': ((num_outputs / 1000) + 1) * 1000 + 1 } |
2451 | 2451 |
2452 root_makefile.write(SHARED_FOOTER % { 'generate_all_deps': all_deps }) | 2452 root_makefile.write(SHARED_FOOTER % { 'generate_all_deps': all_deps }) |
2453 | 2453 |
2454 root_makefile.close() | 2454 root_makefile.close() |
OLD | NEW |