development

Makefile.am과 Makefile.in은 무엇입니까?

big-blog 2020. 3. 11. 08:16
반응형

Makefile.am과 Makefile.in은 무엇입니까?


이 두 파일은 주로 오픈 소스 프로젝트에서 볼 수 있습니다.

무엇을위한 것이며 어떻게 작동합니까?


Makefile.am프로그래머 정의 파일에 의해 사용되는 automake생성]하는 Makefile.in파일 ( .am용 스탠드 우토의 m의 아케). 일반적으로 소스 타르볼에서 볼 스크립트를 사용 를 생성 .configureMakefile.inMakefile

configure스크립트 자체가 하나라는 프로그래머 정의 파일에서 생성됩니다 configure.ac또는 configure.in(사용되지 않음). 내가 선호하는 .ac(대한 우토 C 는 생성에서 차별화 이후 ONF) 파일과 그런 식으로 내가 같은 규칙을 가질 수 있습니다 실행됩니다 . 파일은 생성 된 파일이므로 일반적으로 Git, SVN, Mercurial 또는 CVS와 같은 수정 시스템에 저장되지 않고 파일이됩니다.Makefile.inmake dist-cleanrm -f *.in.ac

GNU Autotools 에 대해 더 읽어보십시오 . 에 대해 읽어 makeMakefile먼저 다음에 대해 자세히 알아보기 automake, autoconf, libtool, 등


간단한 예

http://www.gnu.org/software/automake/manual/html_node/Creating-amhello.html 에서 뻔뻔스럽게 조정 되었으며 Ubuntu 14.04 Automake 1.14.1에서 테스트되었습니다.

Makefile.am

SUBDIRS = src
dist_doc_DATA = README.md

README.md

Some doc.

configure.ac

AC_INIT([automake_hello_world], [1.0], [bug-automake@gnu.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
 Makefile
 src/Makefile
])
AC_OUTPUT

src / Makefile.am

bin_PROGRAMS = autotools_hello_world
autotools_hello_world_SOURCES = main.c

src / main.c

#include <config.h>
#include <stdio.h>

int main (void) {
  puts ("Hello world from " PACKAGE_STRING);
  return 0;
}

용법

autoreconf --install
mkdir build
cd build
../configure
make
sudo make install
autoconf_hello_world
sudo make uninstall

이 결과는 다음과 같습니다.

Hello world from automake_hello_world 1.0

노트

  • autoreconf --install를 포함하여 Git에서 추적해야하는 여러 템플릿 파일을 생성합니다 Makefile.in. 처음으로 만 실행하면됩니다.

  • make install 설치 :

    • 이진 /usr/local/bin
    • README.md/usr/local/share/doc/automake_hello_world

GitHub 에서 사용해보십시오.


참고 :

Makefile.am-자동 작성을위한 사용자 입력 파일

configure.in-autoconf에 대한 사용자 입력 파일


autoconf는 configure.in에서 configure를 생성합니다

automake는 Makefile.am에서 Makefile.in을 생성합니다.

configure는 Makefile.in에서 Makefile을 생성합니다.

예를 들어 :

$]
configure.in Makefile.in
$] sudo autoconf
configure configure.in Makefile.in ... 
$] sudo ./configure
Makefile Makefile.in

개발자는 다음을 실행합니다.

1) autoconf를이 -로 선적 생성 구성 스크립트를 (설치가되는 실행 하기 위해 Makefile을 )
2) automake는이 -로 선적 생성 Makefile.in을 (이 구성 나중에 것입니다 읽어 하기 위해 Makefile을 )

INSTALLER가 다음을 실행합니다.

./configure       # Creates  Makefile        (from     Makefile.in).  
make              # Creates  the application (from the Makefile just created).  

sudo make install # Installs the application 
                  #   Often, by default its files are installed into /usr/local

입력-> 프로그램 -> 출력 :

개발자는 다음을 실행합니다.

configure.in-> autoconf- > configure (스크립트) --- (configure in 감가 상각입니다. 이제 configure.ac를 사용하십시오)
configure.ac-> autoconf- > configure (스크립트) --- (*. ac = a 우토 C ONF)

Makefile.am-> automake- > Makefile.in ----------- (*. am = a uto m ake)

INSTALLER가 다음을 실행합니다.

Makefile.in -> 구성 -> 메이크 (. * 에서 = 넣어 파일)

메이크 -> 메이크업 -> (당신의 다운로드 또는 임시 디렉토리에 새로운 소프트웨어)
메이크 -> make install을 -> (풋 시스템 디렉토리에 새로운 소프트웨어)


" Autoconf 는 소프트웨어 소스 코드 패키지를 자동으로 구성하기위한 쉘 스크립트를 생성하는 확장 가능한 M4 매크로 패키지입니다.이 스크립트는 수동 사용자 개입없이 여러 종류의 UNIX 계열 시스템에 패키지를 적용 할 수 있습니다. Autoconf는 "M4 매크로 호출 형식으로 패키지에서 사용할 수있는 운영 체제 기능을 나열하는 템플릿 파일"

" Automake 는 GNU 코딩 표준을 준수하는 Makefile.in 파일을 자동으로 생성하는 도구입니다. Automake는 Autoconf를 사용해야합니다."

매뉴얼 :


흥미로운 사실 ​​: LibreOffice를 구축하는 데 사용되는
기본 configure.ac 는 12k 라인 이상의 코드입니다 (그러나 하위 폴더에는 57 개의 다른 configure.ac 파일도 있습니다)
.이 생성 된 구성 은 41k 라인 이상의 코드입니다.
그동안 Makefile.in메이크 코드의 양에만 493 라인이다.
그러나 하위 폴더에는 Makefile.in이 768 개 더 있습니다.

참고 URL : https://stackoverflow.com/questions/2531827/what-are-makefile-am-and-makefile-in

반응형