[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: Forcing dependencies on wmk

On Mon, Jun 07, 1999 at 06:49:42PM +0200, Denis Barbier wrote:
> On Mon, 7 Jun 1999, James A. Treacy wrote:
> > One thing that would be very useful is a way to force a dependency
> > on a file, or a set of files. This would allow you to to have
> > pages that use perl scripts, which grab data from other files, to
> > be made automatically using wmk. Something like
> > 
> > #depends "news/*.wml"
> > would allow me to get rid of a lot of stuff currently in Makefiles.
> Yes, seems reasonable,
> I think that a special attribute is the easiest solution, e.g.
>   #include "news/foo.wml" depend
> Unfortunately, i am not sure whether wildcards are easy to deal with.
I thought this would be a problem. It is simple to get a list if each
dependency line is restricted to files in a single dir and everything
after the last slash is a valid reg exp. This would cover the most common
case. Generalizing it would be a pain (what algorithm does 'ls' use?).

Here is what I had in mind:

@file = split('/', $string);
if (#$file) {
	$expr = pop(@file);
	$dir = join('/', @file);
else {
	$expr = $string;
	$dir = '.';
opendir(DIR, $dir);
@depends_list = grep { /$expr/  && -f "$dir/$_" } readdir(DIR);

A more general solution would, of course, be preferable (plus some error
checking).  It is likely someone on this list will have an idea how to
approach this.

> > Also, does the new wmk check dependencies recursively? It is common
> > to have #includes (or #use) in included files.
> Yes :-)
> Only user templates are checked, system files are supposed immutable.
Exactly what is needed. Another great job. :)

Jay Treacy
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com