TextMate is a graphical text editor for OS X 10.7+
Revisión | 218551185bc1724caffbb15e0b428b726e6fd253 (tree) |
---|---|
Tiempo | 2012-08-16 06:23:24 |
Autor | Allan Odgaard <git@abet...> |
Commiter | Allan Odgaard |
Add gdb targets to build.ninja
Since ninja run each build job with its own stdin/out/err we can’t launch gdb itself in a build job, so we use osascript to launch gdb in a new window.
I used Terminal for this only because it is simpler to script than iTerm2.
@@ -444,10 +444,12 @@ def static_executable(target) | ||
444 | 444 | libs = prepend('-l', all_values_for_key(target, 'LIBS')) |
445 | 445 | res << " RAVE_FLAGS = #{fws} #{libs}\n" |
446 | 446 | |
447 | - res << "build #{dst}.run: run_executable #{dst}\n" | |
447 | + res << "build #{dst}.run: run_executable #{dst}\n" | |
448 | + res << "build #{dst}.debug: debug_executable #{dst}\n" | |
448 | 449 | |
449 | - res << "build #{target[:name]}: phony #{dst}\n" | |
450 | - res << "build #{target[:name]}/run: phony #{dst}.run\n" | |
450 | + res << "build #{target[:name]}: phony #{dst}\n" | |
451 | + res << "build #{target[:name]}/run: phony #{dst}.run\n" | |
452 | + res << "build #{target[:name]}/debug: phony #{dst}.debug\n" | |
451 | 453 | |
452 | 454 | res |
453 | 455 | end |
@@ -510,12 +512,14 @@ def app_bundle(target) | ||
510 | 512 | |
511 | 513 | res << "build #{dst}: phony | #{deps.join(' ')}\n" |
512 | 514 | |
513 | - res << "build #{dst}.sign: sign_executable #{dst}\n" | |
514 | - res << "build #{dst}.run: run_application #{dst} | #{dst}.sign\n" | |
515 | + res << "build #{dst}.sign: sign_executable #{dst}\n" | |
516 | + res << "build #{dst}.run: run_application #{dst} | #{dst}.sign\n" | |
515 | 517 | res << " appname = #{target[:name]}\n" |
518 | + res << "build #{dst}.debug: debug_executable #{dst}/Contents/MacOS/#{target[:name]}\n" | |
516 | 519 | |
517 | - res << "build #{target[:name]}: phony #{dst}.sign\n" | |
518 | - res << "build #{target[:name]}/run: phony #{dst}.run\n" | |
520 | + res << "build #{target[:name]}: phony #{dst}.sign\n" | |
521 | + res << "build #{target[:name]}/run: phony #{dst}.run\n" | |
522 | + res << "build #{target[:name]}/debug: phony #{dst}.debug\n" | |
519 | 523 | |
520 | 524 | target[:rsrc_info] = all_files |
521 | 525 |
@@ -662,6 +666,7 @@ open("#{builddir}/build.ninja", "w") do |io| | ||
662 | 666 | io << "\n" |
663 | 667 | io << "build run: phony #{variables.find { |k, _| k == 'APP_NAME' }.last}/run\n" |
664 | 668 | io << "build deploy: phony #{variables.find { |k, _| k == 'APP_NAME' }.last}/deploy\n" |
669 | + io << "build debug: phony #{variables.find { |k, _| k == 'APP_NAME' }.last}/debug\n" | |
665 | 670 | io << "default run\n" |
666 | 671 | end |
667 | 672 |
@@ -712,6 +717,10 @@ rule run_executable | ||
712 | 717 | command = $in |
713 | 718 | description = Run ‘$in’… |
714 | 719 | |
720 | +rule debug_executable | |
721 | + command = osascript >/dev/null -e $$'tell app "Terminal" \n activate \n do script "gdb $in" \n end tell' | |
722 | + description = Debug ‘$in’… | |
723 | + | |
715 | 724 | rule run_application |
716 | 725 | command = { $ |
717 | 726 | if pgrep -q "$appname"; then $ |