Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"make clean" results in "No rule to make target `clean'"

Tags:

I am running Ubuntu 10.04. Whenever I run make clean, I get this:

make: *** No rule to make target `clean'. Stop.

Here is my makefile:

CC = gcc CFLAGS = -g -pedantic -O0 -std=gnu99 -m32 -Wall PROGRAMS = digitreversal all : $(PROGRAMS) digitreversal : digitreversal.o        $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) .PHONY: clean clean:        @rm -f $(PROGRAMS) *.o core 

Any ideas why its not working?

EDIT: It seems like doing:

make -f Makefile.txt clean 

works. Now: is there any setting to change so I don't have to do the -f Makefile.txt every time?

like image 330
jasonbogd Avatar asked Nov 15 '10 07:11

jasonbogd


2 Answers

It seems your makefile's name is not 'Makefile' or 'makefile'. In case it is different say 'abc' try running 'make -f abc clean'

like image 63
Siddique Avatar answered Sep 29 '22 20:09

Siddique


I suppose you have figured it out by now. The answer is hidden in your first mail itself.

The make command by default looks for makefile, Makefile, and GNUMakefile as the input file and you are having Makefile.txt in your folder. Just remove the file extension (.txt) and it should work.

like image 28
Navaneetha Kandethodi Avatar answered Sep 29 '22 20:09

Navaneetha Kandethodi