linux make 常用参数

  1. aclocal ; autoheader; automake ; autoconf
  2. ./configure 自动生成makefile文件
  3. http://www.2cto.com/net/201609/547736.html
  4. 把make过程打印的所有信息都保存在xxx.log中。
    $make 2>&1|tee xxx.log

  5. ./configure --prefix=/tmp/prefix
  6. ./configure --help
  7. make install DESTDIR=/whereto 
  8. make uninstall
  9. make V=99 //make时显示详细信息
  10. ./configure --disable-static 不编译静态文件
  11. aclocal 根据configure.in 文件的内容,自动生成aclocal.m4 文件
  12. aclocal -I /usr/share/aclocal -I /usr/m4-1.4.9/m4 --install
  13. autoconf 从configure.in 这个列举编译软件时所需要各种参数的模板文件中创建configure 
  14. automake 会根据你写的Makefile.am 来自动生成Makefile.in
  15. 执行configure 生成Makefile
  16. make -f pax.mk // run pax.mk
  17. automake --force-missing --add-missing

  18. ldd --version 查看glibc版本
    

在MAKEFILE中:
$@
    表示规则中的目标文件集。在模式规则中,如果有多个目标,那么,"$@"就是匹配于目标中模式定义的集合。
$%
    仅当目标是函数库文件中,表示规则中的目标成员名。例如,如果一个目标是"foo.a(bar.o)",那么,"$%"就是"bar.o","$@"就是 "foo.a"。如果目标不是函数库文件(Unix下是[.a],Windows下是[.lib]),那么,其值为空。
$<
    依赖目标中的第一个目标名字。如果依赖目标是以模式(即"%")定义的,那么"$<"将是符合模式的一系列的文件集。注意,其是一个一个取出来的。
$?
    所有比目标新的依赖目标的集合。以空格分隔。
$^
    所有的依赖目标的集合。以空格分隔。如果在依赖目标中有多个重复的,那个这个变量会去除重复的依赖目标,只保留一份。

CFLAGS: 指定头文件(.h文件)的路径,如:CFLAGS=-I/usr/include -I/path/include。同样地,安装一个包时会在安装路径下建立一个include目录,当安装过程中出现问题时,试着把以前安装的包的include目录加入到该变量中来。

LDFLAGS:gcc 等编译器会用到的一些优化参数,也可以在里面指定库文件的位置。用法:LDFLAGS=-L/usr/lib -L/path/to/your/lib。每安装一个包都几乎一定的会在安装目录里建立一个lib目录。如果明明安装了某个包,而安装另一个包时,它愣是 说找不到,可以抒那个包的lib路径加入的LDFALGS中试一下。

LIBS:告诉链接器要链接哪些库文件,如LIBS = -lpthread -liconv


简单地说,LDFLAGS是告诉链接器从哪里寻找库文件,而LIBS是告诉链接器要链接哪些库文件。不过使用时链接阶段这两个参数都会加上,所以你即使将这两个的值互换,也没有问题。

有时候LDFLAGS指定-L虽然能让链接器找到库进行链接,但是运行时链接器却找不到这个库,如果要让软件运行时库文件的路径也得到扩展,那么我们需要增加这两个库给”-Wl,R”:

config.log 搜索关键字cannot

1.error

configure.in:7: version mismatch.  This is Automake 1.9.6,
configure.in:7: but the definition used by this AM_INIT_AUTOMAKE
configure.in:7: comes from Automake 1.9.5.  You should recreate
configure.in:7: aclocal.m4 with aclocal and run automake again.

解决方法

$aclocal

$automake

将重新生成makefile文件

2.[root@localhost src]# ./configure
-bash: ./configure: No such file or directory


[root@localhost src]# aclocal
aclocal: `configure.ac' and `configure.in' both present.
aclocal: proceeding with `configure.ac'.


[root@localhost src]# autoconf
autoconf: warning: both `configure.ac' and `configure.in' are present.
autoconf: warning: proceeding with `configure.ac'.

root@localhost src]# ./configure
checking which defines needed for makedepend... 
checking for a BSD-compatible install... /usr/bin/install -c

aclocal, autoconf, 之后可以正常运行./configure了

3.

+ autoreconf --install
configure.ac:32: warning: macro 'AM_PROG_LIBTOOL' not found in library
configure.ac:32: error: possibly undefined macro: AM_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

autoreconf -fvi to make sure everything is updated.

4.

configure.ac:10: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

apt-get install libtool

5.

$ sudo pacman -S pkg-config xorg-server-devel libtool automake
$ libtoolize --force

Consider adding AC_CONFIG_MACRO_DIR([m4]) to configure.ac
and re-run libtoolize --force.

$ vim configure.ac
$ libtoolize --force
$ aclocal
$ autoheader
$ automake --force-missing --add-missing
$ autoconf

6. ./configure: line 17661: syntax error near unexpected token `HARFBUZZ,'

    slove: aclocal /usr/pkg-config-0.25/share/aclocal --install

7.[root@localhost src]# ./autogen.sh
which: no gtkdocize in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
*** No GTK-Doc found, please install it ***

8.[root@localhost src]# libtoolize
-bash: libtoolize: command not found

export PATH='/path/to/libtool/bin'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值