I keep getting the error make: *** No rule to make target ‘all’. Stop. whenever I run make all or make clean, despite having the correct data in my Makefile. How can I resolve this? Below is the code in make file
CC = arm-none-eabi-gcc
MACH = cortex-m4
CFLAGS = -c -mcpu=$(MACH) -mthumb -std=gnu11 -O0 -Wall
# List of object files
all:main.o led.o stm32_startup.o
# Rules for creating object files
main.o:main.c
$(CC) $(CFLAGS) $^ -o $@
led.o:led.c
$(CC) $(CFLAGS) $^ -o $@
stm32_startup.o:stm32_startup.c
$(CC) $(CFLAGS) $^ -o $@
# Clean rule
clean:
rm -rf *.o *.elf
I have tried in bash, cmd and powershell and I am getting same error.
These are the steps that I have tried:
- Check File Name and Location
- Verify Indentation
- Check Line Endings
- Run make with Debugging (no result as well)
New contributor
Shivam Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.