Makefile 自动工具:强制生成不重建配置/生成文件

Makefile 自动工具:强制生成不重建配置/生成文件,makefile,cvs,autotools,autoconf,automake,Makefile,Cvs,Autotools,Autoconf,Automake,我有一个关于自动工具的项目:automake,autoconf 我想禁止make重新制作文件configure,Makefile.in等;只是为了完成编译工作 有些文件是手工编辑的,我知道我不应该这样做。(或者项目是从CVS更新的,所有生成的文件都存储在CVS中)。 但目前我没有安装正确版本的自动工具 此文件的修改次数必须是多少(必须是较新/较旧的): 或者:为了实现我的目标,我必须执行什么顺序的touch命令 touch confdb/*.m4 touch configure.in touch

我有一个关于自动工具的项目:automake,autoconf

我想禁止
make
重新制作文件
configure
Makefile.in
等;只是为了完成编译工作

有些文件是手工编辑的,我知道我不应该这样做。(或者项目是从CVS更新的,所有生成的文件都存储在CVS中)。 但目前我没有安装正确版本的自动工具

此文件的修改次数必须是多少(必须是较新/较旧的):

或者:为了实现我的目标,我必须执行什么顺序的
touch
命令

touch confdb/*.m4
touch configure.in
touch *.m4
touch *.am
touch Makefile.in */Makefile.in
touch *config.h.in */*config.h.in
touch configure
touch config.status
touch config.h
touch Makefile

automake&cvs的问题在这里介绍

首先,如果直接编辑生成的文件,它无论如何都不会重建,因为它比其先决条件更新

然后,这里有两个独立的操作:
config.status
Makefile
是在构建过程中创建的。除非更新它们的时间戳,否则很难防止它们在构建期间被重新制作

其他文件由各种自动工具生成。自动生成的最新版本默认情况下不会创建自动重新生成的规则。根据您的软件包,您可能希望使用
配置
选项
--禁用维护者模式
。Automake文档包含一些关于该选项的更有趣的信息

我有时对一个我不太了解或构建系统非常混乱的包使用的一个技巧是运行

make all AUTOCONF=: AUTOHEADER=: AUTOMAKE=: ACLOCAL=:

因此,如果碰巧调用了这些程序,将替换一个noop。

尝试通过命令行明确告诉
make
不应重新生成这些文件

$ make -o configure -o Makefile.in
或者使用
MAKEFLAGS

$ MAKEFLAGS="-o configure -o Makefile.in" make
来自GNU make的手册

‘-o file’
‘--old-file=file’
‘--assume-old=file’
Do not remake the file file even if it is older than its prerequisites, and do not remake
anything on account of changes in file. Essentially the file is treated as very old and
its rules are ignored. See Avoiding Recompilation of Some Files.

如果您的自动工具模板正确地将
$(MAKE)
用于子曲面,则应该没有问题。

我手动编辑了
配置
,也在中编辑了
配置。但我没有需要的autotools版本,所以对
configure
的编辑就像使用正确的工具重新生成一样。我不想使用不同的自动工具,因为该项目在cvs下,它与创建的所有脚本(configure,*.m4,*.in)一起存储。噢,
--禁用维护者模式
—谢谢。不幸的是,项目使用的不是automake,而是simplemake(Makefile.sm),它没有
--禁用维护者模式
项目的较新版本中有几个“
配置
”脚本。Top configure有
--禁用维护者模式
,它可以工作,但是一些内部
配置
没有
--禁用维护者模式
。记住接受你自己的答案,这样问题就不会看起来没有答案。
‘-o file’
‘--old-file=file’
‘--assume-old=file’
Do not remake the file file even if it is older than its prerequisites, and do not remake
anything on account of changes in file. Essentially the file is treated as very old and
its rules are ignored. See Avoiding Recompilation of Some Files.