[m-dev.] For review: Split auto-generated dependencies

Warwick Harvey wharvey at cs.monash.edu.au
Thu Jul 15 17:13:39 AEST 1999


> On 15-Jul-1999, Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> > Split the automatically generated `.dep' file into two files.  The new `.dv' 
> > file contains all the variable definitions which used to be in the `.dep' 
> > file, which now contains just the rules.
> [...]
> > Index: compiler/modules.m
> > @@ -2503,10 +2558,16 @@
> >  	list__foldl(append_to_init_list(DepStream, InitFileName), Modules),
> >  	io__write_string(DepStream, "\n"),
> >  
> > -	io__write_strings(DepStream, [
> > -		InitCFileName, " : ", DepFileName, "\n",
> > +	% Note we have to do some ``interesting'' hacks to get
> > +	% `$(ALL_C2INITARGS)' to work in the dependency list (and not
> > +	% complain about undefined variables).
> > +	io__write_strings(DepStream, [
> > +		InitCFileName, " : ", DepFileName, " ", DvFileName,
> > +			" $(foreach @,undefined,$(foreach *,", MakeVarName,
> > +			",$(ALL_C2INITARGS)))\n",
> 
> The hacks that rely on features specific to GNU Make
> should be disabled if --no-assume-gmake was set.

OK.  (Does anybody use this option, or is it kept in the hope that one day 
the Mmake.rules and Mmake.vars files will be available in standard Make 
compatibility versions?  Of course, I'm in the process of making this 
harder...)

> To handle that situation, if --assume-gmake is not set, then you could
> either just drop that dependency, or add it unconditionally.

OK, how about this:

+       io__write_strings(DepStream, [
+               InitCFileName, " : ", DepFileName, " ", DvFileName
+       ]),
+       globals__io_lookup_bool_option(assume_gmake, Gmake),
+       ( { Gmake = yes } ->
+               % Note we have to do some ``interesting'' hacks to get
+               % `$(ALL_C2INITARGS)' to work in the dependency list (and
+               % not complain about undefined variables).
+               io__write_strings(DepStream, [
+                       " $(foreach @,undefined,$(foreach *,", MakeVarName,
+                       ",$(ALL_C2INITARGS)))\n"
+               ])
+       ;
+               io__write_string(DepStream, " $(ALL_C2INITARGS)\n")
+       ),

Since the parts of `$(ALL_C2INITARGS)' which don't work and cause warnings 
without the hacks (i.e. the per-file definitions) rely on GNU Make features 
anyway, it seems (relatively) safe to assume that they've been taken care of 
in some other way (e.g. by removing the `TARGET_' component of 
`ALL_C2INITARGS').

> Presuming you make the change suggested above, that should be
> "When generating @file{.d}, @file{.dv}, and @file{.dep} files, ...".

Do you have a convention regarding commas in lists?  I believe "proper" 
English is "A, B and C" but I've seen a couple of instances of "A, B, and C" 
lately.

Anyway, updated diff fragment:

 @item --no-assume-gmake
-When generating @file{.dep} files, generate Makefile
-fragments that use only the features of standard make;
+When generating @file{.d}, @file{.dep} and @file{.dv} files,
+generate Makefile fragments that use only the features of standard make;
 do not assume the availability of GNU Make extensions.


Warwick

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list