bugmake - Bugs: bug #10597, VPATH not searched for a...

 
 

bug #10597: VPATH not searched for a prerequisite file that is specified in the commands section by its name

Submitted by:  None
Submitted on:  Wed 06 Oct 2004 02:31:27 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: NoneOperating System: Any
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 06 Oct 2004 02:42:51 PM UTC, comment #1:

The results you see are exactly correct. The fact that GNU make does not attempt to replace the content of the command script, and the right way to handle this (as you discuss, by using automatic variables) is described in the GNU make manual section "Writing Shell Commands with Directory Search".

I'm not sure what you mean by "it won't search VPATH for $@". $@ is an automatic variable that is set to the name of the target file AFTER all the prerequisite resolution is done, just before the command script is expanded and invoked.

As far as searching VPATH for include files, the manual specifically states that VPATH is used for searching for rule prerequisites--include files aren't prerequisites.

Paul D. Smith <psmith>
Project Administrator
Wed 06 Oct 2004 02:31:27 PM UTC, original submission:

Hi,

I believe I may have found a bug with GNU Make version 3.80...

SUMMARY:

There seems to be an issue with GNU Make in that it fails to search in VPATH for a prerequisite file that is specified in the commands section by its name (or a variable containing its name).

TO RECREATE THE BEHAVIOUR:

1) touch /tmp/file.c
2) mkdir /tmp/testing
3) cd /tmp/testing
4) Create a Makefile containing the following:

VPATH = /tmp

file = file.c

file.o : $(file)
ls -l $(file)

5) Run, "make".

You will get the output:

ls -l file.c
ls: file.c: No such file or directory
make: *** [file.o] Error 1

The error occurs because "file.c" does not exist in
/tmp/testing/. But surely GNU Make should find it, since VPATH is set to allow it to find the file, and the file it needs is indeed a prerequisite file.

WORK-AROUND:

To rectify the situation, change the Makefile so that it contains:

VPATH = /tmp

file = file.c

file.o : $(file)
ls -l $<

You will then get output similar to this:

ls -l /tmp/file.c
-rw-r----- 1 jdhunt jdhunt 0 Oct 6 15:08 /tmp/file.c

ADDITIONAL:

It also seems that GNU Make will not search in VPATH for "$@". Also, it will not search VPATH for "include" files.
Whatever happens with this bug, please could the excellent GNU Make manual be updated WRT VPATH: more examples would be useful.

ENVIRONMENT:

My system is running Fedora Core 2. "make --version" returns:

GNU Make 3.80
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

rpm -q make returns:

make-3.80-3

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 2 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Wed 06 Oct 2004 02:42:51 PM UTCpsmithStatusNone=>Not A Bug
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1