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

Submitter:  None
Submitted:  Thu 06 Nov 2014 06:30:44 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.81 Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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 Files:
   
   
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
  • -email is unavailable- added by psmith (Updated the item)
  • -email is unavailable- added by ahmedtd (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-18 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed
    2014-11-06 None Attached File- Added Makefile, #32380
        Attached File- Added foo.cpp, #32381

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code