We help IT Professionals succeed at work.

make: Nothing to be done for 'all'

VWrestle97 asked

I am getting the error, "make: Nothing to be done for 'all'." when I execute the 'make' command.  I tried reinstalling the 'make' install from the 'setup.exe' but still getting this error.  I know I have a Makefile because I ran 'make' on the same file from another computer.  What could be causing the problem?
Watch Question


Do I need automake?
When you use make you need to provide a target.  Like:

make clean


make Example

If you just type 'make' your system tries the default target, "all".  so typing 'make' is just like typing:

make all

So it goes to your makefile looking for the 'all' target.  And gives that error if it does not find one.


Is the target the name of the Makefile or something in the Makefile such as, "all: $(PGM)".  Would you be able to identify the name of the target from the code below?
PGM = \
  create_bins_u create_bins_s \
  randy_create_bins_u randy_create_bins_s \

BF_3D_DOTO = \
  dtime.o cmdlineopts.o endian_utils.o main_beamforming_3d.o scan_params_file.o \
  complex_mult.o complex_sum.o complex_divide.o complex_sqrt.o \
  Readmode.o Propmode.o Covmat.o Read_fft_data.o Rotate.o

  cmdlineopts.o tiltcor_v6.o scan_params_file.o

all: $(PGM)


#makes the crypt program

create_tilt_heading.o: create_tilt_heading.c Makefile $(DOTH) $(DOTL)
      $(CC) -c $(CFLAGS) -o $@ $<

create_bins_u.o: create_bins_u.c Makefile $(DOTH) $(DOTL)
      $(CC) -c -USIGNED_DATA $(CFLAGS) -o $@ $<

create_bins_s.o: create_bins_s.c Makefile $(DOTH) $(DOTL)
      $(CC) -c -DSIGNED_DATA $(CFLAGS) -o $@ $<

randy_create_bins_u.o: randy_create_bins_u.c Makefile $(DOTH) $(DOTL)
      $(CC) -c -USIGNED_DATA $(CFLAGS) -o $@ $<


(Scenario 1)
I did the same "make" command with no arguments for the same file but on a different computer before this one (#1) and it processed it just fine but this computer (#2) displays "make: Nothing to be done for 'all'".  Why?

(Scenario 2)
I then tried "make all" on both computers and both had the same reaction as stated in Scenario 1.

(Senario 3)
I then tried "make <MakeFileName>" and both computers displayed, "make: Nothing to be done for 'all'"

Why is Scenario 1 not consistent?
Most Valuable Expert 2014
Top Expert 2015

It means that everything that needs to be made for all: has already been made

is the all target.  But you are assigning it to a variable $PGM.

That variable resolves to the following targets:

create_bins_u create_bins_s randy_create_bins_u randy_create_bins_s

And it makes each f them in order .. though the last was not in your sample.  If all files are up to date and noting needs to be done make will do nothing ... Thus not wasting processor time.  touch the source files to alter their modified date and run make again to see it do something.


If I did "make -W all", wouldn't that force everything to be rebuilt?  It doesn't seem to work.
Actually slap me with a fish ... the targets $PGM resolve to are:

create_bins_u create_bins_s randy_create_bins_u randy_create_bins_s

But the targets in your file have .o's on the end.

create_bins_u is not create_bins_u.o on most systems.  You should be getting errors saying it doesn't know how to build "create_bins_u" etc unless there are valid targets for them elsewhere in the file,
-W will do that but the usage is different.

-------Usage -------
       -W file,
          Pretend that the target file has just been      modified.   When  used
          with  the -n flag, this shows you what would happen if you were to
          modify that file.  Without -n, it is almost the same as running  a
          touch  command  on the given file before running make, except that
          the modification time is changed only in the imagination of  make.

also, it is standard to have a target called "clean" and "make clean" should delete all the compiled files so that the next make all rebuilds everything from scratch.  If you have a clean target you can do that.


"If you have a clean target"... what exactly do you mean by that?

If I wanted to clean by removing all .exe and .o files my clean target might look like this:

clean :
<tab>rm -f *.o *.exe

Then whenever I ran make with the target clean by typing:

make clean

it would execute the rm statement.  So next time I run make it has to rebuild those objects.  It is good practice to include that target in your makefile when you write one ... but if you don't have one then you should not attempt to add one unless you know exactly what you want the clean to remove.


Ok,  now I can see why Scenario 1 wasn't consistent; It's because it was never modified when I copied the files to that computer but the other computer had the modified files but didn't realize it until now.  Thanks for the hint.

So, after making my Makefile, do I need to do anything else before running "./ <executable>" or am I good to go because when I run it I get the error, "./<executable>: cannot execute binary file" ... why is that?


what does this clean do?

      $(RM) *.[o]
Well ... you might need to chmod the binary.  Most systems are nice and automatically flag compiled files a executable, but some are not.  

ls -alF executable

that should give you file details.  part of it is wrx (read, write, execute) flags.  If there aren't any x's then the system doesn't consider it an executable and you need to

chmod 755 executable

to give yourself permission to execute it.

And that clean executes $(RM) *.[o] at the command line.  You'll  need to find where the RM variable is defined to tell what that is.  Anything in the form $(something) is a variable.  I bet it is something like:

RM = rm -f $(OBJECTDIR)

And that OBJECTDIR is defined somewhere else. and so on and so on.

Good luck and good night =)


but is you use the

clean :
rm -f *.o *.exe

to delete object files, then should the make still be able to rebuild the executable?
Oh yeah ... the word executable in

chmod 755 executable

was meant to be the name of your file, should have put it in <>,  Same for the ls -alF statement.

And your compiler probably will set them executable automatically, but you said you copied it here and then the make didn't do anything.  So the binary here was not compiled here and thus not flagged by the compiler as executable.  And of course if the computer you copied from was a different architecture than the computer you copied too its binary is no good.  You need to compile one locally.

Make doesn't check that the files are "good" when it determines if it needs to do anything.  It just looks at file names and their modified stamps.  You could replace the final executable with a picture of your dog and as long as its name is the same and its newer than all its component files make will pat itself on the back for a job well done and tell you all's well.

Really going to bed this time =).  
but is you use the

clean :
<tab>rm -f *.o *.exe

to delete object files, then should the make still be able to rebuild the executable?

Yep.  As long as it has access to the source code.