Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

makefile

I keep getting this error:

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

Even though my make file looks like this:

CC=gcc CFLAGS=-c -Wall  all: build  build: inputText.o outputText.o main.o     gcc main.o inputText.o outputText.o -o main  main.o: main.c     $(CC) $(CFLAGS) main.c -o main.o  inputText.o: inputText.c     $(CC) $(CFLAGS) inputText.c -o inputText.o  outputText.o: outputText.c     $(CC) $(CFLAGS) outputText.c -o outputText.o 

Yes there should be a tab space underneath the target and there is in my make file.

I can get it to work if I try one of the targets like main.o, inputText.o and outputText.o but can't with either build or all.

EDIT: I just randomly tried running make and telling it the file using the following command:

make -f make 

This works but why doesn't just typing make work?

like image 262
Dean Avatar asked Mar 27 '12 08:03

Dean


People also ask

How do you solve no rule to make a target?

One technique that may be employed to mitigate the 'No rule to make target' message is to delete the build and dist directories, followed by doing a clean and build for the new project configuration. This is generally a last recourse. MPLAB® X should re-generate the makefiles when needed.

What does it mean no rule to make target?

The message is formatted as: *** No rule to make target 'file supposed to be input', needed by 'the file going to make'. That is, no rules are defined to locate the input file. This error occurs when there are errors or inconsistencies in build configurations.


1 Answers

Your makefile should ideally be named makefile, not make. Note that you can call your makefile anything you like, but as you found, you then need the -f option with make to specify the name of the makefile. Using the default name of makefile just makes life easier.

like image 197
Paul R Avatar answered Sep 18 '22 11:09

Paul R