`

Automake的错误汇总

 
阅读更多

一、今天参照GNU hello,终于做出了hello makefile,
已经解决的问题:
    1.configure.in:35: required file `config.h.in' not found 
ANSWER:在执行automake --add-missing之前执行autoheader,生成config.h.in
    2.Makefile.am: required file `./NEWS' not found
      Makefile.am: required file `./README' not found
      Makefile.am: required file `./AUTHORS' not found
      Makefile.am: required file `./ChangeLog' not found
ANSWER:add a command,just like this: touch README NEWS AUTHORS ChangeLog(即在根目录添加)
    3.
还没有解决的问题:
    1.intl/dcigettext.c:129: warning: getwd is deprecated, use getcwd instead
configure.in: warning: missing AM_GNU_GETTEXT wanted by: intl/intl-compat.c:101

    2.configure.in:35: required file `tests/hello.in' not found
    3.[leizhige@localhost hello]$ chmod +x tests/hello(我把这条语句去掉了)
chmod: cannot access `tests/hello': No such file or directory


二、####Make a makefile(using  gnu automake)####

test
|----- comm
|  |---- debug.c
|  `----debug.h
|
|---- doc
|  |--|-- test.conf
|  `--|-- test.man.3
|
|
`---- src
   |----test.c
   `----test.h

cd /test
autoscan ->configure.scan
mv configure.scan->configure.in
    AC_OUTPUT([Makefile comm/Makefile src/Makefile doc/Makefile])
    AC_PROG_RANLIB #because use the "lib"
aclocal
autoconf
create Makefile.am,comm/Makefile.am, src/Makefile.am,doc/Makefile.am

顶层的Makefile.am内容如下
SUBDIRS = doc comm src test 这里注意把comm放在src前面

comm/Makefile.am内容如下:
noinst_LIBRARIES=libcomm.a noinst指的是该库不要install到prefix/lib目录下,因为只是一个临时的libcomm_a_lib=debug.h debug.c 注意命名

# src/Makefile.am内容如下
bin_PROGRAMS=test
hello_SOURCES=test.h test.c

doc/Makefile.am内容如下
man_MANS=test.man.3
sysconf_DATA=test.conf

autoheader
automake --add-missing --copy
./configure
make

####complete####

三、生成makefile的步骤:

1) 运行autoscan命令
2) 将configure.scan 文件重命名为configure.in,并修改configure.in文件
3) 在project目录下新建Makefile.am文件,并在子目录下也新建Makefile.am文件
4) 在project目录下新建NEWS、 README、 ChangeLog 、AUTHORS文件
    touch NEWS README ChangeLog AUTHORS
5) 将/usr/share/automake-1.8/目录下的depcomp和complie文件拷贝到本目录下
6) 运行aclocal 命令
7) 运行autoconf命令
8) 运行autoheader命令
9) 运行automake --add-missing 命令
10) 运行./confiugre脚本
11) 执行make

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics