autotools: force make not to rebuild configure/Makefile
Asked Answered
G

3

9

I have a project with autotools: automake, autoconf.

I want to prohibit make from remaking files configure, Makefile.in, etc; just to do compile job.

Some of files are edited by hand, and I know that I should not to do this. (Or the project was updated from CVS with all generated files stored in CVS). But at the moment I have no correct version autotools installed.

What must be modification times of this files (which must be newer/older):

aclocal.m4
configure.in
confdb/ax_prefix_config_h.m4
Makefile.am
Makefile.in
Makefile
configure
config.status

Or: what sequence of touch commands must I do to achieve my goal?

Godgiven answered 20/4, 2011 at 13:23 Comment(0)
F
12

First of all, if you edit a generated file directly, it wouldn't be rebuilt anyway, because it is then newer then its prerequisites.

Then, there are two separate things going on here: config.status and Makefile are created during the build. It's hard to prevent these from being remade during the build unless you make their timestamps newer.

The other files are generated by the various autotools. Recent versions of Automake do not create rules by default that remake them automatically. Depending on your package, you might want to use the configure option --disable-maintainer-mode. The Automake documentation contains some more interesting information about that option.

One trick I sometimes use with a package that I don't know much about or that has a pretty messed up build system is to run something like

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

so that if these programs happen to be called, a noop would be substituted.

Fultz answered 21/4, 2011 at 14:20 Comment(3)
I edited a configure manually and also I edit configure.in. But I have no needed versions of autotools, so edits of configure was like as it is regenerated with right tool. I want not to use different autotools because the project is under cvs and it is stored with all scripts (configure, *.m4, *.in) created.Godgiven
Ohh, --disable-maintainer-mode - thanks. Unfortunatly, the project use not automake, but simplemake (Makefile.sm), which does not have a --disable-maintainer-modeGodgiven
Newer version of the project have several "configure" script inside it. Top configure has --disable-maintainer-mode and it works, but some internal configures have no --disable-maintainer-mode.Godgiven
G
4
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

Problems with automake & cvs are described here http://www.gnu.org/s/hello/manual/automake/CVS.html

Godgiven answered 20/4, 2011 at 16:14 Comment(1)
Remember to accept your own answer, so the question doesn't look unanswered.Ethmoid
C
2

Try to explicitly tell make those files should not be remade, via command-line

$ make -o configure -o Makefile.in

or by using MAKEFLAGS

$ MAKEFLAGS="-o configure -o Makefile.in" make

The excerpt from GNU make's manual

‘-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.

If yours autotools template correctly uses $(MAKE) for subdirs, there should be no problems.

Corneliuscornell answered 28/8, 2012 at 15:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.