automake自動生成makefile過程記錄

目標
生成makefile,可經過make生成靜態庫(.a)。 shell

基本步驟vim

# autoscan
autom4te: configure.ac: no such file or directory
autoscan: /usr/bin/autom4te failed with exit status: 1

# mv configure.scan configure.in
# vim configure.in
//進行以下操做
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
改成
AC_INIT(libcomm.a, 1.0.0, shiluo.110@163.com)

AC_CONFIG_HEADER([config.h])
改成 
AM_CONFIG_HEADER([config.h])

增長
AM_INIT_AUTOMAKE(test,1.0)

增長
AC_PROG_RANLIB

# aclocal
# autoconf
# autoheader
# automake --add-missing
# ./configure
# make


遇到的問題ui

一、運行autoscan報錯: spa

[root @localhost dust]# autoscan
autom4te: configure.ac: no such file or directory
autoscan: /usr/bin/autom4te failed with exit status: 1

解決方法:無視。

二、
configure.ac:6: installing `./install-sh'; error while making link: 不容許的操做
configure.ac:6: installing `./missing'; error while making link: 不容許的操做
src/Makefile.am: installing `./depcomp'; error while making link: 不容許的操做

解決方法:由於把工程放在FAT32分區上了,而它不支持link。挪到ext3上就解決了。 .net

三、
想經過自定義的install-sh腳本完成自定義的功能,卻未找到相應的操做宏。 code

解決方法:將configure.in和Makefile.am放到一個build文件夾內,經過安裝腳本調用autoconf/automake等命令生成靜態庫,並完成拷貝等操做。 get


(未完,待續) it

相關文章
相關標籤/搜索