[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU Make feature request, pattern matching
From: |
Marty Leisner |
Subject: |
Re: GNU Make feature request, pattern matching |
Date: |
Sun, 05 Oct 2008 23:48:15 +0000 |
It often is useful to give derived files special names
(like %-stage1.xml) so youf rule might be:
%-stage1.xml: %.xml
Also in your example:
%.xml: $(src)/%.xml
you would also have a problem if $(srcdir) == $(objdir)
marty
Noah Slater <address@hidden> writes on Tue, 30 Sep 2008 20:57:39 +01
00
> Hey,
>
> Thanks for the reply.
>
> On Tue, Sep 30, 2008 at 03:08:18PM -0400, Paul Smith wrote:
> > Have you considered using VPATH? It looks to me (based on this
example;
> > I didn't try to get the tarball) that you have a good fit for it here.
> > Try rewriting your rule like this:
> >
> > VPATH := $(src)
> >
> > %.html: %.txt
> > $(info example making $@ from $<)
> >
> > and see if that works.
>
> I didn't know how much detail to go into in my original email, so I left
quite a
> lot of details out about why I've ended up in this situation. Sorry for
any
> confusion this may cause.
>
> As for this particular idea, yeah, I tried that and it works perfectly.
>
> Unfortunately there are also cases where a source file has to be moved
to the
> directory and processed along the way, perhaps to add metadata (such as
author
> name or copyright notices) or other information that my software knows
about.
>
> This results in rules such as:
>
> %.xml: %.xml
>
> Clearly, this doesn't work because GNU Make correctly assumes they are
the same.
>
> Of course, with my previous suggestion, this would be written:
>
> %.xml: $(src)/%.xml
>
> But this fails for the same reasons.
>
> I am generating the targets dynamically (by scanning the source
directory using
> Python and using GNU Make's standard makefile generation hooks) and it
seems I
> that a possible solution is to do this:
>
> # this define is written verbatim in the core makefile
>
> define build_txt_html
> $(info stuff here)
> endef
>
> # these next too lines are from the generated makefile
>
> all: dir/index.html
>
> dir/index.html: $(src)/dir/index.txt; $(build_txt_html)
>
> It seems that this would work, and the format of the "configuration"
file is
> untouched, but it does feel slightly un-make-like.
>
> Your thoughts or feedback is very welcome.
>
> Thanks,
>
> --
> Noah Slater, http://bytesexual.org/nslater
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make