configure, make, make install都做了什么


1. 我的理解
./configure:  確保接下來的make以及make install所依賴的文件沒有問題
make:  build編譯連接生成可執行程序
make install: 將編譯好的可執行程序以及文檔copy到對應的系統目錄

2. 那么如何制作configure文件以及Makefile呢

1) Prepararation
main.c,

#include <stdio.h>
int main(int argc, const char *argv[])
{
    printf("Hello world\n");
    return 0;
}

configure.ac

AC_INIT([helloworld],[0.1],[xxx@163.com])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Makefile.in

AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS = helloworld
helloworld_SOURCES = main.c

2) Tools:

aclocal   ------------------> set up an m4 environment
autoconf  ------------------> generate configure from configue.ac
automake --add-mising ------> generate Makefile.in from Makefile.am
./configue -----------------> generate Makefile from Makefile.in
make distcheck -------------> use Makefile to build and test a tarball to distribute


3. Overview

./configure  # generate Makefile from Makefile.in
make         # use Makefile to build the program
make install # use Makefile to install the program


Refer to:
1. configure, make, make install都做了什么
2. The magic behind configure, make, make install



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM