本文翻译自:What are Makefile.am and Makefile.in?

These two files are mostly seen in open source projects. 这两个文件主要出现在开源项目中。

What are they for, and how do they work? 它们是什么,它们是如何工作的?


#1楼

参考:https://stackoom.com/question/Acdv/什么是Makefile-am和Makefile-in


#2楼

Makefile.am is a programmer-defined file and is used by automake to generate the Makefile.in file (the .am stands for a uto m ake). Makefile.am是一个程序员定义的文件,由automake用来生成Makefile.in文件( .am代表一个 uto m ake)。 The configure script typically seen in source tarballs will use the Makefile.in to generate a Makefile . 通常在源tarball中看到的configure脚本将使用Makefile.in生成Makefile

The configure script itself is generated from a programmer-defined file named either configure.ac or configure.in (deprecated). configure脚本本身是从名为configure.acconfigure.in (不建议使用)的程序员定义的文件生成的。 I prefer .ac (for a uto c onf) since it differentiates it from the generated Makefile.in files and that way I can have rules such as make dist-clean which runs rm -f *.in . 我喜欢.ac对于反对派çONF),因为它从产生区别它Makefile.in文件,这样我可以有规则,如make dist-clean它运行rm -f *.in Since it is a generated file, it is not typically stored in a revision system such as Git, SVN, Mercurial or CVS, rather the .ac file would be. 由于它是生成的文件,因此通常不会存储在诸如Git,SVN,Mercurial或CVS之类的修订系统中,而是存储在.ac文件中。

Read more on GNU Autotools . GNU Autotools 。 Read about make and Makefile first, then learn about automake , autoconf , libtool , etc. 首先阅读makeMakefile ,然后了解automakeautoconflibtool等。


#3楼

Simple example 简单的例子

Shamelessly adapted from: http://www.gnu.org/software/automake/manual/html_node/Creating-amhello.html and tested on Ubuntu 14.04 Automake 1.14.1. 无耻地改编自: http : //www.gnu.org/software/automake/manual/html_node/Creating-amhello.html并在Ubuntu 14.04 Automake 1.14.1上进行了测试。

Makefile.am Makefile.am

SUBDIRS = src
dist_doc_DATA = README.md

README.md README.md

Some doc.

configure.ac 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([Makefilesrc/Makefile
])
AC_OUTPUT

src/Makefile.am SRC / Makefile.am

bin_PROGRAMS = autotools_hello_world
autotools_hello_world_SOURCES = main.c

src/main.c SRC / main.c中

#include <config.h>
#include <stdio.h>int main (void) {puts ("Hello world from " PACKAGE_STRING);return 0;
}

Usage 用法

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

This outputs: 这输出:

Hello world from automake_hello_world 1.0

Notes 笔记

  • autoreconf --install generates several template files which should be tracked by Git, including Makefile.in . autoreconf --install生成几个模板文件,应由Git跟踪,包括Makefile.in It only needs to be run the first time. 它只需要第一次运行。

  • make install installs: make install安装:

    • the binary to /usr/local/bin 二进制文件到/usr/local/bin
    • README.md to /usr/local/share/doc/automake_hello_world README.md/usr/local/share/doc/automake_hello_world

On GitHub for you to try it out. 在GitHub上你可以尝试一下。


#4楼

reference : 参考 :

Makefile.am -- a user input file to automake Makefile.am - 要自动化的用户输入文件

configure.in -- a user input file to autoconf configure.in - autoconf的用户输入文件


autoconf generates configure from configure.in autoconf从configure.in生成configure

automake gererates Makefile.in from Makefile.am automake从Makefile.am创建Makefile.in

configure generates Makefile from Makefile.in configure从Makefile.in生成Makefile

For ex: 例如:

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

#5楼

DEVELOPER runs these: 开发者运行这些:

1) autoconf -- creates shippable configure script (which the installer will run to make the Makefile ) 1) autoconf - 创建可发送的配置脚本(安装程序将运行生成Makefile
2) automake - creates shippable Makefile.in (which configure will later read to make the Makefile ) 2) automake - 创建可发送的Makefile.in配置将在以后读取生成Makefile

INSTALLER runs these: 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

INPUTS -> PROGRAMS -> OUTPUTS: INPUTS - > PROGRAMS - > OUTPUTS:

DEVELOPER runs these: 开发者运行这些:

configure.in --> autoconf -> configure (script) --- (configure. in is depreciated. Now use configure.ac) configure.in - > autoconf的 - > 配置 (脚本)---(。 配置折旧现在使用configure.ac)
configure.ac -> autoconf -> configure (script) --- (*. ac = a uto c onf) configure.ac - > autoconf - > configure (script)---(*。 ac = a uto c onf)

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

INSTALLER runs these: INSTALLER运行这些:

Makefile.in -> configure -> Makefile (*. in = in put file) Makefile.in - > 配置 - > 生成文件 (*。 放文件=)

Makefile -> make -> (the new software in your downloads or temporary directory) Makefile - > make - >(下载或临时目录中的新软件)
Makefile -> make install -> (puts new software in system directory) Makefile - > make install - >(将新软件放入系统目录)


" Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages. These scripts can adapt the packages to many kinds of UNIX-like systems without manual user intervention. Autoconf creates a configuration script for a package from a template file that lists the operating system features that the package can use, in the form of M4 macro calls." Autoconf是一个可扩展的M4宏包,可以生成shell脚本来自动配置软件源代码包。这些脚本可以使软件包适应多种类UNIX系统而无需用户手动干预.Autoconf为一个软件包创建一个配置脚本模板文件,以M4宏调用的形式列出软件包可以使用的操作系统功能。“

" Automake is a tool for automatically generating Makefile.in files compliant with the GNU Coding Standards. Automake requires the use of Autoconf." Automake是一个自动生成符合GNU编码标准的Makefile.in文件的工具.Automake需要使用Autoconf。”

Manuals: 手册:

  • m4 (used by autoconf) m4 (由autoconf使用)
  • autoconf autoconf的
  • automake automake的

Interesting facts: 有趣的事实:
The main configure.ac used to build LibreOffice is over 12k lines of code, (but there are also 57 other configure.ac files in subfolders.) 用于构建LibreOffice的主要configure.ac是超过12k行代码,(但子文件夹中还有57个其他configure.ac文件。)
From this my generated configure is over 41k lines of code. 由此我生成的配置超过41k行代码。
While the Makefile.in and Makefile are both only 493 lines of code. Makefile.inMakefile都只有493行代码。 (But, there are also 768 more Makefile.in's in subfolders.) (但是,子文件夹中还有768个Makefile.in。)

什么是Makefile.am和Makefile.in?相关推荐

  1. Makefile.am和makefile.in生成Makefile

    很多时候,我们在网上下载的linux开源软件都会遇到一个问题,就是源码里面没有直接的makefile,但是它有Makefile.am和makefile.in或者它有Makefile.am和config ...

  2. Makefile文件:Makefile介绍

    本文介绍Makefile的一些基本概念以及简单的用法.本文所用的编译器是Hightec tricore v4.9.1.0. 文章目录 1 Makefile的作用 2 Makefile的规则 3 一个简 ...

  3. makefile的使用方法(简单视频教程以及详细文字教程)(makefile教程、makefile教学)

    文章目录 1.makefile详细文字教程 2.makefile简单教程(B站视频教程) makefile基本语法格式: 简单示例(单文件)makefile写法 带包含关系的多文件makefile写法 ...

  4. (三)《跟我一起写Makefile》之Makefile总述

    前往我的个人博客,阅读体验更佳. Makefile 总述 Makefile 里有什么? Makefile 里主要包含了五个东西:显式规则.隐晦规则.变量定义.文件指示和注释. 显式规则.显式规则说明了 ...

  5. linux中makefile高级用法--makefile调用makefile

    一.介绍 在大型项目中,makefile调用makefile很常见,也很方便,这里给出调用方法 二.实例 1.代码树 app_top下,有顶层makefile和编译工具的设置文件Rules.make, ...

  6. 浅显易懂 Makefile 入门 (01)— 什么是Makefile、为什么要用Makefile、Makefile规则、Makefile流程如何实现增量编译

    1. 什么是 Makefile Makefile 文件描述了 Linux 系统下 C/C++ 工程的编译规则,它用来自动化编译 C/C++ 项目.一旦写编写好 Makefile 文件,只需要一个 ma ...

  7. makefile讲义(1)——makefile基础(概述)

    2019独角兽企业重金招聘Python工程师标准>>> 最近在学习Linux下的C编程,买了一本叫<Linux环境下的C编程指南>读到makefile就越看越迷糊,可能是 ...

  8. linux驱动模块makefile,linux驱动makefile求解

    下面是一个网卡驱动的makefile,有很多地方不懂,拿出来和大家一起分析一下: CURRENT= $(shell uname -r) TARGET= asix OBJS= asix.o MDIR=  ...

  9. Makefile、多Makefile编译静态库、动态库、SRC实例总结

    静态库生成及使用 calc.h #ifndef __MY_LIB_H__ #define __MY_LIB_H__ int add(int a, int b); #endif calc.c #incl ...

最新文章

  1. Kubernetes Docker 容器网络终极之战(十四)
  2. Java设计模式之行为型:命令模式
  3. 用VBA得到EXCEL表格中的行数和列数
  4. springboot(六):如何优雅的使用mybatis
  5. node历史版本下载
  6. 嵌入式编程(一):51单片机如何将函数 定义到指定程序地址
  7. 【Nodejs开发】第2章 网站首页的布局
  8. vip会员统计表 (vip等级是灵活配置的 非写死1是金卡用户 2是什么 等)
  9. Tomcat日志配置
  10. WPF控件获得焦点时去除虚线框
  11. noip2017普及组
  12. 一些有趣、奇葩、实用的网站
  13. java高级进阶面试题
  14. Word批量转PDF 无水印
  15. 《CCNet: Criss-Cross Attention for Semantic Segmentation》--阅读笔记-ICCV2019
  16. 聊聊Ping命令的返回值Pong
  17. linux怎么打开隐藏文件夹,如何在文件管理器中隐藏文件和文件夹
  18. 深度学习——词汇embedded、Beam Search
  19. 享受科研,心怀远方:青年学者刘元玮的成长之路
  20. 这五个姓氏你根本没见过,第三个甚至难以启齿

热门文章

  1. java 并发原子性与易变性 来自thinking in java4 21.3.3
  2. 《深入解析IPv6(第3版)》——11.4 流量转换
  3. 【UNITY3D 游戏开发之三】NGUI HUDTEXT 的练习源码及资源
  4. RHCE之DHCP配置详解
  5. 西电华为交换设备配置(6506)
  6. .NET 基础 一步步 一幕幕 [前言]
  7. VS2010版快捷键指南
  8. 企业监控服务器Cacti、nagios服务器
  9. win10 2004更新完成之后出现进不去系统的问题
  10. MySQL | MySQL 数据库系统(四)- 数据库的备份与恢复