develooper Front page | perl.perl5.build | Postings from March 2004

Re: runmakedepend patch

Thread Previous | Thread Next
From:
Andrew Dougherty
Date:
March 29, 2004 10:19
Subject:
Re: runmakedepend patch
Message ID:
Pine.SOL.4.58.0403291145560.9877@maxwell.phys.lafayette.edu
On Sat, 20 Mar 2004, H.Merijn Brand wrote:

> --8<--- This patch
> p4 -dpu diff
> ==== //depot/metaconfig/U/modified/Finish.U#5 - /pro/3gl/CPAN/metaconfig/U/modified/Finish.U ====
> 38c38
> < ?MAKE:Finish: Chk_MANI Extract Myread Oldsym Magic_h cat rm contains \
> ---
> > ?MAKE:runmakedepend Finish: Chk_MANI Extract Myread Oldsym Magic_h cat rm contains \
> 40a41,43
> > ?S:runmakedepend:
> > ?S:   This variable defines if Configure runs 'make depend'
> > ?S:.

> yields:
> :
> Looking for dependency cycles...
>     Cycle found for:
>         (#1) Oldsym
>         (#1) runmakedepend
>         (#1) Config_h
>         (#1) Magic_h
>     Cycle involves:
>         (?) End: runmakedepend
>         (?) Config_h: End Config_sh
>         (?) Config_sh: End
>         (?) Oldsym: Config_sh
>         (Finish) runmakedepend: Oldsym Magic_h
>         (?) Magic_h: Config_h
> Done.

Ah, yes, I see.  As the very last unit, Finish.U is special.  In
particular, what's happening is that 'runmakedepend' is now one of the
symbols made by Configure, and hence it is in the $W list of "Wanted"
symbols.  The End.U unit depends on $W (and hence on Finish.U), but the
End.U unit is supposed to come just before the Finish.U unit.  Hence you
get the circular dependency.

One solution (the direction you were headed previously, I think) might be
to try to put in enough metalint directives to allow you to declare (and
describe) the new runmakedepend variable without actually declaring it
'made' anywhere.  You end up fighting metalint a lot, and I'm unsure if
you can ever win :-).

Another solution is to make up a new unit, runmakedepend.U, and declare
the new variable in that unit in the usual way.  (There's a catch, of
course, in that you can't tell if the generated Makefile will have a
'depend:' target until after it's extracted, and that won't have happened
yet when the runmakedepend unit is called.)

Here's a sample runmakedepend.U unit:

?RCS: $Id: runmakedepend.U,v $
?RCS:
?RCS: Copyright (c) 2004 The Perl Foundation
?RCS:
?RCS: You may distribute under the terms of either the GNU General Public
?RCS: License or the Artistic License, as specified in the README file.
?RCS:
?RCS: $Log: runmakedepend.U,v $
?RCS:
?MAKE:runmakedepend:
?MAKE:	-pick add $@ %<
?S:runmakedepend:
?S:	This variable designates whether Configure is to run
?S:	'make depend'.  This unit exists only to define the variable.
?S:	(Presumably it is set by a Configure command-line option.)  The actual
?S:	code to ask the question and to run 'make depend' is in the Finish.U
?S:	unit, since the question only gets asked if the extracted Makefile has
?S:	a depend: rule, and the extraced Makefile doesn't yet exist.  We can't
?S:	put the definition of runmakedepend into the Finish.U unit, however,
?S:	since it's the very last unit and it can't define any new variables.
?S:	(Such variables would be listed as "Wanted" and End.U would end up
?S:	depending on them, leading to a circular dependency.)
?S:.
?X: Actually, we don't set it or do anything here -- that all happens
?X: in Finish.U.
?LINT:set runmakedepend

Using it will require patching Finish.U on top of what you have done so
far to tell it that 'runmakedepend' is an external dependency now, and to
tell metalint that we're going to change it (assuming you want to record
the actual value in config.sh, which I would assume you do).


--- U/modified/Finish.U.mb	2004-03-29 08:55:06.000000000 -0500
+++ U/modified/Finish.U	2004-03-29 11:33:28.000000000 -0500
@@ -35,14 +35,12 @@
 ?X: SH files, which among other things produce config.h and (usually) Makefile.
 ?X: It offers to do a make depend if the Makefile contains that target.
 ?X:
-?MAKE:runmakedepend Finish: Chk_MANI Extract Myread Oldsym Magic_h cat rm contains \
-	test package make
+?MAKE:Finish: Chk_MANI Extract Myread Oldsym Magic_h cat rm contains \
+	test package make runmakedepend
 ?MAKE:	-pick add $@ %<
-?S:runmakedepend:
-?S:	This variable defines if Configure runs 'make depend'
-?S:.
 ?F:!config.sh
 ?T:pwd
+?LINT:change runmakedepend

 : Finish up by extracting the .SH files
 case "$alldone" in
@@ -108,9 +106,11 @@
 	. UU/myread
 	case "$ans" in
 	y*)
+		runmakedepend='y'
 		$make depend && echo "Now you must run '$make'."
 		;;
 	*)
+		runmakedepend='n'
 		echo "You must run '$make depend' then '$make'."
 		;;
 	esac



-- 
    Andy Dougherty		doughera@lafayette.edu

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About