[问题]怎样由Makefile.in和Makefile.am生成Makefile?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
Nile
帖子: 990
注册时间: 2006-07-15 11:20
来自: 枫叶刀市

[问题]怎样由Makefile.in和Makefile.am生成Makefile?

#1

帖子 Nile » 2008-07-10 19:05

我编译GTKmm给的示例,比如给出如下文件:
examplewindow.cc examplewindow.h main.cc Makefile.am Makefile.in
但生成的Makefile却是错的,请大家看看我那个步骤出了问题?

代码: 全选

nile@un:~/project/examples/book/buttons/checkbutton$ l
examplewindow.cc  examplewindow.h  main.cc  Makefile.am  Makefile.in
nile@un:~/project/examples/book/buttons/checkbutton$ autoscan 
nile@un:~/project/examples/book/buttons/checkbutton$ mv configure.scan configure.in
nile@un:~/project/examples/book/buttons/checkbutton$ aclocal
nile@un:~/project/examples/book/buttons/checkbutton$ autoconf 
nile@un:~/project/examples/book/buttons/checkbutton$ autoheader 
nile@un:~/project/examples/book/buttons/checkbutton$ ./configure 
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
nile@un:~/project/examples/book/buttons/checkbutton$ l
autom4te.cache/  config.h     config.log      configure*    examplewindow.cc  main.cc   Makefile.am
autoscan.log     config.h.in  config.status*  configure.in  examplewindow.h   Makefile  Makefile.in
nile@un:~/project/examples/book/buttons/checkbutton$ make
Makefile:15: *** 遗漏分隔符 。 停止。
nile@un:~/project/examples/book/buttons/checkbutton$ 
多谢多谢!
Thinkpad T400
头像
Nile
帖子: 990
注册时间: 2006-07-15 11:20
来自: 枫叶刀市

#2

帖子 Nile » 2008-07-10 20:57

我就不明白了,为什么同时提供Makefile.am和Makefile.in?Makefile.in不是Makefile.am生成的吗?

如果用Makefile.am生成的Makefile.in再生成Makefile会出现Makefile.am_fragment:6: *** 遗漏分隔符 。 停止。
的错误
看了一下Makefile,其中有这么一句include /home/nile/project/examples/Makefile.am_fragment
是从Makefile.am里直接copy来的,
Makefile.am:

代码: 全选

include /home/nile/project/examples/Makefile.am_fragment

#Build the executable, but don't install it.
noinst_PROGRAMS = example
example_SOURCES = examplewindow.h examplewindow.cc main.cc
而Makefile.am_fragment文件根本就不是Makefile文件,比如出错的第6行:

代码: 全选

if GTKMM_ATKMM_ENABLED
ATKMMLIB = $(local_atkmm_lib)
endif
好像是一个普通shell脚本,这样直接make出错就是理所当然的了。

如果不用示例提供的Makefile.am,直接让configure读取Makefile.in,再make就会出现
make: *** 没有规则可以创建“Makefile.in”需要的目标“@MAINTAINER_MODE_TRUE@”。 停止。

真被搞晕了 :em20 :em23
Thinkpad T400
回复