gnu autotools:调试/释放目标? [英] gnu autotools: Debug/Release targets?
问题描述
我一直在寻找一段时间:我目前正在将一个中型程序转换为autotools,来自基于eclipse的方法(使用makefiles)
我总是习惯于使用具有所有调试符号和无优化的调试版本,以及没有调试符号和最佳优化的发布版本。
现在我想用autotools以某种方式复制这个,所以我可以(可能)做类似的操作:
./ configure
make debug
这将有所有调试符号和没有优化,其中:
./ configure
make
会导致release版本(默认)
PS:我已经阅读过--enable -debug标志/功能,但在我目前的(简单)设置中,使用
配置 c 向 configure.in
或 configure.ac
文件中添加一个子句; / p>
AC_ARG_ENABLE(debug,
AS_HELP_STRING([ - enable-debug],
[enable debugging,default :no]),
[case$ {enableval}in
yes)debug = true ;;
no)debug = false ;;
*)AC_MSG_ERROR([bad value $ {enableval} for --enable-debug]);;
esac],
[debug = false])
AM_CONDITIONAL(DEBUG,test x$ debug= xtrue)
现在在 Makefile.in
或 Makefile.am
;
如果DEBUG
AM_CFLAGS = -g3 -O0
AM_CXXFLAGS = g3 -O0
else
AM_CFLAGS = -O2
AM_CXXFLAGS = -O2
endif
因此,当启用 debug
时,您可以修改 {C / CXX} FLAGS
启用调试信息。
I've been looking for this for a while: I'm currently converting a medium-size program to autotools, coming from an eclipse-based method (with makefiles)
I'm always used to having a "debug" build, with all debug symbols and no optimizations, and a "release" build, without debug symbols and best optimizations.
Now I'm trying to replicate this in some way with autotools, so I can (perhaps) do something like:
./configure
make debug
Which would have all debug symbols and no optimizations, and where:
./configure
make
Would result in the "release" version (default)
PS: I've read about the --enable-debug flag/feature, but in my current (simple) setup, using that is unrecognized by configure
解决方案 Add a clause to your configure.in
or configure.ac
file;
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[enable debugging, default: no]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],
[debug=false])
AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
Now in your Makefile.in
or Makefile.am
;
if DEBUG
AM_CFLAGS = -g3 -O0
AM_CXXFLAGS = -g3 -O0
else
AM_CFLAGS = -O2
AM_CXXFLAGS = -O2
endif
So when debug
is enabled you can modify your {C/CXX}FLAGS
to enable debug information.
这篇关于gnu autotools:调试/释放目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文