[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: ignore specific file in VPATH/vpath
From: |
Jannick |
Subject: |
RE: ignore specific file in VPATH/vpath |
Date: |
Sat, 19 May 2018 16:53:35 +0200 |
On Tue, 15 May 2018 19:24:06 -0400, Paul Smith wrote:
> 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.
Thanks for this suggestion!
For the record here a simplified version which works and suits the objective to
properly build in 'build'. The point is to prefix the target of c files to be
generated with './' (was $(CURDIR) in your suggestion). That make make ignore
src/parse.c. Moreover, the vpath statements can be replaced by one single VPATH
statement.
VPATH = ../src
prog: prog.o parse.o
# remove the default rule for %.c:%.y
%.c: %.y
# Define a new rule that builds a local .c
./%.c : %.y
bison -o $@ $<
This makes script pretty simple now.
Many thanks again for taking the time.
Regards,
J.