523
523
BOOL_OPTIONS=" "
524
524
VAL_OPTIONS=" "
525
525
526
+ opt debug 0 " debug mode"
526
527
opt valgrind 0 " run tests with valgrind (memcheck by default)"
527
528
opt helgrind 0 " run tests with helgrind instead of memcheck"
528
529
opt valgrind-rpass 1 " run rpass-valgrind tests with valgrind"
529
530
opt docs 1 " build standard library documentation"
530
531
opt compiler-docs 0 " build compiler documentation"
531
- opt optimize 1 " build optimized rust code"
532
- opt optimize-cxx 1 " build optimized C++ code"
533
- opt optimize-llvm 1 " build optimized LLVM"
534
532
opt optimize-tests 1 " build tests with optimizations"
535
533
opt libcpp 1 " build with llvm with libc++ instead of libstdc++ when using clang"
536
534
opt llvm-assertions 0 " build LLVM with assertions"
537
535
opt debug-assertions 0 " build with debugging assertions"
538
- opt debuginfo 0 " build with debugger metadata"
539
536
opt fast-make 0 " use .gitmodules as timestamp for submodule deps"
540
537
opt ccache 0 " invoke gcc/clang via ccache to reuse object files between builds"
541
538
opt local-rust 0 " use an installed rustc rather than downloading a snapshot"
@@ -546,6 +543,14 @@ opt dist-host-only 0 "only install bins for the host architecture"
546
543
opt inject-std-version 1 " inject the current compiler version of libstd into programs"
547
544
opt llvm-version-check 1 " don't check if the LLVM version is supported, build anyway"
548
545
546
+ # Optimization and debugging options. These may be overridden by the release channel, etc.
547
+ opt_nosave optimize 1 " build optimized rust code"
548
+ opt_nosave optimize-cxx 1 " build optimized C++ code"
549
+ opt_nosave optimize-llvm 1 " build optimized LLVM"
550
+ opt_nosave llvm-assertions 0 " build LLVM with assertions"
551
+ opt_nosave debug-assertions 0 " build with debugging assertions"
552
+ opt_nosave debuginfo 0 " build with debugger metadata"
553
+
549
554
valopt localstatedir " /var/lib" " local state directory"
550
555
valopt sysconfdir " /etc" " install system configuration files"
551
556
@@ -620,6 +625,24 @@ case "$CFG_RELEASE_CHANNEL" in
620
625
;;
621
626
esac
622
627
628
+ # Adjust perf and debug options for debug mode
629
+ if [ -n " $CFG_ENABLE_DEBUG " ]; then
630
+ msg " debug mode enabled, setting performance options"
631
+ CFG_DISABLE_OPTIMIZE=1
632
+ CFG_DISABLE_OPTIMIZE_CXX=1
633
+ CFG_DISABLE_OPTIMIZE_LLVM=1
634
+ CFG_ENABLE_LLVM_ASSERTIONS=1
635
+ CFG_ENABLE_DEBUG_ASSERTIONS=1
636
+ fi
637
+
638
+ # OK, now write the debugging options
639
+ if [ -n " $CFG_DISABLE_OPTIMIZE " ]; then putvar CFG_DISABLE_OPTIMIZE; fi
640
+ if [ -n " $CFG_DISABLE_OPTIMIZE_CXX " ]; then putvar CFG_DISABLE_OPTIMIZE_CXX; fi
641
+ if [ -n " $CFG_DISABLE_OPTIMIZE_LLVM " ]; then putvar CFG_DISABLE_OPTIMIZE_LLVM; fi
642
+ if [ -n " $CFG_ENABLE_LLVM_ASSERTIONS " ]; then putvar CFG_ENABLE_LLVM_ASSERTIONS; fi
643
+ if [ -n " $CFG_ENABLE_DEBUG_ASSERTIONS " ]; then putvar CFG_ENABLE_DEBUG_ASSERTIONS; fi
644
+ if [ -n " $CFG_ENABLE_DEBUGINFO " ]; then putvar CFG_ENABLE_DEBUGINFO; fi
645
+
623
646
# A magic value that allows the compiler to use unstable features
624
647
# during the bootstrap even when doing so would normally be an error
625
648
# because of feature staging or because the build turns on
@@ -1425,6 +1448,11 @@ move_if_changed config.tmp config.mk
1425
1448
rm -f config.tmp
1426
1449
touch config.stamp
1427
1450
1428
- step_msg " complete"
1451
+ if [ -z " $CFG_ENABLE_DEBUG " ]; then
1452
+ step_msg " configured in release mode. for development consider --enable-debug"
1453
+ else
1454
+ step_msg " complete"
1455
+ fi
1456
+
1429
1457
msg " run \` make help\` "
1430
1458
msg
0 commit comments