I need to create a makefile for my C program. The code is devided in 3 directories like the following example:
main.c
controllers
models
tarefas.c
tarefas.h
views
For reference I'm working on a Windows 10.
The make file I first wrote is as follows:
CC = gcc
CFLAGS = -Wall
LDFLAGS =
OBJFILES = main.o .\views\cli.o .\models\tarefas.o .\controllers\listatarefas.o
TARGET = Lab_02_APP
all: $(TARGET)
$(TARGET): $(OBJFILES)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJFILES) $(LDFLAGS)
clean:
$(RM) $(OBJFILES) *~
But after running the command 'make clean' I receive an error message saying:
process_begin: CreateProcess(NULL, rm -f main.o, ...) failed.
make (e=2): System couldn't locate specified file.
make: *** [clean] Error 2
Make is telling you that the command rm
was not found. Either install it or use a Windows specific command del
perhaps by setting the variable RM = del /q
.