在源码树中运行'configure'是不必要的同时也是不好的。一个由'configure'产生的良好的'Makefile'可以构筑源码属于另 一棵树的软件包。在一个独立于源码的树中构筑派生的文件的好处是很明显的:派生的文件,如目标文件,会凌乱的散布于源码树。这也使在另一个不同的系统或用 不同的配置选项构筑同样的目标文件非常困难。建议使用三棵树:一棵源码树(source tree),一棵构筑树(build tree),一棵安装树(install tree)。这里有一个很接近的例子,是使用这种方法来构筑GNU malloc包:
$ gtar zxf mmalloc-1.0.tar.gz
$ mkdir build && cd build
$ ../mmalloc-1.0/configure
creating cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for a BSD compatible install... /usr/bin/install -c
checking host system type... i586-pc-linux-gnu
checking build system type... i586-pc-linux-gnu
checking for ar... ar
checking for ranlib... ranlib
checking how to run the C preprocessor... gcc -E
checking for unistd.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking for limits.h... yes
checking for stddef.h... yes
updating cache ../config.cache
creating ./config.status
这样这棵构筑树就被配置了,下面可以继续构筑和安装这个包到默认的位置'/usr/local':
$ make all && make install
一个软件包通过编译源代码安装后,如何完全的卸载??
如果原先的source还在的话,很多source的Makefile都有写uninstall规则,直接在Souce里make uninstall就可行,不过碰到无良作者没写的,那一句一句看Makefile里install部分他都干了些什么,然后挨个删除。
如果source没了.....那就一边郁闷吧
到目前为止, 我装的都可以make uninstall.......
(因为总是不小心装错地方, 结果就make uninstall&&make clean,然后重新configure......)