. Advertisement .
..3..
. Advertisement .
..4..
I am creating a make file by going through an eg pgm and then I get this error message:
desktop:~/eg_make_creation$ make all
make: Nothing to be done for `all'.
The following files can be found in my folder eg_make_creation ,
desktop:~/eg_make_creation$ ls
factorial.c functions.h hello hello.c main.c Makefile
Makefile
# I am a comment, and I want to say that the variable CC will be
# the compiler to use.
CC=gcc
# Hwy!, I am comment no.2. I want to say that CFLAGS will be the
#options I'll pass to the compiler
CFLAGS=-c -Wall
all:hello
hello:main.o factorial.o hello.o
$(CC) main.o factorial.o hello.o -o hello
main.o:main.c
$(CC) $(CFLAGS) main.c
factorial.o:factorial.c
$(CC) $(CFLAGS) factorial.c
hello.o:hello.c
$(CC) $(CFLAGS) hello.c
clean:
rm -rf *o hello
Please help me to solve this error.
The cause: Sometimes spaces rather than tabs before the command in the makefile rule can result in the “Nothing to be done for all” problem.
Solution: Please make sure to replace any spaces in your rules with tabs.
instead of