[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unexplained behavior in autoconf-style stamp-h/config.h rule

From: Peter Eisentraut
Subject: unexplained behavior in autoconf-style stamp-h/config.h rule
Date: Tue, 24 Apr 2012 22:50:54 +0300

Attached is a minimal test case related to an Autoconf-style build
system.  The Autoconf manual recommends in section "Automatic Remaking":

    You can put rules like the following in the top-level
    `' for a package to automatically update the
    configuration information when you change the configuration
    files. [...]

     config.h: stamp-h
     stamp-h: config.status

Now add to that some file to compile, e.g.,

    all: test.o

    test.o: test.c config.h

If the tree is fully built and is updated (touch, then it takes *two* invocations of make to get everything

$ touch
$ make
$ make
cc    -c -o test.o test.c
$ make
make: Nothing to be done for `all'.

This is obviously broken.

A working fix appears to be to use

    config.h: stamp-h ;

instead.  Indeed, the rules generated by Automake effectively do this
(with some additional decoration), so this seems to be a recognized

But I'd like to understand why this happens.  The only vague theory I
have is that make thinks, since there are no commands attached to
config.h, it cannot possibly be updated, so don't bother checking
anything that has it as a prerequisite.  But neither the GNU make manual
nor make --debug really explain this.

Any ideas?

Also, is the Autoconf manual definitely wrong, and should it be fixed?  

Attachment: make-testcase.tar.gz
Description: application/compressed-tar

reply via email to

[Prev in Thread] Current Thread [Next in Thread]