如何让automake不那么难看?

发布于 2024-09-02 16:31:38 字数 484 浏览 2 评论 0 原文

我最近学会了如何使用 automake,我有点恼火的是,我的编译命令从一堆:

g++ -O2 -Wall -c fileName.cpp

变成了一堆:

depbase=`echo src/Unit.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I./src     -g -O2 -MT src/Unit.o -MD -MP -MF $depbase.Tpo -c -o src/Unit.o src/Unit.cpp &&\
    mv -f $depbase.Tpo $depbase.Po

有什么方法可以清理它吗?我通常可以轻松地找出警告消息,但现在要阅读的文本墙扩大了 3 倍,而且更加奇怪。

我知道我的标志是什么,所以让它只为每个文件显示“编译 xxx.cpp”将是完美的。

I recently learned how to use automake, and I'm somewhat annoyed that my compile commands went from a bunch of:

g++ -O2 -Wall -c fileName.cpp

To a bunch of:

depbase=`echo src/Unit.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I./src     -g -O2 -MT src/Unit.o -MD -MP -MF $depbase.Tpo -c -o src/Unit.o src/Unit.cpp &&\
    mv -f $depbase.Tpo $depbase.Po

Is there any way to clean this up? I can usually easily pick out warning messages, but now the wall of text to read though is 3x bigger and much weirder.

I know what my flags are, so making it just says "Compiling xxx.cpp" for each file would be perfect.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

—━☆沉默づ 2024-09-09 16:31:40

从 automake 1.11 开始,您可以使用silent-rules 选项极大地清理输出。例如:

$ # First, make without silent rules
$ make
make  all-am
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT foo.o -MD -MP -MF .deps/foo.Tpo -c -o foo.o foo.c
mv -f .deps/foo.Tpo .deps/foo.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2   -o foo foo.o
libtool: link: gcc -g -O2 -o foo foo.o
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT bar.o -MD -MP -MF .deps/bar.Tpo -c -o bar.o bar.c
mv -f .deps/bar.Tpo .deps/bar.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2   -o bar bar.o
libtool: link: gcc -g -O2 -o bar bar.o
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT baz.o -MD -MP -MF .deps/baz.Tpo -c -o baz.o baz.c
mv -f .deps/baz.Tpo .deps/baz.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2   -o baz baz.o
libtool: link: gcc -g -O2 -o baz baz.o
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT qux.o -MD -MP -MF .deps/qux.Tpo -c -o qux.o qux.c
mv -f .deps/qux.Tpo .deps/qux.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2   -o qux qux.o
libtool: link: gcc -g -O2 -o qux qux.o
$ # Now, use the silent rules
$ ./configure --enable-silent-rules > /dev/null
$ make clean all
 rm -f foo bar baz qux
rm -rf .libs _libs
rm -f *.o
rm -f *.lo
make  all-am
  CC       foo.o
  CCLD     foo
  CC       bar.o
  CCLD     bar
  CC       baz.o
  CCLD     baz
  CC       qux.o
  CCLD     qux

所需要做的就是将“silent-rules”添加到调用中
在configure.ac中添加AM_INIT_AUTOMAKE,并添加该选项
--enable-silent-rules 当您调用配置时。 (那里
关于是否需要添加该选项存在很多争论
在配置时添加此功能,并且有
是一个简单的解决方法,可以使其变得不必要。)请注意
启用静默规则后,您仍然可以得到详细信息
通过运行“make V=1”输出

As of automake 1.11, you can greatly clean up the output using the silent-rules option. For example:

$ # First, make without silent rules
$ make
make  all-am
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT foo.o -MD -MP -MF .deps/foo.Tpo -c -o foo.o foo.c
mv -f .deps/foo.Tpo .deps/foo.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2   -o foo foo.o
libtool: link: gcc -g -O2 -o foo foo.o
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT bar.o -MD -MP -MF .deps/bar.Tpo -c -o bar.o bar.c
mv -f .deps/bar.Tpo .deps/bar.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2   -o bar bar.o
libtool: link: gcc -g -O2 -o bar bar.o
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT baz.o -MD -MP -MF .deps/baz.Tpo -c -o baz.o baz.c
mv -f .deps/baz.Tpo .deps/baz.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2   -o baz baz.o
libtool: link: gcc -g -O2 -o baz baz.o
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT qux.o -MD -MP -MF .deps/qux.Tpo -c -o qux.o qux.c
mv -f .deps/qux.Tpo .deps/qux.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2   -o qux qux.o
libtool: link: gcc -g -O2 -o qux qux.o
$ # Now, use the silent rules
$ ./configure --enable-silent-rules > /dev/null
$ make clean all
 rm -f foo bar baz qux
rm -rf .libs _libs
rm -f *.o
rm -f *.lo
make  all-am
  CC       foo.o
  CCLD     foo
  CC       bar.o
  CCLD     bar
  CC       baz.o
  CCLD     baz
  CC       qux.o
  CCLD     qux

All that is needed is to add "silent-rules" to the invocation
of AM_INIT_AUTOMAKE in configure.ac, and add the option
--enable-silent-rules when you invoke configure. (There
was much debate about requiring the option to be added
at configure time when this feature was added, and there
is an easy workaround to make it unnecessary.) Note that
with silent-rules enabled, you can still get verbose
output by running 'make V=1'

擦肩而过的背影 2024-09-09 16:31:40

我在同一条船上做了一些谷歌搜索,autoconf 工具做得很好,但是当文本呼啸而过时,它会伤害你的眼睛,并且无法知道那是什么......这是一个链接到博客其中提到了一个工具可以做到这一点,并使其看起来更整洁,就像您看到内核构建的方式一样,它具有神奇的作用,即

Compiling foo.so
Linking foo.so

这里是另一个名为 美化 automake

I did a bit of googling around as I am in the same boat, the autoconf tools do a nice job but it kind of wrecks your eyes when the text whizzes by and no way of knowing what was that about... here is a link to a blog that mentions a tool to do this and make it look like neater just like how you see a kernel build does the magic i.e.

Compiling foo.so
Linking foo.so

Here is another link to a tool that is called prettify automake.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文