Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

make

Status
Not open for further replies.

BaharPamuk

Programmer
Jan 30, 2006
16
0
0
TR
Hi all,

In my project i make modifications in one of the files but when i run make it says :
" Nothing to be done for `first'."

It occurs for only one file in the project. The modifications that i made are not perceived, even the parse errors.

I am sure i am working in the correct directory and changing the correct file.

What may cause this?

Thanks.
 
try make -d

You will get a whole load of output which tells you what it is doing.
 
Sounds like your not listing dependencies correctly... "nothing to be done" means that in dependency list, and dependancy's dependancy lists don't have whatever file you modified.

[plug=shameless]
[/plug]
 
I have to run "make clean" before make.

What is a dpendency list? How is it changed?

Thanks..
 
make clean will always work, but then your make file could be replaced with a simple shell script. The point of make is that it only rebuilds the parts that need to be rebuilt.

The format for a make is:

rule: dependency
-TAB-command...

That is to say. If I have class with header file a.cpp a.h
and a driver.cpp with the main and it's functions; then the make file would look like this (replacing the leading 3 spaces of the second line of each rule with a real tab char):

Code:
all: driver.o a.o a.h
  g++ driver.o a.o -o prog

driver.o: driver.cpp
  g++ -c driver.cpp

a.o: a.cpp a.h
  g++ -c a.cpp

So, to do all, it checks to see if the rule driver.o, the rule a.o and the file a.h are up to date. The header is needed to link, so it's needs to be listed as a dependency everywhere it's included. If the dependancies of any of the dependencies are found to be out of date, it executes the rules for that dependency and then reruns the command for all.

If the file isn't listed as dependency for the rule that makes that part of the program, then changing that file won't cause anything to happen -- which is your problem. Your rules are right, but you need to rm the .os (make clean typically does something like "rm -f *.o *~ core"). The .os seem to be set properly as dependencies but not the .cpp or .h that you were editing.

Please list your .cpp .o, specify which has main() in it and show us your makefile or Makefile... Then we can tell you what is causing this inconvience.

See Greg's tutorial on make for more information:
[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top