help-make
[Top][All Lists]
Advanced

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

Re: ignore specific file in VPATH/vpath


From: Paul Smith
Subject: Re: ignore specific file in VPATH/vpath
Date: Tue, 15 May 2018 19:24:06 -0400

On Sat, 2018-05-12 at 11:34 +0200, Jannick wrote:
> Question - Is there any way to say something like "vpath %.c <list of
> folder names>, but exclude file_1.c, ..., file_n.c' from '%.c'" (i.e.
> something like 'A \minus B'? I believe the make syntax does not allow
> any valid "\minus statement" for the file scope, I have not seen any
> at least, but I might be wrong. Or could "$(filter-out ... )" help
> here with a loop across admissible .c files?

I see.  I think the comments about make -B were adding more confusion
than clarity, for what it's worth.

The answer to your question, as you've discovered, is no, there's no
capability to omit certain files from vpath.

My only suggestion other than what you've got (using pattern rules to
ensure that the build/ versions of the files have different names than
the src/ versions) is to force the right version by providing a
pathname, so that it won't match via vpath.  For example, you could
write your rule like this:

    src_dir = ../src
    prog: prog.o parse.o
    vpath %.y $(src_dir)
    vpath %.c $(CURDIR) $(src_dir)

    # remove the default rule for %.c:%.y
    %.c: %.y

    # Define a new rule that builds a local .c
    $(CURDIR)/%.c : %.y
            bison ...

I'm not exactly sure that you need to add $(CURDIR) to vpath %.c but
you probably do.

I didn't test this but it seems like it should work.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]