bugmake - Bugs: bug #17230, Leading ./ is stripped from...

 
 

bug #17230: Leading ./ is stripped from targets and prerequisites

Submitted by:  None
Submitted on:  Sat 29 Jul 2006 12:59:56 AM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: DuplicatePrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.79.1Operating 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.

 

Mon 02 Jan 2017 08:55:11 PM UTC, comment #2:

I don't think bug #15338 is related. However this is a duplicate of bug #10708.

Paul D. Smith <psmith>
Project Administrator
Sat 29 Jul 2006 01:01:25 AM UTC, comment #1:

bug #10708
bug #15338

Anonymous
Sat 29 Jul 2006 12:59:56 AM UTC, original submission:

Below is a stripped-down version of a much more complicated makefile.

Several %.r files are targets. Each %.r goes into one directory called
$(RES_DIR), and depends on a %.exe of the same name in another
directory, called $(EXE_DIR).

The %.exe are intermediate targets. Normally they are generated by
compiling, and have a pattern as a prerequisite too, but for these
purposes, no prerequisite is necessary, and we'll just create a shell
script executable.

The problem: If the %.exe files are explicitly listed as coming from
./ (the working directory), the ./ is stripped from the targets and
prerequisites.

That is, if $(EXE_DIR) is . then $(EXE_DIR)/ is not left intact in
$@ and $<.

This occurs in three contexts in which the ./%.exe pattern is used
below: When the ./%.exe is a target, when the ./%.exe is a
prerequisite, and when the pattern is used to declare the %.exe
targets as immediate:

# make
$(EXES) = ./a.exe ./b.exe GOOD
echo "echo I hope . is in your path" > a.exe Should be ./a.exe
chmod a+x a.exe Should be ./a.exe
a.exe Should be ./a.exe
I hope . is in your path
$(EXES) = ./a.exe ./b.exe GOOD
echo "echo I hope . is in your path" > b.exe Should be ./b.exe
chmod a+x b.exe Should be ./b.exe
b.exe Should be ./b.exe
I hope . is in your path
rm a.exe b.exe Consistent

If . is not in your PATH, then this error occurs:

# make
$(EXES) = ./a.exe ./b.exe
echo "echo I hope . is in your path" > a.exe
chmod a+x a.exe
a.exe Should be ./a.exe - FATAL
make: a.exe: Command not found
make: *** [results/a.r] Error 127
rm a.exe

The problem is the same whether ordinary rules, pattern rules, or
static rules are used.

There are workarounds, such as adding . to your PATH (insecure!),
explictly using ./$< instead of $< (won't work if EXE_DIR is changed
to an absolute path), etc. But none of these should be necessary,
because the explicit ./%.exe pattern should have remained intact.

For the purposes of comparing whether two targets or prerequisites
are the same name, leading ./'s should be ignored. But leading ./'s
should be kept intact in automatic variable expansions such as $<
and $@.

(Bugs 10708 and 15338 are the same thing. This is just another example
showing how it can fatally ruin a project -- a make "project", that is.)

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #10437:  Makefile added by None (401B - application/octet-stream - Makefile)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  •  

    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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 02 Jan 2017 08:55:11 PM UTCpsmithStatusNone=>Duplicate
      Open/ClosedOpen=>Closed
    Sat 29 Jul 2006 12:59:56 AM UTCNoneAttached File-=>Added Makefile, #10437

    Back to the top


    Powered by Savane 3.1-cleanup1