c – make: Nothing to be done for `all

c – make: Nothing to be done for `all

Sometimes Nothing to be done for all error can be caused by spaces before command in makefile rule instead of tab. Please ensure that you use tabs instead of spaces inside of your rules.

all:
<t>$(CC) $(CFLAGS) ...

instead of

all:
    $(CC) $(CFLAGS) ...

Please see the GNU make manual for the rule syntax description: https://www.gnu.org/software/make/manual/make.html#Rule-Syntax

Remove the hello file from your folder and try again.

The all target depends on the hello target. The hello target first tries to find the corresponding file in the filesystem. If it finds it and it is up to date with the dependent files—there is nothing to do.

c – make: Nothing to be done for `all

When you just give make, it makes the first rule in your makefile, i.e all. You have specified that all depends on hello, which depends on main.o, factorial.o and hello.o. So make tries to see if those files are present.

If they are present, make sees if their dependencies, e.g. main.o has a dependency main.c, have changed. If they have changed, make rebuilds them, else skips the rule. Similarly it recursively goes on building the files that have changed and finally runs the top most command, all in your case to give you a executable, hello in your case.

If they are not present, make blindly builds everything under the rule.

Coming to your problem, it isnt an error but make is saying that every dependency in your makefile is up to date and it doesnt need to make anything!

Leave a Reply

Your email address will not be published.