Bug or not? % character not expanded in phony targets

2000-06-16 Thread Laird Nelson

It appears that the pattern matching character ("%") is not expanded in
phony targets.

For example, given a GNUmakefile like this:

  TARGET_NAMES:=phony-a phony-b phony-c
  
  d : $(TARGET_NAMES)
  
  phony-% :
@echo Phony target is $@
  
  .PHONY : $(TARGET_NAMES) d

...making "d" results in nothing being echoed.

However if you remove $(TARGET_NAMES) from the .PHONY rule (i.e. render
that list of targets non-phony), then the pattern rule (phony-%) is
correctly expanded and the echo command is executed.

Is this desired behavior?

make --version output:

  GNU Make version 3.78.1, by Richard Stallman and Roland McGrath.
  Built for sparc-sun-solaris2.6
  Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
  Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.
  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE.
  
  Report bugs to [EMAIL PROTECTED].


Cheers,
Laird




Re: PATCH: .SECONDARY target with no dependencies does not work correctly.

2000-06-16 Thread Paul D. Smith

%% Seth M LaForge [EMAIL PROTECTED] writes:

  sml (Make version 3.79.)  Consider:
  sml   % cat Makefile 
  sml   %.1: %.2
  sml   cp $ $@
  sml   %.2: %.3
  sml   cp $ $@
  sml   .SECONDARY:
  sml   % ls
  sml   Makefile  foo.3
  sml   % make foo.1
  sml   cp foo.3 foo.2
  sml   cp foo.2 foo.1
  sml   rm foo.2

  sml According to the documentation, the .SECONDARY target should
  sml cause all files to be considered secondary (and thus not
  sml deleted), but it doesn't work.

This is obliquely stated in the documentation:

 `.SECONDARY'
 The targets which `.SECONDARY' depends on are treated as
 intermediate files, except that they are never automatically
 deleted.  *Note Chains of Implicit Rules: Chained Rules.

 `.SECONDARY' with no prerequisites marks all file targets mentioned
  ^^
 in the makefile as secondary.
 ^^^

Note the second paragraph.  The targets you give aren't mentioned in the
makefile; they're built using implicit rules.

I agree with you, however, that this is a strange restriction and this
area needs to be revisited, for all of PRECIOUS, INTERMEDIATE, and
SECONDARY.

I'll file an enhancement request about it.

-- 
---
 Paul D. Smith [EMAIL PROTECTED]  Find some GNU make tips at:
 http://www.gnu.org  http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




Re: PATCH: .SECONDARY target with no dependencies does not work correctly.

2000-06-16 Thread Seth M LaForge

"Paul D. Smith" [EMAIL PROTECTED]:
 This is obliquely stated in the documentation:
 
  `.SECONDARY'
  The targets which `.SECONDARY' depends on are treated as
  intermediate files, except that they are never automatically
  deleted.  *Note Chains of Implicit Rules: Chained Rules.
 
  `.SECONDARY' with no prerequisites marks all file targets mentioned
   ^^
  in the makefile as secondary.
 
 Note the second paragraph.  The targets you give aren't mentioned in the
 makefile; they're built using implicit rules.

Yes, but aren't all explicitly mentioned targets considered secondary
anyway?  If so, it seems like ".SECONDARY: " serves no purpose...

For the complex Makefiles I'm working on now, intermediate deletion
was causing deletion of object files which should not be deleted, and
I decided to just turn it off entirely.  However, without .SECONDARY
behaving as I'd like it to, I don't see how to acheive this.

 I agree with you, however, that this is a strange restriction and this
 area needs to be revisited, for all of PRECIOUS, INTERMEDIATE, and
 SECONDARY.
 
 I'll file an enhancement request about it.

Thanks.

Seth




Re: make 3.79 status problem

2000-06-16 Thread Paul D. Smith

%% Regarding make 3.79 status problem; you wrote:

  alt Doing a "make -q" with the following makefile returns a 1 status
  alt where it should really return a 0 status.  Can this be fixed?  I
  alt know I could wrap an ifndef expression around the ALL commands,
  alt but I use this a lot.

Can you give me a more complete example?  If you have that makefile and
you run make with -q it _should_ exit with 1, since it needs to build
"foo"... ?  You must have some other setup beyond just the makefile.

-- 
---
 Paul D. Smith [EMAIL PROTECTED]  Find some GNU make tips at:
 http://www.gnu.org  http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist