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?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With