bugmake - Bugs: bug #43550, Compiling files in a directory...

 
 

bug #43550: Compiling files in a directory with the same name as the source code fails

Submitted by:  None
Submitted on:  Thu 06 Nov 2014 06:30:44 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.81Operating 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.

 

Thu 06 Nov 2014 06:42:59 PM UTC, comment #2:

Sorry,

"... non-phony targets should update a single FILE with the same name as the target ..."

Taahir Ahmed <ahmedtd>
Thu 06 Nov 2014 06:41:34 PM UTC, comment #1:

"foo" in the Makefile refers to the directory "foo". Because the directory has no prerequisites, it is considered up to date as long as it exists (up-to-date means newer than all prerequisites).

In general, non-phony targets should update a single rule with same name as the target, so what you probably want is:

foo/foo: foo/foo.cpp
g++ -o $@ $<

The $@ and $< are shorthand for the rule target and the first prerequisite, respectively.

Taahir Ahmed <ahmedtd>
Thu 06 Nov 2014 06:30:44 PM UTC, original submission:

:: Software ::
Debian 3.14 Kali
OS 10.10 Yosemite
Mint 17
Make 3.81

:: Steps to reproduce ::
1. Create a directory called foo.
2. Create a file with in directory foo called foo.cpp.
3. Create a Makefile foo's parent directory with these contents
all: foo

foo:
g++ ./foo/foo.cpp -o ./foo/foo
4. Run make in foo's parent directory.

:: Actual Behavior ::
Running `make` reports "Nothing to be done for all". Running `make foo` reports that "Foo is up to date". Nothing gets compiled.

:: Expected Behavior ::
Make should compile foo.cpp or produce some sort of error message if it can't compile foo.cpp.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #32380:  Makefile added by None (48B - application/octet-stream - Example files that were mentioned in the report.)
file #32381:  foo.cpp added by None (90B - text/x-c++src - Example files that were mentioned in the report.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Updated the item)
  • -unavailable- added by ahmedtd (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 18 Feb 2015 05:27:09 PM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed
    Thu 06 Nov 2014 06:30:44 PM UTCNoneAttached File-=>Added Makefile, #32380
      Attached File-=>Added foo.cpp, #32381

    Back to the top


    Powered by Savane 3.1-cleanup1