Configure, Makefile. am, Makefile. in, Makefile 파일 간 의 관계

다음으로 이동:http://jaguar13.iteye.com/blog/614427
1. autoscan (autoconf): 원본 코드 를 스 캔 하여 일반적인 이식 가능 한 문 제 를 찾 습 니 다. 예 를 들 어 컴 파일 러, 라 이브 러 리, 헤더 파일 등 을 검사 하고 파일 configure. scan 을 생 성 합 니 다. configure. ac 의 초기 형태 입 니 다.
    your source files --> [autoscan*] --> [configure.scan] --> configure.ac
2. aclocal (automake): 설 치 된 매크로 에 따라 사용자 정의 매크로 와 acinclude. m4 파일 의 매크로 는 configure. ac 파일 에 필요 한 매크로 를 파일 aclocal. m4 에 집중 적 으로 정의 합 니 다.aclocal 은 perl 스 크 립 트 프로그램 입 니 다. "aclocal - create aclocal. m4 by scanning configure. ac" 라 고 정의 합 니 다.
3.autoheader(autoconf):   configure.ac     ,  cpp   ,  m4,  config.h.in

4. automake: automake 는 Makefile. am 에서 정의 하 는 구 조 를 Makefile. in 으로 만 든 다음 configure 스 크 립 트 는 생 성 된 Makefile. in 파일 을 Makefile 로 변환 합 니 다.configure. ac 에서 AC 와 같은 특수 한 매크로 를 정의 했다 면PROG_LIBTOOL, libtoolize 를 호출 합 니 다. 그렇지 않 으 면 config. guess 와 config. sub 가 생 깁 니 다.
5. autoconf: configure. ac 의 매크로 를 펼 쳐 configure 스 크 립 트 를 생 성 합 니 다.이 과정 은 aclocal. m4 에서 정의 하 는 매크로 를 사용 할 수 있 습 니 다.
6. ./configure   
 
  
7. make  

실례

/ hello / 디 렉 터 리 아래 hello. c 파일 을 만 들 고 컴 파일 하여 실행 합 니 다.
#cd /hello/
(1) 원본 파일 hello. c 작성:
#include int main(int argc, char** argv){printf("Hello, GNU!n");return 0;}
[litao@vm0000131 hello]$ lltotal 4-rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c
1. 오토 스 캔
[litao@vm0000131 hello]$ autoscanautom4te: configure.ac: no such file or directoryautoscan: /usr/bin/autom4te failed with exit status: 1[litao@vm0000131 hello]$ lltotal 8-rw-rw-r-- 1 litao litao   0 Aug 12 12:03 autoscan.log-rw-rw-r-- 1 litao litao 457 Aug 12 12:03 configure.scan-rw-rw-r-- 1 litao litao  68 Aug 12 12:02 hello.c
configure. scan, autoscan. log 파일 이 생 성 되 었 습 니 다.
configure. scan 을 configure. in, 마지막 으로 수 정 된 내용 은 다음 과 같 습 니 다.
[litao@vm0000131 hello]$ mv configure.scan configure.in    [litao@vm0000131 hello]$ vim configure.in 
#                                               -*- Autoconf -*-# Process this file with autoconf to produce a configure script.AC_PREREQ(2.59)AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)AC_CONFIG_SRCDIR([hello.c])#AC_CONFIG_HEADER([config.h])AM_INIT_AUTOMAKE(hello, 1.0)# Checks for programs.AC_PROG_CC# Checks for libraries.# Checks for header files.# Checks for typedefs, structures, and compiler characteristics.# Checks for library functions.AC_OUTPUT(Makefile)
acloacl
[litao@vm0000131 hello]$ aclocal 
aclocal. m4 와 autom4te. cache 생 성 (aclocal. m4 생 성 과정 에서 configure. in 관련)
[litao@vm0000131 hello]$ lltotal 44-rw-rw-r-- 1 litao litao 31120 Aug 12 12:08 aclocal.m4drwxr-xr-x 2 litao litao  4096 Aug 12 12:08 autom4te.cache-rw-rw-r-- 1 litao litao     0 Aug 12 12:03 autoscan.log-rw-rw-r-- 1 litao litao   496 Aug 12 12:08 configure.in-rw-rw-r-- 1 litao litao    68 Aug 12 12:02 hello.c
3. antoconf
[litao@vm0000131hello] $autoconf 생 성 configure 근거 configure. in, aclocal. m4)
[litao@vm0000131 hello]$ ll
total 168
-rw-rw-r-- 1 litao litao  31120 Aug 12 12:08 aclocal.m4
drwxr-xr-x 2 litao litao   4096 Aug 12 12:11 autom4te.cache
-rw-rw-r-- 1 litao litao      0 Aug 12 12:03 autoscan.log
-rwxrwxr-x 1 litao litao 122297 Aug 12 12:11 configure
-rw-rw-r-- 1 litao litao    496 Aug 12 12:08 configure.in
-rw-rw-r-- 1 litao litao     68 Aug 12 12:02 hello.c
4. Makefile. am 작성:
AUTOMAKE_OPTIONS= foreignbin_PROGRAMS= hellohello_SOURCES= hello.c
5. automake
Makefile. in, depcomp, install - sh, missing 생 성 (Makefile. am, aclocal. m4 에 따라)
[litao@vm0000131 hello]$ automakeconfigure.in: required file `./install-sh' not foundconfigure.in: required file `./missing' not foundMakefile.am: required file `./depcomp' not found[litao@vm0000131 hello]$ automake --add-missingconfigure.in: installing `./install-sh'configure.in: installing `./missing'Makefile.am: installing `./depcomp'[litao@vm0000131 hello]$ lltotal 192-rw-rw-r-- 1 litao litao  31120 Aug 12 12:08 aclocal.m4drwxr-xr-x 2 litao litao   4096 Aug 12 12:14 autom4te.cache-rw-rw-r-- 1 litao litao      0 Aug 12 12:03 autoscan.log-rwxrwxr-x 1 litao litao 122297 Aug 12 12:11 configure-rw-rw-r-- 1 litao litao    496 Aug 12 12:08 configure.inlrwxrwxrwx 1 litao litao     31 Aug 12 12:16 depcomp -> /usr/share/automake-1.9/depcomp-rw-rw-r-- 1 litao litao     68 Aug 12 12:02 hello.clrwxrwxrwx 1 litao litao     34 Aug 12 12:16 install-sh -> /usr/share/automake-1.9/install-sh-rw-rw-r-- 1 litao litao     69 Aug 12 12:15 Makefile.am-rw-rw-r-- 1 litao litao  16561 Aug 12 12:16 Makefile.inlrwxrwxrwx 1 litao litao     31 Aug 12 12:16 missing -> /usr/share/automake-1.9/missing
6. configure 생 성 Makefile, config. log, config. status

좋은 웹페이지 즐겨찾기