Re: question about makefile.in

2005-05-10 Thread tomas
On Tue, May 10, 2005 at 08:54:23AM +0800, zouq wrote:
 in the gcc-3.4.1 Makefile.in ,
 
 GTFILES_FILES_FILES = @all_gtfiles_files_files@
 why two @ used here?
 does it have special meaning?

Yes, that's right. It is Autoconf's ``substitution markup´´. Patterns
like this get substituted for values calculated during the run of
`configure´.

See the Autoconf manual for the whole story. Look for the chapter
``Makefile Substitutions´´ there.

Hope that helps

-- tomás


pgpPH1gqcchSg.pgp
Description: PGP signature


.DELETE_ON_ERROR ?

2005-05-10 Thread Stepan Kasal
Hello,
  I've just stumbled over this problem:
Makefile.am contains:

foo.h: foo.x
$(GENERATOR) foo.x foo.h

But the GENERATOR command failed and I have empty foo.h.

It would be nice if make deleted foo.h automatically, but this is not the
historical practice.  GNU make enables you to change its behaviour by
mentioning a target:

.DELETE_ON_ERROR:

Could Automake possibly add this target to all generated Makefile.in's?

I understand that the problem is that we want to write portable Makefiles.
OTOH, this change doesn't prevent build from scratch with non-GNU makes.
And most developers use GNU make, and this change can help them with their
work.

WDYT?

Stepan Kasal




Re: .DELETE_ON_ERROR ?

2005-05-10 Thread Andreas Schwab
Stepan Kasal [EMAIL PROTECTED] writes:

 Hello,
   I've just stumbled over this problem:
 Makefile.am contains:

 foo.h: foo.x
   $(GENERATOR) foo.x foo.h

 But the GENERATOR command failed and I have empty foo.h.

Use a temporary file and rename that afterwards.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.




Re: .DELETE_ON_ERROR ?

2005-05-10 Thread Bob Proulx
Stepan Kasal wrote:
 Makefile.am contains:
 
 foo.h: foo.x
   $(GENERATOR) foo.x foo.h
 
 But the GENERATOR command failed and I have empty foo.h.

Yes, because the shell redirection creates the file instead of the
generator.

 It would be nice if make deleted foo.h automatically, but this is not the
 historical practice.  GNU make enables you to change its behaviour by
 mentioning a target:
 
 .DELETE_ON_ERROR:
 
 Could Automake possibly add this target to all generated Makefile.in's?

Is your goal to limit the amount of Makefile.am editing you need to
do?  Because it would seem that it would be easy for you to add that
target to the makefile yourself since you are already adding the
generator lines.

How much control of the generator do you have?  You could make it a
wrapper for the real generator.  Have it delete the target on error.

If you modify your Makefile.am you can use a stanza like this to
detect the error and to remove the file in this particular case.  Then
pass an error up to make on the way out.

  foo.h: foo.x
$(GENERATOR) foo.x foo.h || { rm -f foo.h ; exit 1 ;}

 I understand that the problem is that we want to write portable Makefiles.
 OTOH, this change doesn't prevent build from scratch with non-GNU makes.
 And most developers use GNU make, and this change can help them with their
 work.

The example above is portable to non-gnu make.

Bob