bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* relocatable-prog: avoid warnings from Automake
@ 2019-01-23 21:48 Akim Demaille
  2019-01-23 22:03 ` Ben Pfaff
  2019-01-24  1:08 ` Bruno Haible
  0 siblings, 2 replies; 4+ messages in thread
From: Akim Demaille @ 2019-01-23 21:48 UTC (permalink / raw)
  To: Gnulib bugs; +Cc: Ben Pfaff

Hi Ben,

This is what I get currently:

 cd bison && /bin/sh build-aux/missing automake-1.16 --gnu Makefile
lib/gnulib.mk:1677: warning: .PHONY was already defined in condition TRUE, which includes condition RELOCATABLE_VIA_WRAPPER ...
Makefile.am:71:   'lib/local.mk' included from here
lib/local.mk:16:   'lib/gnulib.mk' included from here
doc/local.mk:168: ... '.PHONY' previously defined here
Makefile.am:68:   'doc/local.mk' included from here

this is because relocatable-prog's Makefile snippet uses .PHONY in a conditional.  AFAICT the only difference is that when not enabled, "make uninstall-relocwrapper" will do nothing instead of being an error.  The rigorous alternative would be to define a variable in the conditional and use it in .PHONY.  Would you prefer that?

commit e460bdd044600c46cea452b66d419ce01fff30d8
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Wed Jan 23 22:42:04 2019 +0100

    relocatable-prog: avoid warnings from Automake
    
    * modules/relocatable-prog: Don't declare PHONY dependencies in
    Automake conditionals.

diff --git a/ChangeLog b/ChangeLog
index b9e15a10a..e9a745ee9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-23  Akim Demaille  <akim@lrde.epita.fr>
+
+	relocatable-prog: avoid warnings from Automake
+	* modules/relocatable-prog: Don't declare PHONY dependencies in
+	Automake conditionals.
+
 2019-01-23  Akim Demaille  <akim@lrde.epita.fr>
 
 	array-list: Pacify warnings about unused arguments (-Wunused-parameter).
diff --git a/modules/relocatable-prog b/modules/relocatable-prog
index ee6fcf5e7..60ebb239a 100644
--- a/modules/relocatable-prog
+++ b/modules/relocatable-prog
@@ -45,8 +45,8 @@ uninstall-relocwrapper:
 		       uninstall ;; \
 	  esac; \
 	fi
-.PHONY: uninstall-relocwrapper
 endif
+.PHONY: uninstall-relocwrapper
 
 Include:
 "relocatable.h"



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: relocatable-prog: avoid warnings from Automake
  2019-01-23 21:48 relocatable-prog: avoid warnings from Automake Akim Demaille
@ 2019-01-23 22:03 ` Ben Pfaff
  2019-01-24  1:08 ` Bruno Haible
  1 sibling, 0 replies; 4+ messages in thread
From: Ben Pfaff @ 2019-01-23 22:03 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Ben Pfaff, Gnulib bugs

On Wed, Jan 23, 2019 at 10:48:23PM +0100, Akim Demaille wrote:
> Hi Ben,
> 
> This is what I get currently:
> 
>  cd bison && /bin/sh build-aux/missing automake-1.16 --gnu Makefile
> lib/gnulib.mk:1677: warning: .PHONY was already defined in condition TRUE, which includes condition RELOCATABLE_VIA_WRAPPER ...
> Makefile.am:71:   'lib/local.mk' included from here
> lib/local.mk:16:   'lib/gnulib.mk' included from here
> doc/local.mk:168: ... '.PHONY' previously defined here
> Makefile.am:68:   'doc/local.mk' included from here
> 
> this is because relocatable-prog's Makefile snippet uses .PHONY in a conditional.  AFAICT the only difference is that when not enabled, "make uninstall-relocwrapper" will do nothing instead of being an error.  The rigorous alternative would be to define a variable in the conditional and use it in .PHONY.  Would you prefer that?

I think your solution is fine.  Thank you.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: relocatable-prog: avoid warnings from Automake
  2019-01-23 21:48 relocatable-prog: avoid warnings from Automake Akim Demaille
  2019-01-23 22:03 ` Ben Pfaff
@ 2019-01-24  1:08 ` Bruno Haible
  2019-01-24  6:38   ` Akim Demaille
  1 sibling, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2019-01-24  1:08 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Ben Pfaff, Akim Demaille

Hi Akim,

> This is what I get currently:
> 
>  cd bison && /bin/sh build-aux/missing automake-1.16 --gnu Makefile
> lib/gnulib.mk:1677: warning: .PHONY was already defined in condition TRUE, which includes condition RELOCATABLE_VIA_WRAPPER ...

I've seen this warning also with respect to normal dependencies like

foo.o : foo.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -c foo.c
if USE_XYZ
foo.o : xyz.h
endif

It would be better if this case was fixed in Automake.

But in the absence of Automake maintenance, your proposed patch is good.
Maybe add a comment:
# Automake warns about conditionally added dependencies to unconditionally defined targets.

Bruno



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: relocatable-prog: avoid warnings from Automake
  2019-01-24  1:08 ` Bruno Haible
@ 2019-01-24  6:38   ` Akim Demaille
  0 siblings, 0 replies; 4+ messages in thread
From: Akim Demaille @ 2019-01-24  6:38 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Ben Pfaff, Gnulib bugs



> Le 24 janv. 2019 à 02:08, Bruno Haible <bruno@clisp.org> a écrit :
> 
> Hi Akim,

Hi Bruno,

>> This is what I get currently:
>> 
>> cd bison && /bin/sh build-aux/missing automake-1.16 --gnu Makefile
>> lib/gnulib.mk:1677: warning: .PHONY was already defined in condition TRUE, which includes condition RELOCATABLE_VIA_WRAPPER ...
> 
> I've seen this warning also with respect to normal dependencies like
> 
> foo.o : foo.c
> 	$(CC) $(CPPFLAGS) $(CFLAGS) -c foo.c
> if USE_XYZ
> foo.o : xyz.h
> endif
> 
> It would be better if this case was fixed in Automake.

Well, you mean adding the feature :)

> But in the absence of Automake maintenance, your proposed patch is good.
> Maybe add a comment:
> # Automake warns about conditionally added dependencies to unconditionally defined targets.

I've added that.  Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-24  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23 21:48 relocatable-prog: avoid warnings from Automake Akim Demaille
2019-01-23 22:03 ` Ben Pfaff
2019-01-24  1:08 ` Bruno Haible
2019-01-24  6:38   ` Akim Demaille

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).